38 gsl_rng(
const gsl_rng* rng) {
40 return gsl_rng_clone(rng);
46 gsl_rng(
const char*
name,
unsigned long int seed) {
49 const gsl_rng_type* T = NULL;
50 if (strcmp(
name,
"default") == 0) {
53 const gsl_rng_type **types = gsl_rng_types_setup();
54 for (
const gsl_rng_type **t = types; *t != NULL; ++t) {
55 if (strcmp(
name, (*t)->name) == 0) {
62 gsl_rng* rng = gsl_rng_alloc(T);
63 gsl_rng_set(rng, seed);
71 %swiglal_struct_call_dtor(gsl_rng_free, $self);
81 unsigned long int uniform_int(
unsigned long int n);
82 void set_seed(
unsigned long int seed) {
83 gsl_rng_set($self, seed);
85 unsigned long int get_value() {
86 return gsl_rng_get($self);
88 unsigned long int max_value() {
89 return gsl_rng_max($self);
91 unsigned long int min_value() {
92 return gsl_rng_min($self);
106%extend tagLIGOTimeGPS {
110 tagLIGOTimeGPS(
REAL8 t) {
117 tagLIGOTimeGPS(
INT4 gpssec) {
120 tagLIGOTimeGPS(
INT4 gpssec,
INT8 gpsnan) {
127 tagLIGOTimeGPS(
const char *str) {
172 return $self->gpsSeconds || $self->gpsNanoSeconds;
179 return $self->gpsSeconds;
182 return $self->gpsSeconds;
199 %typemap(newfree)
char* __str__
"XLALFree($1);";
204 %typemap(newfree)
char* __repr__
"XLALFree($1);";
206 return XLALStringAppendFmt(NULL,
"LIGOTimeGPS(%d, %d)", $self->gpsSeconds, $self->gpsNanoSeconds);
209 %typemap(newfree)
char* asutcstr
"XLALFree($1);";
213 XLALGPSSet(&gps, $self->gpsSeconds, $self->gpsNanoSeconds);
220 char datebuf[256] = {0};
221 const size_t datelen = strftime(datebuf,
sizeof(datebuf),
"%a, %d %b %Y %H:%M:%S", &utc);
224 char nsbuf[256] = {0};
226 const int nslen = snprintf(nsbuf,
sizeof(nsbuf),
".%09ld", (
long) gps.
gpsNanoSeconds);
229 char *
end = nsbuf + nslen;
230 while (*(--
end) ==
'0') {
241 long hash = (long)$self->gpsSeconds ^ (
long)$self->gpsNanoSeconds;
282 %typemap(in, noblock=1, fragment=SWIG_AsVal_frag(
double))
struct tagLIGOTimeGPS* self (
LIGOTimeGPS tmp,
void *argp = 0,
int res = 0,
int self_set = 0,
int factor_set = 0) {
283 res = SWIG_ConvertPtr($input, &argp, $descriptor, $disown | %convertptr_flags);
284 if (SWIG_IsOK(res)) {
285 arg1 = %reinterpret_cast(argp, $ltype);
288 res = SWIG_AsVal(
double)($input, &arg2);
289 if (SWIG_IsOK(res)) {
292 res = swiglal_specialised_tagLIGOTimeGPS($input, &tmp);
293 if (SWIG_IsOK(res)) {
297 %argument_fail(res,
"$type", $symname, $argnum);
302 %typemap(in, noblock=1, fragment=SWIG_AsVal_frag(
double))
double factor (
LIGOTimeGPS tmp,
void *argp = 0,
int res = 0) {
304 res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_tagLIGOTimeGPS, $disown | %convertptr_flags);
305 if (SWIG_IsOK(res)) {
311 res = SWIG_AsVal(
double)($input, &arg2);
312 if (SWIG_IsOK(res)) {
315 res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_tagLIGOTimeGPS, $disown | %convertptr_flags);
316 if (SWIG_IsOK(res)) {
320 res = swiglal_specialised_tagLIGOTimeGPS($input, &tmp);
321 if (SWIG_IsOK(res)) {
328 if (!self_set1 || !factor_set1) {
329 %argument_fail(res,
"$type", $symname, $argnum);
340 %clear
struct tagLIGOTimeGPS* self;
341 %clear
double factor;
388 %define %swiglal_LIGOTimeGPS_comparison_operator(NAME, OP)
389 bool __##NAME##__(
LIGOTimeGPS *gps,
int SWIGLAL_CMP_OP_RETN_HACK) {
393 %swiglal_LIGOTimeGPS_comparison_operator(
lt, < );
394 %swiglal_LIGOTimeGPS_comparison_operator(le, <=);
395 %swiglal_LIGOTimeGPS_comparison_operator(eq, ==);
396 %swiglal_LIGOTimeGPS_comparison_operator(ne, !=);
397 %swiglal_LIGOTimeGPS_comparison_operator(gt, > );
398 %swiglal_LIGOTimeGPS_comparison_operator(ge, >=);
421 tagLALUnit(
const char* str) {
462 %typemap(newfree)
char* __str__
"XLALFree($1);";
469 %typemap(newfree)
char* __repr__
"XLALFree($1);";
480 long hash = (long)$self->powerOfTen;
482 hash ^= (long)$self->unitNumerator;
483 hash ^= (
long)$self->unitDenominatorMinusOne;
491 LALUnit* __pow__(
INT2 n,
void* SWIGLAL_OP_POW_3RDARG) {
499 LALUnit* __pow__(
INT2 r[2],
void* SWIGLAL_OP_POW_3RDARG) {
538 bool __eq__(
LALUnit* unit,
int SWIGLAL_CMP_OP_RETN_HACK) {
541 bool __ne__(
LALUnit* unit,
int SWIGLAL_CMP_OP_RETN_HACK) {
#define XLAL_BILLION_INT4
int XLALStrToGPS(LIGOTimeGPS *t, const char *nptr, char **endptr)
Parse an ASCII string into a LIGOTimeGPS structure.
static size_t hash(const char *s)
char * XLALStringAppendFmt(char *s, const char *fmt,...)
Append the formatted string 'fmt' to the string 's', which is reallocated with XLALRealloc() to the r...
static _LAL_INLINE_ int lt(void *params, const void *a, const void *b, int(*compar)(void *, const void *, const void *))
char * XLALGPSToStr(char *, const LIGOTimeGPS *t)
Return a string containing the ASCII base 10 representation of a LIGOTimeGPS.
double REAL8
Double precision real floating-point number (8 bytes).
int16_t INT2
Two-byte signed integer.
int64_t INT8
Eight-byte signed integer; on some platforms this is equivalent to long int instead.
int32_t INT4
Four-byte signed integer.
@ LALNumUnits
The number of units.
int XLALUnitIsDimensionless(const LALUnit *unit)
Return 1 if a unit is dimensionless, 0 otherwise.
int XLALUnitCompare(const LALUnit *unit1, const LALUnit *unit2)
Returns 0 if the the normal form of the two unit structures are the same or > 0 if they are different...
REAL8 XLALUnitPrefactor(const LALUnit *unit)
Return the unit's prefactor.
LALUnit * XLALParseUnitString(LALUnit *output, const char *string)
Returns the pointer output upon return or a pointer to newly allocated memory if output was NULL; on ...
char * XLALUnitToString(const LALUnit *input)
Allocates and returns a new string, which is populated with the unit string.
LALUnit * XLALUnitDivide(LALUnit *output, const LALUnit *unit1, const LALUnit *unit2)
UNDOCUMENTED.
LALUnit * XLALUnitMultiply(LALUnit *output, const LALUnit *unit1, const LALUnit *unit2)
This function multiplies together the LALUnit structures *(input->unitOne) and *(input->unitTwo),...
int XLALUnitNormalize(LALUnit *unit)
Returns 0 upon success or XLAL_FAILURE if the input pointer is NULL, in which case xlalErrno is set t...
LALUnit * XLALUnitRaiseRAT4(LALUnit *output, const LALUnit *input, const RAT4 *power)
Raises a LALUnit structure to a rational power given by the RAT4 structure power.
LALUnit * XLALUnitRaiseINT2(LALUnit *output, const LALUnit *input, INT2 power)
Raises a LALUnit structure to an integer power power.
struct tm * XLALGPSToUTC(struct tm *utc, INT4 gpssec)
Returns a pointer to a tm structure representing the time specified in seconds since the GPS epoch.
#define XLAL_ERROR_NULL(...)
Macro to invoke a failure from a XLAL routine returning a pointer.
int XLALSetErrno(int errnum)
Sets the XLAL error number to errnum, returns the new value.
#define XLAL_CHECK_NULL(assertion,...)
Macro to test an assertion and invoke a failure if it is not true in a function that returns a pointe...
@ XLAL_SUCCESS
Success return value (not an error number)
@ XLAL_EFAULT
Invalid pointer.
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
@ XLAL_EDOM
Input domain error.
@ XLAL_EINVAL
Invalid argument.
LIGOTimeGPS * XLALGPSDivide(LIGOTimeGPS *gps, REAL8 x)
Divide a GPS time by a number.
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)
Sets GPS time given GPS seconds as a REAL8.
LIGOTimeGPS * XLALGPSSet(LIGOTimeGPS *epoch, INT4 gpssec, INT8 gpsnan)
Sets GPS time given GPS integer seconds and residual nanoseconds.
LIGOTimeGPS * XLALGPSSubGPS(LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
Difference between two GPS times.
int XLALGPSCmp(const LIGOTimeGPS *t0, const LIGOTimeGPS *t1)
Compares two GPS times.
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
Returns the GPS time as a REAL8.
LIGOTimeGPS * XLALGPSAddGPS(LIGOTimeGPS *epoch, const LIGOTimeGPS *dt)
Adds two GPS times.
LIGOTimeGPS * XLALGPSMultiply(LIGOTimeGPS *gps, REAL8 x)
Multiply a GPS time by a number.
LIGOTimeGPS * XLALINT8NSToGPS(LIGOTimeGPS *epoch, INT8 ns)
Converts nano seconds stored as an INT8 to GPS time.
INT8 XLALGPSToINT8NS(const LIGOTimeGPS *epoch)
Converts GPS time to nano seconds stored as an INT8.
This structure stores units in the mksA system (plus Kelvin, Strain, and ADC Count).
Epoch relative to GPS epoch, see LIGOTimeGPS type for more details.
INT4 gpsSeconds
Seconds since 0h UTC 6 Jan 1980.
INT4 gpsNanoSeconds
Residual nanoseconds.
A four-byte rational number, used as a parameter structure for XLALUnitRaiseRAT4().
INT2 numerator
The numerator.
UINT2 denominatorMinusOne
One less than the denominator.