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

Merge branch 'weave-fix-dim-mismatch' into 'master'

Weave: ensure that coherent and semicoherent lattice tilings have the same tiled/non-tiled dimensions

See merge request lscsoft/lalsuite!1403
parents 107f78e0 4331985a
......@@ -680,6 +680,9 @@ int main( int argc, char *argv[] )
XLAL_CHECK_MAIN( XLALSetLatticeTilingRandomOriginOffsets( tiling[i], rand_par ) == XLAL_SUCCESS, XLAL_EFUNC );
}
// Ensure that coherent and semicoherent lattice tilings have the same tiled/non-tiled dimensions
XLAL_CHECK_MAIN( XLALSetTiledLatticeDimensionsFromTiling( tiling[i], tiling[isemi] ) == XLAL_SUCCESS, XLAL_EFUNC );
// Set coherent parameter-space lattice and metric
XLAL_CHECK_MAIN( XLALSetTilingLatticeAndMetric( tiling[i], uvar->lattice, rssky_metric[i], coh_max_mismatch ) == XLAL_SUCCESS, XLAL_EFUNC );
......
......@@ -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