23 #include <lal/LALStdlib.h>
24 #include <lal/LALConstants.h>
25 #include <lal/FindRoot.h>
73 if (fabs(y_1) < fabs(y_2))
104 const INT4 imax = 64;
118 y_1 =
y(*xmin, params);
119 y_2 =
y(*xmax, params);
122 for(i = 0; y_1 * y_2 >= 0.0; i++)
128 if(fabs(y_1) < fabs(y_2))
132 y_1 =
y(*xmin, params);
138 y_2 =
y(*xmax, params);
187 const INT4 imax = 64;
191 if (fabs(y_1) < fabs(y_2))
268 const INT4 imax = 40;
292 if (fabs(dx) < input->
xacc)
316 const INT4 imax = 80;
335 y_1 =
y(xmin, params);
336 y_2 =
y(xmax, params);
342 for(i = 0; (xmax - xmin) > xacc; i++)
348 xmid = (xmin + xmax) / 2.0;
349 ymid =
y(xmid, params);
363 else if(y_2 * ymid < 0.0)
376 return((xmin + xmax) / 2.0);
434 const INT4 imax = 80;
458 if (fabs(dx) < input->
xacc)
#define CHECKSTATUSPTR(statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
void LALDBracketRoot(LALStatus *status, DFindRootIn *inout, void *params)
void LALSBracketRoot(LALStatus *status, SFindRootIn *inout, void *params)
#define FINDROOTH_ENULL
Null pointer.
#define FINDROOTH_EIDOM
Invalid initial domain.
#define FINDROOTH_EBRKT
Root not bracketed.
REAL8 XLALDBisectionFindRoot(REAL8(*y)(REAL8, void *), REAL8 xmin, REAL8 xmax, REAL8 xacc, void *params)
int XLALDBracketRoot(REAL8(*y)(REAL8, void *), REAL8 *xmin, REAL8 *xmax, void *params)
void LALDBisectionFindRoot(LALStatus *status, REAL8 *root, DFindRootIn *input, void *params)
#define FINDROOTH_EMXIT
Maximum iterations exceeded.
void LALSBisectionFindRoot(LALStatus *status, REAL4 *root, SFindRootIn *input, void *params)
#define LAL_SQRT2
Pythagoras's constant, sqrt(2)
double REAL8
Double precision real floating-point number (8 bytes).
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
#define XLAL_ERROR_REAL8(...)
Macro to invoke a failure from a XLAL routine returning a REAL8.
#define XLAL_ERROR(...)
Macro to invoke a failure from a XLAL routine returning an integer.
static _LAL_INLINE_ int XLALIsREAL8FailNaN(REAL8 val)
Tests if a value is an XLAL REAL8 failure NaN.
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
@ XLAL_EMAXITER
Exceeded maximum number of iterations.
@ XLAL_EDOM
Input domain error.
@ XLAL_EFAILED
Generic failure.
These are function pointers to functions that map REAL8 numbers to REAL8 numbers.
REAL8 xacc
The accuracy desired for the root.
REAL8 xmax
The maximum value of the domain interval to look for the root.
void(* function)(LALStatus *s, REAL8 *y, REAL8 x, void *p)
The function to find the root of.
REAL8 xmin
The minimum value of the domain interval to look for the root.
LAL status structure, see The LALStatus structure for more details.
These are function pointers to functions that map REAL4 numbers to REAL4 numbers.
REAL4 xacc
The accuracy desired for the root.
REAL4 xmax
The maximum value of the domain interval to look for the root.
REAL4 xmin
The minimum value of the domain interval to look for the root.
void(* function)(LALStatus *s, REAL4 *y, REAL4 x, void *p)
The function to find the root of.