LAL 7.6.1.1-4859cae

Detailed Description

Function to compare two LALUnit structures.

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

Prototypes

int XLALUnitIsDimensionless (const LALUnit *unit)
 Return 1 if a unit is dimensionless, 0 otherwise. More...
 
REAL8 XLALUnitPrefactor (const LALUnit *unit)
 Return the unit's prefactor. More...
 
REAL8 XLALUnitRatio (const LALUnit *unit1, const LALUnit *unit2)
 Return the ratio unit1 / unit2. More...
 
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. More...
 
char * XLALUnitAsString (char *string, UINT4 length, const LALUnit *input)
 Returns the pointer to the input string, which is populated with the unit string if successful. More...
 
char * XLALUnitToString (const LALUnit *input)
 Allocates and returns a new string, which is populated with the unit string. More...
 
LALUnitXLALParseUnitString (LALUnit *output, const char *string)
 Returns the pointer output upon return or a pointer to newly allocated memory if output was NULL; on failure, XLALParseUnitString() returns NULL and sets xlalErrno to one of the following values: XLAL_ENOMEM if the routine was unable to allocate memory for the output or XLAL_EFAILED if the routine was unable to parse the unit string. More...
 
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...
 
LALUnitXLALUnitMultiply (LALUnit *output, const LALUnit *unit1, const LALUnit *unit2)
 This function multiplies together the LALUnit structures *(input->unitOne) and *(input->unitTwo), thus allowing a module to eg, multiply two REAL8TimeSeries and give the resulting REAL8TimeSeries the correct units. More...
 
LALUnitXLALUnitDivide (LALUnit *output, const LALUnit *unit1, const LALUnit *unit2)
 UNDOCUMENTED. More...
 
LALUnitXLALUnitRaiseRAT4 (LALUnit *output, const LALUnit *input, const RAT4 *power)
 Raises a LALUnit structure to a rational power given by the RAT4 structure power. More...
 
LALUnitXLALUnitRaiseINT2 (LALUnit *output, const LALUnit *input, INT2 power)
 Raises a LALUnit structure to an integer power power. More...
 
LALUnitXLALUnitSquare (LALUnit *output, const LALUnit *input)
 Produces the square of a LALUnit structure. More...
 
LALUnitXLALUnitSqrt (LALUnit *output, const LALUnit *input)
 Produces the square-root of a LALUnit structure. More...
 
LALUnitXLALUnitInvert (LALUnit *output, const LALUnit *input)
 UNDOCUMENTED. More...
 

Data Structures

struct  RAT4
 A four-byte rational number, used as a parameter structure for XLALUnitRaiseRAT4(). More...
 

Enumerations

enum  enumLALUnitNameSize { LALUnitNameSize = sizeof("strain") }
 
enum  enumLALUnitTextSize { LALUnitTextSize }
 

Variables

const CHAR lalUnitName [LALNumUnits][LALUnitNameSize]
 To convert a units structure to a string repesentation, we need to define the names of the basic units. More...
 
const LALUnit lalDimensionlessUnit
 dimensionless units More...
 
const LALUnit lalMeterUnit
 meter [m] More...
 
const LALUnit lalKiloGramUnit
 kilogram [kg] More...
 
const LALUnit lalSecondUnit
 second [s] More...
 
const LALUnit lalAmpereUnit
 Ampere [A]. More...
 
const LALUnit lalKelvinUnit
 Kelvin [K]. More...
 
const LALUnit lalStrainUnit
 Strain [1]. More...
 
const LALUnit lalADCCountUnit
 ADC count [count]. More...
 
const LALUnit lalHertzUnit
 Hertz [Hz]. More...
 
const LALUnit lalNewtonUnit
 Newton [N]. More...
 
const LALUnit lalJouleUnit
 Joule [J]. More...
 
const LALUnit lalWattUnit
 Watt [W ]. More...
 
const LALUnit lalPascalUnit
 Pascal [Pa]. More...
 
const LALUnit lalCoulombUnit
 Coulomb [C]. More...
 
const LALUnit lalVoltUnit
 Volt [V]. More...
 
const LALUnit lalOhmUnit
 Ohm [ \(\Omega\)]. More...
 
const LALUnit lalFaradUnit
 Farad [F]. More...
 
const LALUnit lalWeberUnit
 Weber [Wb]. More...
 
