Commit ae7b836e authored by Karl Wette's avatar Karl Wette
Browse files

LatticeTiling: add function XLALSetTiledLatticeDimensionsFromTiling()

parent c0d800a1
......@@ -1064,6 +1064,35 @@ int XLALSetLatticeTilingRandomOriginOffsets(
}
int XLALSetTiledLatticeDimensionsFromTiling(
LatticeTiling *tiling,
const LatticeTiling *ref_tiling
)
{
// Check input
XLAL_CHECK( tiling != NULL, XLAL_EFAULT );
XLAL_CHECK( tiling->lattice == TILING_LATTICE_MAX, XLAL_EINVAL );
XLAL_CHECK( ref_tiling != NULL, XLAL_EFAULT );
XLAL_CHECK( ref_tiling->lattice < TILING_LATTICE_MAX, XLAL_EINVAL );
XLAL_CHECK( tiling->ndim == ref_tiling->ndim, XLAL_EINVAL );
const size_t n = tiling->ndim;
// Check that all parameter-space dimensions are bounded
for ( size_t i = 0; i < n; ++i ) {
XLAL_CHECK( tiling->bounds[i].func != NULL, XLAL_EFAILED, "Lattice tiling dimension #%zu is unbounded", i );
}
// Set the tiled dimensions of 'tiling' to match 'ref_tiling'
for ( size_t i = 0; i < n; ++i ) {
tiling->bounds[i].is_tiled = ref_tiling->bounds[i].is_tiled;
}
return XLAL_SUCCESS;
}
int XLALSetTilingLatticeAndMetric(
LatticeTiling *tiling,
const TilingLattice lattice,
......
......@@ -229,6 +229,15 @@ int XLALSetLatticeTilingRandomOriginOffsets(
RandomParams *rng ///< [in] Random number generator used to generate offsets
);
///
/// Set the tiled (i.e. not a single point) dimensions of a lattice from a reference lattice.
/// This is an optional setting and should generally not be used unless specifically required.
///
int XLALSetTiledLatticeDimensionsFromTiling(
LatticeTiling *tiling, ///< [in] Lattice tiling to set tiled dimensions on
const LatticeTiling *ref_tiling ///< [in] Reference lattice tiling for tiled dimensions
);
///
/// Set the tiling lattice, parameter-space metric, and maximum prescribed mismatch. The lattice
/// tiling \c tiling is now fully initialised, and can be used to create tiling iterators [via
......@@ -249,7 +258,7 @@ size_t XLALTotalLatticeTilingDimensions(
);
///
/// Return the number of tiled (i.e. not a single point) dimensions of the lattice tiling.
/// Return the number of tiled dimensions of the lattice tiling.
///
size_t XLALTiledLatticeTilingDimensions(
const LatticeTiling *tiling ///< [in] Lattice tiling
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment