20 #ifndef _LATTICETILING_H
21 #define _LATTICETILING_H
24 #include <gsl/gsl_vector.h>
25 #include <gsl/gsl_matrix.h>
26 #include <lal/LALStdlib.h>
27 #include <lal/UserInputParse.h>
28 #include <lal/Random.h>
29 #include <lal/FITSFileIO.h>
63 typedef enum tagTilingLattice {
85 const gsl_matrix *
cache,
86 const gsl_vector *point
94 const gsl_vector *point,
102 const bool first_call,
103 const LatticeTiling *
tiling,
104 const LatticeTilingIterator *itr,
105 const gsl_vector *point,
106 const size_t changed_i,
115 SWIGLAL( IMMUTABLE_MEMBERS( tagLatticeTilingStats,
name ) );
117 typedef struct tagLatticeTilingStats {
137 LatticeTiling *tiling
148 LatticeTiling *tiling,
151 const size_t data_len,
152 const void *data_lower,
153 const void *data_upper
160 LatticeTiling *tiling,
164 ) _LAL_GCC_PRINTF_FORMAT_( 3, 4 );
170 LatticeTiling *tiling,
180 LatticeTiling *tiling,
204 LatticeTiling *tiling,
206 const
double lower_bbox_pad,
207 const
double upper_bbox_pad,
208 const
int lower_intp_pad,
209 const
int upper_intp_pad,
210 const
int find_bound_extrema
218 LatticeTiling *tiling,
229 LatticeTiling *tiling,
238 LatticeTiling *tiling,
239 const LatticeTiling *ref_tiling
248 LatticeTiling *tiling,
250 const gsl_matrix *metric,
251 const
double max_mismatch
258 const LatticeTiling *tiling
265 const LatticeTiling *tiling
272 const LatticeTiling *tiling,
273 const
size_t tiled_dim
280 const LatticeTiling *tiling,
288 const LatticeTiling *tiling,
296 const LatticeTiling *tiling,
297 const
char *bound_name
304 const LatticeTiling *tiling,
313 const LatticeTiling *tiling,
322 LatticeTiling *tiling,
324 const
size_t param_len,
333 const LatticeTiling *tiling
342 const LatticeTiling *tiling,
352 const LatticeTiling *tiling,
355 gsl_matrix *random_points
363 const LatticeTiling *tiling,
365 const gsl_vector *point,
378 const LatticeTiling *tiling,
379 const size_t itr_ndim
386 LatticeTilingIterator *itr
394 LatticeTilingIterator *itr,
395 const bool alternating
402 LatticeTilingIterator *itr
410 LatticeTilingIterator *itr,
421 SWIGLAL( INOUT_STRUCTS( gsl_matrix **, points ) );
424 LatticeTilingIterator *itr,
432 const LatticeTilingIterator *itr
439 const LatticeTilingIterator *itr
447 const LatticeTilingIterator *itr,
457 const LatticeTilingIterator *itr,
466 LatticeTilingIterator *itr,
478 const LatticeTiling *tiling
485 LatticeTilingLocator *
loc
494 const LatticeTilingLocator *
loc,
495 const gsl_vector *point,
496 gsl_vector *nearest_point,
506 SWIGLAL( INOUT_STRUCTS( gsl_matrix **, nearest_points ) );
510 const LatticeTilingLocator *
loc,
511 const gsl_matrix *points,
512 gsl_matrix **nearest_points,
523 const LatticeTilingLocator *
loc,
524 const gsl_vector *point,
526 gsl_vector *nearest_point,
527 UINT8 *nearest_index,
536 const LatticeTilingLocator *
loc,
const double scale
multiplicative scaling factor of the coordinate
struct tagFITSFile FITSFile
Representation of a FITS file.
int XLALSetLatticeTilingBoundName(LatticeTiling *tiling, const size_t dim, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(3
Set the name of a lattice tiling parameter-space dimension.
int XLALIsTiledLatticeTilingDimension(const LatticeTiling *tiling, const size_t dim)
Return >0 if a lattice tiling dimension is tiled (i.e.
int XLALSetLatticeTilingBound(LatticeTiling *tiling, const size_t dim, const LatticeTilingBound func, const size_t data_len, const void *data_lower, const void *data_upper)
Set a parameter-space bound on a dimension of the lattice tiling.
size_t XLALTotalLatticeTilingDimensions(const LatticeTiling *tiling)
Return the total number of dimensions of the lattice tiling.
int XLALNearestLatticeTilingPoint(const LatticeTilingLocator *loc, const gsl_vector *point, gsl_vector *nearest_point, UINT8Vector *nearest_index)
Locate the nearest point in a lattice tiling to a given point.
UINT8 XLALTotalLatticeTilingPoints(const LatticeTilingIterator *itr)
Return the total number of points covered by the lattice tiling iterator.
int XLALSetLatticeTilingConstantBound(LatticeTiling *tiling, const size_t dim, const double bound1, const double bound2)
Set a constant lattice tiling parameter-space bound, given by the minimum and maximum of the two supp...
int XLALSetTiledLatticeDimensionsFromTiling(LatticeTiling *tiling, const LatticeTiling *ref_tiling)
Set the tiled (i.e.
const LatticeTilingStats * XLALLatticeTilingStatistics(const LatticeTiling *tiling, const size_t dim)
Return statistics related to the number/value of lattice tiling points in a dimension.
int XLALSaveLatticeTilingIterator(const LatticeTilingIterator *itr, FITSFile *file, const char *name)
Save the state of a lattice tiling iterator to a FITS file.
REAL8 XLALLatticeTilingStepSize(const LatticeTiling *tiling, const size_t dim)
Return the step size of the lattice tiling in a given dimension, or 0 for non-tiled dimensions.
int XLALGetLatticeTilingBound(const LatticeTiling *tiling, const size_t dim, const gsl_vector *point, const bool padding, double *lower, double *upper)
Get a parameter-space bound on a dimension of the lattice tiling.
int XLALLatticeTilingDimensionByName(const LatticeTiling *tiling, const char *bound_name)
Return the index of the lattice tiling dimension which has the given name.
int XLALSetTilingLatticeAndMetric(LatticeTiling *tiling, const TilingLattice lattice, const gsl_matrix *metric, const double max_mismatch)
Set the tiling lattice, parameter-space metric, and maximum prescribed mismatch.
void(* LatticeTilingBoundCache)(const size_t dim, const gsl_vector *point, gsl_vector *cache)
Function which caches values required by a lattice tiling bound function.
double(* LatticeTilingBound)(const void *data, const size_t dim, const gsl_matrix *cache, const gsl_vector *point)
Function which returns a bound on a dimension of the lattice tiling.
int XLALNearestLatticeTilingBlock(const LatticeTilingLocator *loc, const gsl_vector *point, const size_t dim, gsl_vector *nearest_point, UINT8 *nearest_index, INT4 *nearest_left, INT4 *nearest_right)
Locate the nearest block in a lattice tiling to a given point.
void XLALDestroyLatticeTilingLocator(LatticeTilingLocator *loc)
Destroy a lattice tiling locator.
UINT8 XLALCurrentLatticeTilingIndex(const LatticeTilingIterator *itr)
Return the index of the current point in the lattice tiling iterator.
size_t XLALTiledLatticeTilingDimensions(const LatticeTiling *tiling)
Return the number of tiled dimensions of the lattice tiling.
size_t XLALLatticeTilingTiledDimension(const LatticeTiling *tiling, const size_t tiled_dim)
Return the dimension of the tiled lattice tiling dimension indexed by 'tiled_dim'.
int XLALRestoreLatticeTilingIterator(LatticeTilingIterator *itr, FITSFile *file, const char *name)
Restore the state of a lattice tiling iterator from a FITS file.
LatticeTilingIterator * XLALCreateLatticeTilingIterator(const LatticeTiling *tiling, const size_t itr_ndim)
Create a new lattice tiling iterator.
int XLALPerformLatticeTilingCallbacks(const LatticeTiling *tiling)
Perform all registered lattice tiling callbacks.
void XLALDestroyLatticeTilingIterator(LatticeTilingIterator *itr)
Destroy a lattice tiling iterator.
void XLALDestroyLatticeTiling(LatticeTiling *tiling)
Destroy a lattice tiling.
int XLALNextLatticeTilingPoint(LatticeTilingIterator *itr, gsl_vector *point)
Advance lattice tiling iterator, and optionally return the next point in point.
LatticeTilingLocator * XLALCreateLatticeTilingLocator(const LatticeTiling *tiling)
Create a new lattice tiling locator.
int XLALSetLatticeTilingAlternatingIterator(LatticeTilingIterator *itr, const bool alternating)
Set whether the lattice tiling iterator should alternate its iteration direction (i....
int XLALNearestLatticeTilingPoints(const LatticeTilingLocator *loc, const gsl_matrix *points, gsl_matrix **nearest_points, UINT8VectorSequence **nearest_indexes)
Locate the nearest points in a lattice tiling to a given set of points.
int LatticeTilingProgressLogLevel
Log level at which to print progress messages when counting templates and performing callbacks.
int int XLALSetLatticeTilingBoundCacheFunction(LatticeTiling *tiling, const size_t dim, const LatticeTilingBoundCache func)
Set bound cache function for a lattice tiling parameter-space dimension.
int XLALCurrentLatticeTilingBlock(const LatticeTilingIterator *itr, const size_t dim, INT4 *left, INT4 *right)
Return indexes of the left-most and right-most points in the current block of points in the given dim...
LatticeTiling * XLALCreateLatticeTiling(const size_t ndim)
Create a new lattice tiling.
const UserChoices TilingLatticeChoices
Static array of all :tagTilingLattice choices, for use by the UserInput module parsing routines.
const void * XLALRegisterLatticeTilingCallback(LatticeTiling *tiling, const LatticeTilingCallback func, const size_t param_len, const void *param, const size_t out_len)
Register a callback function which can be used to compute properties of a lattice tiling.
int XLALPrintLatticeTilingIndexTrie(const LatticeTilingLocator *loc, FILE *file)
Print the internal index trie of a lattice tiling locator to the given file pointer.
int XLALSetLatticeTilingOrigin(LatticeTiling *tiling, const size_t dim, const double origin)
Set the physical parameter-space origin of the lattice tiling in the given dimension.
int XLALSetLatticeTilingRandomOriginOffsets(LatticeTiling *tiling, RandomParams *rng)
Offset the physical parameter-space origin of the lattice tiling by a random fraction of the lattice ...
int XLALResetLatticeTilingIterator(LatticeTilingIterator *itr)
Reset an iterator to the beginning of a lattice tiling.
const char * XLALLatticeTilingBoundName(const LatticeTiling *tiling, const size_t dim)
Get the name of a lattice tiling parameter-space dimension.
TilingLattice
Type of lattice to generate tiling with.
int XLALSetLatticeTilingPadding(LatticeTiling *tiling, const size_t dim, const double lower_bbox_pad, const double upper_bbox_pad, const int lower_intp_pad, const int upper_intp_pad, const int find_bound_extrema)
Control the padding of lattice tiling parameter-space bounds in the given dimension.
int XLALNextLatticeTilingPoints(LatticeTilingIterator *itr, gsl_matrix **points)
Advance lattice tiling iterator, and optionally return the next set of points in points.
int XLALRandomLatticeTilingPoints(const LatticeTiling *tiling, const double scale, RandomParams *rng, gsl_matrix *random_points)
Generate random points within the parameter space of the lattice tiling.
REAL8 XLALLatticeTilingBoundingBox(const LatticeTiling *tiling, const size_t dim)
Return the bounding box extent of the lattice tiling in a given dimension, or 0 for non-tiled dimensi...
int(* LatticeTilingCallback)(const bool first_call, const LatticeTiling *tiling, const LatticeTilingIterator *itr, const gsl_vector *point, const size_t changed_i, const void *param, void *out)
Callback function which can be used to compute properties of a lattice tiling.
@ TILING_LATTICE_ANSTAR
An-star ( ) lattice.
@ TILING_LATTICE_CUBIC
Cubic ( ) lattice.
Statistics related to the number/value of lattice tiling points in a dimension.
UINT4 min_points
Minimum number of points in this dimension.
double min_value
Minimum value of points in this dimension.
UINT8 total_points
Total number of points up to this dimension.
double max_value
Maximum value of points in this dimension.
const char * name
Name of parameter-space dimension.
UINT4 max_points
Maximum number of points in this dimension.
Describes a lattice tiling parameter-space bounds and metric.
Iterates over all points in a lattice tiling.
Locates the nearest point in a lattice tiling.
const LatticeTiling * tiling
Lattice tiling.