const LALUnit lalTeslaUnit
 Tesla [T]. More...
 
const LALUnit lalHenryUnit
 Henry [H]. More...
 
const LALUnit lalYottaUnit
 Yotta [1e24]. More...
 
const LALUnit lalZettaUnit
 Zetta [1e21]. More...
 
const LALUnit lalExaUnit
 Exa [1e18]. More...
 
const LALUnit lalPetaUnit
 Peta [1e15]. More...
 
const LALUnit lalTeraUnit
 Tera [1e12]. More...
 
const LALUnit lalGigaUnit
 Giga [1e9]. More...
 
const LALUnit lalMegaUnit
 Mega [1e6]. More...
 
const LALUnit lalKiloUnit
 Kilo [1e3]. More...
 
const LALUnit lalHectoUnit
 Hecto [1e2]. More...
 
const LALUnit lalDekaUnit
 Deka [1e1]. More...
 
const LALUnit lalDeciUnit
 Deci [1e-1]. More...
 
const LALUnit lalCentiUnit
 Centi [1e-2]. More...
 
const LALUnit lalMilliUnit
 Milli [1e-3]. More...
 
const LALUnit lalMicroUnit
 Micro [1e-6]. More...
 
const LALUnit lalNanoUnit
 Nano [1e-9]. More...
 
const LALUnit lalPicoUnit
 Pico [1e-12]. More...
 
const LALUnit lalFemtoUnit
 Femto [1e-15]. More...
 
const LALUnit lalAttoUnit
 Atto [1e-18]. More...
 
const LALUnit lalZeptoUnit
 Zepto [1e-21]. More...
 
const LALUnit lalYoctoUnit
 Yocto [1e-24]. More...
 
const LALUnit lalGramUnit
 Gram [1e-3]. More...
 
const LALUnit lalAttoStrainUnit
 AttoStrain [1e-18]. More...
 
const LALUnit lalPicoFaradUnit
 PicoFarad [1e-12 F]. More...
 

Function Documentation

◆ XLALUnitIsDimensionless()

int XLALUnitIsDimensionless ( const LALUnit unit)

Return 1 if a unit is dimensionless, 0 otherwise.

Definition at line 36 of file UnitCompare.c.

◆ XLALUnitPrefactor()

REAL8 XLALUnitPrefactor ( const LALUnit unit)

Return the unit's prefactor.

Definition at line 51 of file UnitCompare.c.

◆ XLALUnitRatio()

REAL8 XLALUnitRatio ( const LALUnit unit1,
const LALUnit unit2 
)

Return the ratio unit1 / unit2.

Definition at line 62 of file UnitCompare.c.

◆ XLALUnitCompare()

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.

It returns XLAL_FAILURE and xlalErrno is set to XLAL_EFAULT if one of the input pointers is NULL.

Example:

if(XLALUnitCompare(&unit1, &unit2)) {
units_are_not_equal();
}
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...
Definition: UnitCompare.c:90

Definition at line 90 of file UnitCompare.c.

◆ XLALUnitAsString()

char * XLALUnitAsString ( char *  string,
UINT4  length,
const LALUnit input 
)

Returns the pointer to the input string, which is populated with the unit string if successful.

If there is a failure, XLALUnitAsString() returns a NULL pointer and xlalErrno is set to one of the following values: XLAL_EFAULT if one of the input pointers is NULL or XLAL_EBADLEN if the length of the string is insufficent for the unit string.

Definition at line 276 of file UnitDefs.c.

◆ XLALUnitToString()

char * XLALUnitToString ( const LALUnit input)

Allocates and returns a new string, which is populated with the unit string.

If there is a failure, returns a NULL pointer and xlalErrno is set to one of the error values of XLALUnitAsString or XLALMalloc. Caller is responsible for freeing return value with XLALFree.

Definition at line 332 of file UnitDefs.c.

◆ XLALParseUnitString()

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 failure, XLALParseUnitString() returns NULL and sets xlalErrno to one of the following values: XLAL_ENOMEM if the routine was unable to allocate memory for the output or XLAL_EFAILED if the routine was unable to parse the unit string.

Definition at line 354 of file UnitDefs.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.

◆ XLALUnitMultiply()

LALUnit * XLALUnitMultiply ( LALUnit output,
const LALUnit unit1,
const LALUnit unit2 
)

