Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LatticeTiling.h
Go to the documentation of this file.
1//
2// Copyright (C) 2007, 2008, 2012, 2014, 2015, 2016, 2017 Karl Wette
3//
4// This program is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation; either version 2 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with with program; see the file COPYING. If not, write to the
16// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17// MA 02110-1301 USA
18//
19
20#ifndef _LATTICETILING_H
21#define _LATTICETILING_H
22
23#include <stdbool.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>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35///
36/// \defgroup LatticeTiling_h Header LatticeTiling.h
37/// \ingroup lalpulsar_templbank
38/// \author Karl Wette
39/// \brief Lattice-based template generation for constant-metric parameter spaces, described in
40/// \cite Wette2009a and \cite Wette2014a .
41///
42/// @{
43///
44
45///
46/// Describes a lattice tiling parameter-space bounds and metric.
47///
48typedef struct tagLatticeTiling LatticeTiling;
49
50///
51/// Iterates over all points in a lattice tiling.
52///
53typedef struct tagLatticeTilingIterator LatticeTilingIterator;
54
55///
56/// Locates the nearest point in a lattice tiling.
57///
58typedef struct tagLatticeTilingLocator LatticeTilingLocator;
59
60///
61/// Type of lattice to generate tiling with.
62///
63typedef enum tagTilingLattice {
64 TILING_LATTICE_CUBIC, ///< Cubic ( \f$ Z_n \f$ ) lattice
65 TILING_LATTICE_ANSTAR, ///< An-star ( \f$ A_n^* \f$ ) lattice
68
69///
70/// Static array of all :tagTilingLattice choices, for use by the UserInput module parsing routines
71///
73
74///
75/// Log level at which to print progress messages when counting templates and performing callbacks
76///
78
79///
80/// Function which returns a bound on a dimension of the lattice tiling.
81///
82typedef double( *LatticeTilingBound )(
83 const void *data, ///< [in] Arbitrary data describing parameter space bound
84 const size_t dim, ///< [in] Dimension on which bound applies
85 const gsl_matrix *cache, ///< [in] Cached values computed in lower dimensions
86 const gsl_vector *point ///< [in] Point at which to find bound
87);
88
89///
90/// Function which caches values required by a lattice tiling bound function.
91///
92typedef void( *LatticeTilingBoundCache )(
93 const size_t dim, ///< [in] Dimension on which bound applies
94 const gsl_vector *point, ///< [in] Point at which to find bound
95 gsl_vector *cache ///< [out] Values to cache
96);
97
98///
99/// Callback function which can be used to compute properties of a lattice tiling.
100///
102 const bool first_call, ///< [in] Whether this is the first call to this function
103 const LatticeTiling *tiling, ///< [in] Lattice tiling
104 const LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
105 const gsl_vector *point, ///< [in] Current lattice tiling point
106 const size_t changed_i, ///< [in] Index of first dimension to have changed since last call
107 const void *param, ///< [in] Arbitrary input data for use by callback function
108 void *out ///< [out] Output data to be filled by callback function
109);
110
111///
112/// Statistics related to the number/value of lattice tiling points in a dimension.
113///
114#ifdef SWIG /* SWIG interface directives */
115SWIGLAL( IMMUTABLE_MEMBERS( tagLatticeTilingStats, name ) );
116#endif /* SWIG */
117typedef struct tagLatticeTilingStats {
118 const char *name; ///< Name of parameter-space dimension
119 UINT8 total_points; ///< Total number of points up to this dimension
120 UINT4 min_points; ///< Minimum number of points in this dimension
121 UINT4 max_points; ///< Maximum number of points in this dimension
122 double min_value; ///< Minimum value of points in this dimension
123 double max_value; ///< Maximum value of points in this dimension
125
126///
127/// Create a new lattice tiling.
128///
129LatticeTiling *XLALCreateLatticeTiling(
130 const size_t ndim ///< [in] Number of parameter-space dimensions
131);
132
133///
134/// Destroy a lattice tiling.
135///
137 LatticeTiling *tiling ///< [in] Lattice tiling
138);
139
140///
141/// Set a parameter-space bound on a dimension of the lattice tiling. The bound is described by a
142/// function \c func, and two data of length \c data_len, \c data_lower and \c data_upper,
143/// describing the lower and upper parameter space bounds respectively. If \c data_lower and \c
144/// data_upper are identical, this parameter-space dimension will be treated as a single point, and
145/// will not be tiled.
146///
148 LatticeTiling *tiling, ///< [in] Lattice tiling
149 const size_t dim, ///< [in] Dimension on which bound applies
150 const LatticeTilingBound func, ///< [in] Parameter space bound function
151 const size_t data_len, ///< [in] Length of arbitrary data describing parameter space bounds
152 const void *data_lower, ///< [in] Arbitrary data describing lower parameter space bound
153 const void *data_upper ///< [in] Arbitrary data describing upper parameter space bound
154);
155
156///
157/// Set the name of a lattice tiling parameter-space dimension.
158///
160 LatticeTiling *tiling, ///< [in] Lattice tiling
161 const size_t dim, ///< [in] Dimension to which name applies
162 const char *fmt, ///< [in] Name format string
163 ... ///< [in] Arguments to format string
164) _LAL_GCC_PRINTF_FORMAT_( 3, 4 );
165
166///
167/// Set bound cache function for a lattice tiling parameter-space dimension
168///
170 LatticeTiling *tiling, ///< [in] Lattice tiling
171 const size_t dim, ///< [in] Dimension on which bound cache function applies
172 const LatticeTilingBoundCache func ///< [in] Parameter space bound cache function
173);
174
175///
176/// Set a constant lattice tiling parameter-space bound, given by the minimum and maximum of the two
177/// supplied bounds, on a dimension of the lattice tiling.
178///
180 LatticeTiling *tiling, ///< [in] Lattice tiling
181 const size_t dim, ///< [in] Dimension on which bound applies
182 const double bound1, ///< [in] First bound on dimension
183 const double bound2 ///< [in] Second bound on dimension
184);
185
186///
187/// Control the padding of lattice tiling parameter-space bounds in the given dimension.
188/// This is an optional setting and should generally not be used unless specifically required.
189///
190/// All parameters, if passed a negative value, will use their built-in defaults.
191///
192/// The <tt>{lower|upper}_{bbox|intp}_pad</tt> parameters set the extra padding added to the
193/// parameter space; see \cite Wette2014a , Fig. 6 for an illustration of why this is needed.
194///
195/// Setting all <tt>{lower|upper}_{bbox|intp}_pad</tt> parameters to zero triggers a \e strict
196/// mode, where the lattice tiling will not place points outside the prescribed parameter space
197/// bounds.
198///
199/// If \c find_bound_extrema is true, the parameter-space padding is extended to the extrema of
200/// the parameter-space bounds, by sampling the bounds around the current point. This is intended
201/// to address the "staircase" boundary template issue described in \cite Wette2014a , Sec. IV E.
202///
204 LatticeTiling *tiling, ///< [in] Lattice tiling
205 const size_t dim, ///< [in] Dimension on which to set padding control flags
206 const double lower_bbox_pad, ///< [in] Lower padding as multiple of metric ellipse bounding box; use default if negative
207 const double upper_bbox_pad, ///< [in] Upper padding as multiple of metric ellipse bounding box; use default if negative
208 const int lower_intp_pad, ///< [in] Lower padding as integer number of points; use default if negative
209 const int upper_intp_pad, ///< [in] Upper padding as integer number of points; use default if negative
210 const int find_bound_extrema ///< [in] Whether to find the extrema of the parameter-space bounds; use default if negative
211);
212
213///
214/// Set the physical parameter-space origin of the lattice tiling in the given dimension.
215/// This is an optional setting and should generally not be used unless specifically required.
216///
218 LatticeTiling *tiling, ///< [in] Lattice tiling
219 const size_t dim, ///< [in] Dimension in which to set origin
220 const double origin ///< [in] Physical parameter-space origin
221);
222
223///
224/// Offset the physical parameter-space origin of the lattice tiling by a random fraction of the
225/// lattice step size in tiled dimensions. This is important when performing mismatch studies to
226/// ensure that the mismatch distribution is fully sampled.
227///
229 LatticeTiling *tiling, ///< [in] Lattice tiling
230 RandomParams *rng ///< [in] Random number generator used to generate offsets
231);
232
233///
234/// Set the tiled (i.e. not a single point) dimensions of a lattice from a reference lattice.
235/// This is an optional setting and should generally not be used unless specifically required.
236///
238 LatticeTiling *tiling, ///< [in] Lattice tiling to set tiled dimensions on
239 const LatticeTiling *ref_tiling ///< [in] Reference lattice tiling for tiled dimensions
240);
241
242///
243/// Set the tiling lattice, parameter-space metric, and maximum prescribed mismatch. The lattice
244/// tiling \c tiling is now fully initialised, and can be used to create tiling iterators [via
245/// XLALCreateLatticeTilingIterator()] and locators [via XLALCreateLatticeTilingLocator()].
246///
248 LatticeTiling *tiling, ///< [in] Lattice tiling
249 const TilingLattice lattice, ///< [in] Type of lattice to generate tiling with
250 const gsl_matrix *metric, ///< [in] Parameter-space metric
251 const double max_mismatch ///< [in] Maximum prescribed mismatch
252);
253
254///
255/// Return the total number of dimensions of the lattice tiling.
256///
258 const LatticeTiling *tiling ///< [in] Lattice tiling
259);
260
261///
262/// Return the number of tiled dimensions of the lattice tiling.
263///
265 const LatticeTiling *tiling ///< [in] Lattice tiling
266);
267
268///
269/// Return the dimension of the tiled lattice tiling dimension indexed by 'tiled_dim'
270///
272 const LatticeTiling *tiling, ///< [in] Lattice tiling
273 const size_t tiled_dim ///< [in] Index of tiled dimension to return
274);
275
276///
277/// Return >0 if a lattice tiling dimension is tiled (i.e. not a single point), and 0 otherwise.
278///
280 const LatticeTiling *tiling, ///< [in] Lattice tiling
281 const size_t dim ///< [in] Dimension of which to return tiling status
282);
283
284///
285/// Get the name of a lattice tiling parameter-space dimension.
286///
288 const LatticeTiling *tiling, ///< [in] Lattice tiling
289 const size_t dim ///< [in] Dimension for which to get name
290);
291
292///
293/// Return the index of the lattice tiling dimension which has the given name
294///
296 const LatticeTiling *tiling, ///< [in] Lattice tiling
297 const char *bound_name ///< [in] Name of bound for which to find index
298);
299
300///
301/// Return the step size of the lattice tiling in a given dimension, or 0 for non-tiled dimensions.
302///
304 const LatticeTiling *tiling, ///< [in] Lattice tiling
305 const size_t dim ///< [in] Dimension of which to return step size
306);
307
308///
309/// Return the bounding box extent of the lattice tiling in a given dimension, or 0 for non-tiled
310/// dimensions.
311///
313 const LatticeTiling *tiling, ///< [in] Lattice tiling
314 const size_t dim ///< [in] Dimension of which to return bounding box extent
315);
316
317///
318/// Register a callback function which can be used to compute properties of a lattice tiling.
319/// Returns a const pointer to the output data to be filled by the callback function.
320///
322 LatticeTiling *tiling, ///< [in] Lattice tiling
323 const LatticeTilingCallback func, ///< [in] Callback function
324 const size_t param_len, ///< [in] Length of arbitrary input data for use by callback function
325 const void *param, ///< [in] Arbitrary input data for use by callback function
326 const size_t out_len ///< [in] Length of output data to be filled by callback function
327);
328
329///
330/// Perform all registered lattice tiling callbacks.
331///
333 const LatticeTiling *tiling ///< [in] Lattice tiling
334);
335
336///
337/// Return statistics related to the number/value of lattice tiling points in a dimension.
338///
339/// Statistics are computed through a callback function with XLALPerformLatticeTilingCallbacks().
340///
342 const LatticeTiling *tiling, ///< [in] Lattice tiling
343 const size_t dim ///< [in] Dimension in which to return statistics
344);
345
346///
347/// Generate random points within the parameter space of the lattice tiling. Points can be scaled
348/// to fill the parameter space exactly (<tt>scale == 0</tt>), fill a subset of the parameter space
349/// (<tt>-1 < scale < 0</tt>), or fill outside the parameter space (<tt>scale > 0</tt>).
350///
352 const LatticeTiling *tiling, ///< [in] Lattice tiling
353 const double scale, ///< [in] Scale of random points
354 RandomParams *rng, ///< [in] Random number generator used to generate points
355 gsl_matrix *random_points ///< [out] Matrix whose columns are the random points
356);
357
358///
359/// Get a parameter-space bound on a dimension of the lattice tiling. This is a convenience function
360/// which returns the bounds set by XLALSetLatticeTilingBound() for debugging, plotting, etc.
361///
363 const LatticeTiling *tiling, ///< [in] Lattice tiling
364 const size_t dim, ///< [in] Dimension on which bound applies
365 const gsl_vector *point, ///< [in] Point at which bound applies
366 const bool padding, ///< [in] Whether to add padding to bounds
367 double *lower, ///< [out] Lower parameter-space bound
368 double *upper ///< [out] Upper parameter-space bound
369);
370
371///
372/// Create a new lattice tiling iterator.
373///
374#ifdef SWIG // SWIG interface directives
375SWIGLAL( RETURN_OWNED_BY_1ST_ARG( int, XLALCreateLatticeTilingIterator ) );
376#endif
377LatticeTilingIterator *XLALCreateLatticeTilingIterator(
378 const LatticeTiling *tiling, ///< [in] Lattice tiling
379 const size_t itr_ndim ///< [in] Number of parameter-space dimensions to iterate over
380);
381
382///
383/// Destroy a lattice tiling iterator.
384///
386 LatticeTilingIterator *itr ///< [in] Lattice tiling iterator
387);
388
389///
390/// Set whether the lattice tiling iterator should alternate its iteration direction (i.e. lower to
391/// upper bound, then upper to lower bound, and so on) after every crossing of each dimension.
392///
394 LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
395 const bool alternating ///< [in] If true, set alternating iterator
396);
397
398///
399/// Reset an iterator to the beginning of a lattice tiling.
400///
402 LatticeTilingIterator *itr ///< [in] Lattice tiling iterator
403);
404
405///
406/// Advance lattice tiling iterator, and optionally return the next point in \c point. Returns >0
407/// if there are points remaining, 0 if there are no more points, and XLAL_FAILURE on error.
408///
410 LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
411 gsl_vector *point ///< [out] Next point in lattice tiling
412);
413
414///
415/// Advance lattice tiling iterator, and optionally return the next set of points in \c points.
416/// Returns the number of points stored in \c points if there are points remaining, 0 if there
417/// are no more points, and XLAL_FAILURE on error.
418///
419#ifdef SWIG // SWIG interface directives
420SWIGLAL( RETURN_VALUE( int, XLALNextLatticeTilingPoints ) );
421SWIGLAL( INOUT_STRUCTS( gsl_matrix **, points ) );
422#endif
424 LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
425 gsl_matrix **points ///< [out] Columns are next set of points in lattice tiling
426);
427
428///
429/// Return the total number of points covered by the lattice tiling iterator.
430///
432 const LatticeTilingIterator *itr ///< [in] Lattice tiling iterator
433);
434
435///
436/// Return the total number of points along a certain dimension covered by the lattice tiling iterator.
437///
439 const LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
440 const size_t dim ///< [in] Dimension for which to return count
441);
442
443///
444/// Return the index of the current point in the lattice tiling iterator.
445///
447 const LatticeTilingIterator *itr ///< [in] Lattice tiling iterator
448);
449
450///
451/// Return indexes of the left-most and right-most points in the current block of points in the
452/// given dimension, relative to the current point.
453///
455 const LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
456 const size_t dim, ///< [in] Dimension in which to return block
457 INT4 *left, ///< [out] Index of left-most point of block relative to current point
458 INT4 *right ///< [out] Index of right-most point of block relative to current point
459);
460
461///
462/// Save the state of a lattice tiling iterator to a FITS file.
463///
465 const LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
466 FITSFile *file, ///< [in] FITS file to save iterator to
467 const char *name ///< [in] FITS HDU to save iterator to
468);
469
470///
471/// Restore the state of a lattice tiling iterator from a FITS file.
472///
474 LatticeTilingIterator *itr, ///< [in] Lattice tiling iterator
475 FITSFile *file, ///< [in] FITS file to restore iterator from
476 const char *name ///< [in] FITS HDU to restore iterator from
477);
478
479///
480/// Create a new lattice tiling locator. If there are tiled dimensions, an index trie is internally built.
481///
482#ifdef SWIG // SWIG interface directives
483SWIGLAL( RETURN_OWNED_BY_1ST_ARG( int, XLALCreateLatticeTilingLocator ) );
484#endif
485LatticeTilingLocator *XLALCreateLatticeTilingLocator(
486 const LatticeTiling *tiling ///< [in] Lattice tiling
487);
488
489///
490/// Destroy a lattice tiling locator.
491///
493 LatticeTilingLocator *loc ///< [in] Lattice tiling locator
494);
495
496///
497/// Locate the nearest point in a lattice tiling to a given point. Return optionally the nearest
498/// point in \c nearest_point, and sequential indexes, unique up to each dimension, to the nearest
499/// point in \c nearest_index.
500///
502 const LatticeTilingLocator *loc, ///< [in] Lattice tiling locator
503 const gsl_vector *point, ///< [in] Point for which to find nearest point
504 gsl_vector *nearest_point, ///< [out] Nearest point
505 UINT8Vector *nearest_index ///< [out] Unique sequential indexes of the nearest point
506);
507
508///
509/// Locate the nearest points in a lattice tiling to a given set of points. Return the nearest
510/// points in \c nearest_points, and optionally sequential indexes, unique up to each dimension,
511/// to the nearest points in \c nearest_seqs_idxs. Outputs are dynamically resized as required.
512///
513#ifdef SWIG // SWIG interface directives
514SWIGLAL( INOUT_STRUCTS( gsl_matrix **, nearest_points ) );
515SWIGLAL( INOUT_STRUCTS( UINT8VectorSequence **, nearest_indexes ) );
516#endif
518 const LatticeTilingLocator *loc, ///< [in] Lattice tiling locator
519 const gsl_matrix *points, ///< [in] Columns are set of points for which to find nearest points
520 gsl_matrix **nearest_points, ///< [out] Columns are the corresponding nearest points
521 UINT8VectorSequence **nearest_indexes ///< [out] Vectors are unique sequential indexes of the nearest points
522);
523
524///
525/// Locate the nearest block in a lattice tiling to a given point. Return the nearest point in
526/// \c nearest_point, the unique sequential index in dimension <tt>dim-1</tt> to the nearest point in
527/// \c nearest_index, and the indexes of the left-most \c nearest_left and right-most \c nearest_right
528/// points in the nearest block, relative to the nearest point.
529///
531 const LatticeTilingLocator *loc, ///< [in] Lattice tiling locator
532 const gsl_vector *point, ///< [in] Point for which to find nearest point
533 const size_t dim, ///< [in] Dimension for which to return indexes
534 gsl_vector *nearest_point, ///< [out] Nearest point
535 UINT8 *nearest_index, ///< [out] Unique sequential index of the nearest point in <tt>dim-1</tt>
536 INT4 *nearest_left, ///< [out] Index of left-most point of block relative to nearest point
537 INT4 *nearest_right ///< [out] Index of right-most point of block relative to nearest point
538);
539
540///
541/// Print the internal index trie of a lattice tiling locator to the given file pointer.
542///
544 const LatticeTilingLocator *loc, ///< [in] Lattice tiling locator
545 FILE *file ///< [in] File pointer to print trie to
546);
547
548/// @}
549
550#ifdef __cplusplus
551}
552#endif
553
554#endif // _LATTICETILING_H
555
556// Local Variables:
557// c-file-style: "linux"
558// c-basic-offset: 2
559// End:
const char * name
Definition: SearchTiming.c:93
const double scale
multiplicative scaling factor of the coordinate
struct tagFITSFile FITSFile
Representation of a FITS file.
Definition: FITSFileIO.h:54
uint64_t UINT8
double REAL8
uint32_t UINT4
int32_t INT4
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.
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.
Definition: LatticeTiling.h:82
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.
const char * XLALLatticeTilingBoundName(const LatticeTiling *tiling, const size_t dim)
Get the name of a lattice tiling parameter-space dimension.
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.
UINT8 XLALLatticeTilingPointsAtDimension(const LatticeTilingIterator *itr, const size_t dim)
Return the total number of points along a certain dimension 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.
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.
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.
void(* LatticeTilingBoundCache)(const size_t dim, const gsl_vector *point, gsl_vector *cache)
Function which caches values required by a lattice tiling bound function.
Definition: LatticeTiling.h:92
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.
int XLALPerformLatticeTilingCallbacks(const LatticeTiling *tiling)
Perform all registered lattice tiling callbacks.
LatticeTilingIterator * XLALCreateLatticeTilingIterator(const LatticeTiling *tiling, const size_t itr_ndim)
Create a new lattice tiling iterator.
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.
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.
LatticeTiling * XLALCreateLatticeTiling(const size_t ndim)
Create a new lattice tiling.
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...
const LatticeTilingStats * XLALLatticeTilingStatistics(const LatticeTiling *tiling, const size_t dim)
Return statistics related to the number/value of lattice tiling points in a dimension.
const UserChoices TilingLatticeChoices
Static array of all :tagTilingLattice choices, for use by the UserInput module parsing routines.
int XLALPrintLatticeTilingIndexTrie(const LatticeTilingLocator *loc, FILE *file)
Print the internal index trie of a lattice tiling locator to the given file pointer.
LatticeTilingLocator * XLALCreateLatticeTilingLocator(const LatticeTiling *tiling)
Create a new lattice tiling locator.
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.
TilingLattice
Type of lattice to generate tiling with.
Definition: LatticeTiling.h:63
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.
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.
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 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...
@ TILING_LATTICE_ANSTAR
An-star ( ) lattice.
Definition: LatticeTiling.h:65
@ TILING_LATTICE_MAX
Definition: LatticeTiling.h:66
@ TILING_LATTICE_CUBIC
Cubic ( ) lattice.
Definition: LatticeTiling.h:64
float data[BLOCKSIZE]
Definition: hwinject.c:360
out
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.