LAL  7.5.0.1-08ee4f4

Detailed Description

Brings an LALUnit structure into standard form by reducing all of the rational exponents into LCD form.

Author
J. T. Whelan john..nosp@m.whel.nosp@m.an@li.nosp@m.go.o.nosp@m.rg

Since the LALUnit structure stores the rational powers of the fundamental units as numerator and denominator, it is possible to represent the same units in different ways, e.g., \(\mathrm{m}^2\) versus \(\mathrm{m}^{4/2}\). This function reduces all of those fractions to convert the structure to its simplest form.

Algorithm

The rational powers are reduced using Euclid's algorithm [12] .

Notes

Note that the functions XLALUnitRaiseRAT4(), XLALUnitMultiply(), and XLALUnitCompare() all call XLALUnitNormalize() themselves, so there is usually no need to call it explicitly.

Prototypes

static UINT2 gcd (INT2 numer, UINT2 denom)
 
int XLALUnitNormalize (LALUnit *unit)
 Returns 0 upon success or XLAL_FAILURE if the input pointer is NULL, in which case xlalErrno is set to XLAL_EFAULT. More...
 

Function Documentation

◆ gcd()

static UINT2 gcd ( INT2  numer,
UINT2  denom 
)
static

Definition at line 54 of file UnitNormalize.c.

◆ XLALUnitNormalize()

int XLALUnitNormalize ( LALUnit unit)

Returns 0 upon success or XLAL_FAILURE if the input pointer is NULL, in which case xlalErrno is set to XLAL_EFAULT.

Definition at line 72 of file UnitNormalize.c.