This function multiplies together the LALUnit structures *(input->unitOne) and *(input->unitTwo), thus allowing a module to eg, multiply two REAL8TimeSeries and give the resulting REAL8TimeSeries the correct units.

Uses

XLALUnitNormalize()

Definition at line 64 of file UnitMultiply.c.

◆ XLALUnitDivide()

LALUnit * XLALUnitDivide ( LALUnit output,
const LALUnit unit1,
const LALUnit unit2 
)

UNDOCUMENTED.

Definition at line 108 of file UnitMultiply.c.

◆ XLALUnitRaiseRAT4()

LALUnit * XLALUnitRaiseRAT4 ( LALUnit output,
const LALUnit input,
const RAT4 power 
)

Raises a LALUnit structure to a rational power given by the RAT4 structure power.

Definition at line 56 of file UnitRaise.c.

◆ XLALUnitRaiseINT2()

LALUnit * XLALUnitRaiseINT2 ( LALUnit output,
const LALUnit input,
INT2  power 
)

Raises a LALUnit structure to an integer power power.

Definition at line 106 of file UnitRaise.c.

◆ XLALUnitSquare()

LALUnit * XLALUnitSquare ( LALUnit output,
const LALUnit input 
)

Produces the square of a LALUnit structure.

Definition at line 120 of file UnitRaise.c.

◆ XLALUnitSqrt()

LALUnit * XLALUnitSqrt ( LALUnit output,
const LALUnit input 
)

Produces the square-root of a LALUnit structure.

Definition at line 133 of file UnitRaise.c.

◆ XLALUnitInvert()

LALUnit * XLALUnitInvert ( LALUnit output,
const LALUnit input 
)

UNDOCUMENTED.

Definition at line 144 of file UnitRaise.c.

Enumeration Type Documentation

◆ enumLALUnitNameSize

Enumerator
LALUnitNameSize 

Definition at line 170 of file Units.h.

◆ enumLALUnitTextSize

Enumerator
LALUnitTextSize 

Definition at line 173 of file Units.h.

Variable Documentation

◆ lalUnitName

const CHAR lalUnitName[LALNumUnits][LALUnitNameSize]
extern

To convert a units structure to a string repesentation, we need to define the names of the basic units.

Definition at line 135 of file UnitDefs.c.

◆ lalDimensionlessUnit

const LALUnit lalDimensionlessUnit
extern

dimensionless units

Definition at line 156 of file UnitDefs.c.

◆ lalMeterUnit

const LALUnit lalMeterUnit
extern

meter [m]

Definition at line 160 of file UnitDefs.c.

◆ lalKiloGramUnit

const LALUnit lalKiloGramUnit
extern

kilogram [kg]

Definition at line 161 of file UnitDefs.c.

◆ lalSecondUnit

const LALUnit lalSecondUnit
extern

second [s]

Definition at line 162 of file UnitDefs.c.

◆ lalAmpereUnit

const LALUnit lalAmpereUnit
extern

Ampere [A].

Definition at line 163 of file UnitDefs.c.

◆ lalKelvinUnit

const LALUnit lalKelvinUnit
extern

Kelvin [K].

Definition at line 164 of file UnitDefs.c.

◆ lalStrainUnit

const LALUnit lalStrainUnit
extern

Strain [1].

Definition at line 165 of file UnitDefs.c.

◆ lalADCCountUnit

const LALUnit lalADCCountUnit
extern

ADC count [count].

Definition at line 166 of file UnitDefs.c.

◆ lalHertzUnit

const LALUnit lalHertzUnit
extern

Hertz [Hz].

Definition at line 171 of file UnitDefs.c.

◆ lalNewtonUnit

const LALUnit lalNewtonUnit
extern

Newton [N].

Definition at line 172 of file UnitDefs.c.

◆ lalJouleUnit

const LALUnit lalJouleUnit
extern

Joule [J].

Definition at line 174 of file UnitDefs.c.

◆ lalWattUnit

const LALUnit lalWattUnit
extern

Watt [W ].

Definition at line 175 of file UnitDefs.c.

◆ lalPascalUnit

const LALUnit lalPascalUnit
extern

Pascal [Pa].

Definition at line 173 of file UnitDefs.c.

◆ lalCoulombUnit

const LALUnit lalCoulombUnit
extern

Coulomb [C].

Definition at line 180 of file UnitDefs.c.

◆ lalVoltUnit

const LALUnit lalVoltUnit
extern

