22#include <lal/LatticeTiling.h>
23#include <lal/LogPrintf.h>
24#include <lal/PiecewiseModel.h>
27#define UNUSED __attribute__ ((unused))
35typedef struct tagPiecewiseBoundInfo {
53 double base = 1 + (
n - 1 ) *
k * pow(
f0,
n - 1 ) *
t;
54 double power = 1 / ( 1 -
n );
57 return f0 * pow( base, power );
58 }
else if (
d == 1 ) {
59 double factor = -1 * pow(
f0,
n ) *
k;
60 return factor * pow( base, power - 1 );
61 }
else if (
d == 2 ) {
62 double factor = pow(
f0, 2 *
n - 1 ) *
k *
k *
n;
63 double secondderiv = factor * pow( base, power - 2 );
75 const size_t dim UNUSED,
76 const gsl_matrix *
cache UNUSED,
77 const gsl_vector *point
83 const double f0 = gsl_vector_get( point, dim -
info->s );
89 printf(
"f >= f0, %g >= %g",
f,
f0 );
100 const size_t dim UNUSED,
101 const gsl_matrix *
cache UNUSED,
102 const gsl_vector *point
108 const double f0 = gsl_vector_get( point, dim - 1 );
122 const size_t dim UNUSED,
123 const gsl_matrix *
cache UNUSED,
124 const gsl_vector *point
130 const double f0 = gsl_vector_get( point, dim - 2 );
151 const gsl_vector *
knots,
152 const gsl_vector *bboxpad,
153 const gsl_vector_int *intpad
166 info_knot_lower.s = info_knot_upper.s =
s;
168 info_knot_lower.n =
nmax;
169 info_knot_lower.k =
kmax;
171 info_knot_upper.n =
nmin;
172 info_knot_upper.k =
kmin;
184 for (
size_t knot = 1; knot <
knots->size; ++knot ) {
185 info_knot_lower.dt = info_knot_upper.dt = gsl_vector_get(
knots, knot ) - gsl_vector_get(
knots, knot - 1 );
186 size_t dimindex =
s * knot;
201 for (
size_t dim = 0; dim <
s *
knots->size; ++dim ) {
202 XLAL_CHECK(
XLALSetLatticeTilingPadding(
tiling, dim, gsl_vector_get( bboxpad, dim ), gsl_vector_get( bboxpad, dim ), gsl_vector_int_get( intpad, dim ), gsl_vector_int_get( intpad, dim ),
false ) ==
XLAL_SUCCESS,
XLAL_EFAILED );
static double F1Bound(const void *data, const size_t dim UNUSED, const gsl_matrix *cache UNUSED, const gsl_vector *point)
Sets the bound on the first derivative frequency parameter.
static double GTEAndDerivs(double f0, double n, double k, double t, int d)
The general torque equation and its first two derivatives.
int XLALSetLatticeTilingPiecewiseBounds(LatticeTiling *tiling, const size_t s, const double fmin, const double fmax, const double nmin, const double nmax, const double kmin, const double kmax, const gsl_vector *knots, const gsl_vector *bboxpad, const gsl_vector_int *intpad)
Sets the bounds for the piecewise model.
static double F2Bound(const void *data, const size_t dim UNUSED, const gsl_matrix *cache UNUSED, const gsl_vector *point)
Sets the bounds on the second derivative frequency parameter.
static double F0Bound(const void *data, const size_t dim UNUSED, const gsl_matrix *cache UNUSED, const gsl_vector *point)
Sets the bound on the frequency parameter.
#define XLAL_INIT_DECL(var,...)
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.
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 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.
#define XLAL_CHECK(assertion,...)
A struct containing the relevant information for calculating upper and lower bounds on a specific pie...
double dt
Time between knots.
size_t s
Number of frequency/spindown parameters per knot.