Volt [V].

Definition at line 181 of file UnitDefs.c.

◆ lalOhmUnit

const LALUnit lalOhmUnit
extern

Ohm [ \(\Omega\)].

Definition at line 182 of file UnitDefs.c.

◆ lalFaradUnit

const LALUnit lalFaradUnit
extern

Farad [F].

Definition at line 183 of file UnitDefs.c.

◆ lalWeberUnit

const LALUnit lalWeberUnit
extern

Weber [Wb].

Definition at line 184 of file UnitDefs.c.

◆ lalTeslaUnit

const LALUnit lalTeslaUnit
extern

Tesla [T].

Definition at line 186 of file UnitDefs.c.

◆ lalHenryUnit

const LALUnit lalHenryUnit
extern

Henry [H].

Definition at line 185 of file UnitDefs.c.

◆ lalYottaUnit

const LALUnit lalYottaUnit
extern

Yotta [1e24].

Definition at line 191 of file UnitDefs.c.

◆ lalZettaUnit

const LALUnit lalZettaUnit
extern

Zetta [1e21].

Definition at line 192 of file UnitDefs.c.

◆ lalExaUnit

const LALUnit lalExaUnit
extern

Exa [1e18].

Definition at line 193 of file UnitDefs.c.

◆ lalPetaUnit

const LALUnit lalPetaUnit
extern

Peta [1e15].

Definition at line 194 of file UnitDefs.c.

◆ lalTeraUnit

const LALUnit lalTeraUnit
extern

Tera [1e12].

Definition at line 195 of file UnitDefs.c.

◆ lalGigaUnit

const LALUnit lalGigaUnit
extern

Giga [1e9].

Definition at line 196 of file UnitDefs.c.

◆ lalMegaUnit

const LALUnit lalMegaUnit
extern

Mega [1e6].

Definition at line 197 of file UnitDefs.c.

◆ lalKiloUnit

const LALUnit lalKiloUnit
extern

Kilo [1e3].

Definition at line 198 of file UnitDefs.c.

◆ lalHectoUnit

const LALUnit lalHectoUnit
extern

Hecto [1e2].

Definition at line 199 of file UnitDefs.c.

◆ lalDekaUnit

const LALUnit lalDekaUnit
extern

Deka [1e1].

Definition at line 200 of file UnitDefs.c.

◆ lalDeciUnit

const LALUnit lalDeciUnit
extern

Deci [1e-1].

Definition at line 201 of file UnitDefs.c.

◆ lalCentiUnit

const LALUnit lalCentiUnit
extern

Centi [1e-2].

Definition at line 202 of file UnitDefs.c.

◆ lalMilliUnit

const LALUnit lalMilliUnit
extern

Milli [1e-3].

Definition at line 203 of file UnitDefs.c.

◆ lalMicroUnit

const LALUnit lalMicroUnit
extern

Micro [1e-6].

Definition at line 204 of file UnitDefs.c.

◆ lalNanoUnit

const LALUnit lalNanoUnit
extern

Nano [1e-9].

Definition at line 205 of file UnitDefs.c.

◆ lalPicoUnit

const LALUnit lalPicoUnit
extern

Pico [1e-12].

Definition at line 206 of file UnitDefs.c.

◆ lalFemtoUnit

const LALUnit lalFemtoUnit
extern

Femto [1e-15].

Definition at line 207 of file UnitDefs.c.

◆ lalAttoUnit

const LALUnit lalAttoUnit
extern

Atto [1e-18].

Definition at line 208 of file UnitDefs.c.

◆ lalZeptoUnit

const LALUnit lalZeptoUnit
extern

Zepto [1e-21].

Definition at line 209 of file UnitDefs.c.

◆ lalYoctoUnit

const LALUnit lalYoctoUnit
extern

Yocto [1e-24].

Definition at line 210 of file UnitDefs.c.

◆ lalGramUnit

const LALUnit lalGramUnit
extern

Gram [1e-3].

Definition at line 215 of file UnitDefs.c.

◆ lalAttoStrainUnit

const LALUnit lalAttoStrainUnit
extern

AttoStrain [1e-18].

Definition at line 216 of file UnitDefs.c.

◆ lalPicoFaradUnit

const LALUnit lalPicoFaradUnit
extern

PicoFarad [1e-12 F].

Definition at line 217 of file UnitDefs.c.