LAL  7.5.0.1-b72065a

Detailed Description

Functions for performing fast math on vectors of numbers, using SIMD (SSE, AVX, ...) instructions if available.

Author
Reinhard Prix, Karl Wette

Synopsis

#include <lal/VectorMath.h>

Alignment

Neither input nor output vectors are required to have any particular memory alignment. Nevertheless, performance may be improved if vectors are 16-byte aligned for SSE, and 32-byte aligned for AVX.

Data Structures

struct  UINT4VectorAligned
 A special UINT4Vector with n-byte aligned memory data array. More...
 
struct  REAL4VectorAligned
 A special REAL4Vector with n-byte aligned memory data array. More...
 
struct  REAL8VectorAligned
 A special REAL8Vector with n-byte aligned memory data array. More...
 
struct  COMPLEX8VectorAligned
 A special COMPLEX8Vector with n-byte aligned memory data array. More...
 
struct  COMPLEX16VectorAligned
 A special COMPLEX16Vector with n-byte aligned memory data array. More...
 

Failsafe Aligned Memory Handling

UINT4VectorAlignedXLALCreateUINT4VectorAligned (const UINT4 length, const UINT4 align)
 Create a new UINT4VectorAligned struct with length length and alignment align. More...
 
UINT4VectorAlignedXLALResizeUINT4VectorAligned (UINT4VectorAligned *in, const UINT4 length, const UINT4 align)
 Resize an existing UINT4VectorAligned struct to length length and alignment align. More...
 
void XLALDestroyUINT4VectorAligned (UINT4VectorAligned *in)
 Free a UINT4VectorAligned struct. More...
 
REAL4VectorAlignedXLALCreateREAL4VectorAligned (const UINT4 length, const UINT4 align)
 Create a new REAL4VectorAligned struct with length length and alignment align. More...
 
REAL4VectorAlignedXLALResizeREAL4VectorAligned (REAL4VectorAligned *in, const UINT4 length, const UINT4 align)
 Resize an existing REAL4VectorAligned struct to length length and alignment align. More...
 
void XLALDestroyREAL4VectorAligned (REAL4VectorAligned *in)
 Free a REAL4VectorAligned struct. More...
 
REAL8VectorAlignedXLALCreateREAL8VectorAligned (const UINT4 length, const UINT4 align)
 Create a new REAL8VectorAligned struct with length length and alignment align. More...
 
REAL8VectorAlignedXLALResizeREAL8VectorAligned (REAL8VectorAligned *in, const UINT4 length, const UINT4 align)
 Resize an existing REAL8VectorAligned struct to length length and alignment align. More...
 
void XLALDestroyREAL8VectorAligned (REAL8VectorAligned *in)
 Free a REAL8VectorAligned struct. More...
 
COMPLEX8VectorAlignedXLALCreateCOMPLEX8VectorAligned (const UINT4 length, const UINT4 align)
 Create a new COMPLEX8VectorAligned struct with length length and alignment align. More...
 
COMPLEX8VectorAlignedXLALResizeCOMPLEX8VectorAligned (COMPLEX8VectorAligned *in, const UINT4 length, const UINT4 align)
 Resize an existing COMPLEX8VectorAligned struct to length length and alignment align. More...
 
void XLALDestroyCOMPLEX8VectorAligned (COMPLEX8VectorAligned *in)
 Free a COMPLEX8VectorAligned struct. More...
 
COMPLEX16VectorAlignedXLALCreateCOMPLEX16VectorAligned (const UINT4 length, const UINT4 align)
 Create a new COMPLEX16VectorAligned struct with length length and alignment align. More...
 
COMPLEX16VectorAlignedXLALResizeCOMPLEX16VectorAligned (COMPLEX16VectorAligned *in, const UINT4 length, const UINT4 align)
 Resize an existing COMPLEX16VectorAligned struct to length length and alignment align. More...
 
void XLALDestroyCOMPLEX16VectorAligned (COMPLEX16VectorAligned *in)
 Free a COMPLEX16VectorAligned struct. More...
 

Vector Math Functions

int XLALVectorINT4FromREAL4 (INT4 *out, const REAL4 *in, const UINT4 len)
 Cast (i.e. More...
 
int XLALVectorSinREAL4 (REAL4 *out, const REAL4 *in, const UINT4 len)
 Compute \(\text{out} = \sin(\text{in})\) over REAL4 vectors out, in with len elements. More...
 
int XLALVectorCosREAL4 (REAL4 *out, const REAL4 *in, const UINT4 len)
 Compute \(\text{out} = \cos(\text{in})\) over REAL4 vectors out, in with len elements. More...
 
int XLALVectorExpREAL4 (REAL4 *out, const REAL4 *in, const UINT4 len)
 Compute \(\text{out} = \exp(\text{in})\) over REAL4 vectors out, in with len elements. More...
 
int XLALVectorLogREAL4 (REAL4 *out, const REAL4 *in, const UINT4 len)
 Compute \(\text{out} = \log(\text{in})\) over REAL4 vectors out, in with len elements. More...
 
int XLALVectorRoundREAL4 (REAL4 *out, const REAL4 *in, const UINT4 len)
 Compute \(\text{out} = round ( \text{in} )\) over REAL4 vectors out, in with len elements. More...
 
int XLALVectorRoundREAL8 (REAL8 *out, const REAL8 *in, const UINT4 len)
 Compute \(\text{out} = round ( \text{in} )\) over REAL8 vectors out, in with len elements. More...
 
int XLALVectorSinCosREAL4 (REAL4 *out1, REAL4 *out2, const REAL4 *in, const UINT4 len)
 Compute \(\text{out1} = \sin(\text{in}), \text{out2} = \cos(\text{in})\) over REAL4 vectors out1, out2, in with len elements. More...
 
int XLALVectorSinCos2PiREAL4 (REAL4 *out1, REAL4 *out2, const REAL4 *in, const UINT4 len)
 Compute \(\text{out1} = \sin(2\pi \text{in}), \text{out2} = \cos(2\pi \text{in})\) over REAL4 vectors out1, out2, in with len elements. More...
 

Vector by Vector Operations

int XLALVectorAddREAL4 (REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} + \text{in2}\) over REAL4 vectors in1 and in2 with len elements. More...
 
int XLALVectorSubREAL4 (REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} - \text{in2}\) over REAL4 vectors in1 and in2 with len elements. More...
 
int XLALVectorMultiplyREAL4 (REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} \times \text{in2}\) over REAL4 vectors in1 and in2 with len elements. More...
 
int XLALVectorMaxREAL4 (REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
 Compute \(\text{out} = max ( \text{in1}, \text{in2} )\) over REAL4 vectors in1 and in2 with len elements. More...
 
int XLALVectorAddREAL8 (REAL8 *out, const REAL8 *in1, const REAL8 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} + \text{in2}\) over REAL8 vectors in1 and in2 with len elements. More...
 
int XLALVectorSubREAL8 (REAL8 *out, const REAL8 *in1, const REAL8 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} - \text{in2}\) over REAL8 vectors in1 and in2 with len elements. More...
 
int XLALVectorMultiplyREAL8 (REAL8 *out, const REAL8 *in1, const REAL8 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} \times \text{in2}\) over REAL8 vectors in1 and in2 with len elements. More...
 
int XLALVectorMaxREAL8 (REAL8 *out, const REAL8 *in1, const REAL8 *in2, const UINT4 len)
 Compute \(\text{out} = max ( \text{in1}, \text{in2} )\) over REAL8 vectors in1 and in2 with len elements. More...
 
int XLALVectorMultiplyCOMPLEX8 (COMPLEX8 *out, const COMPLEX8 *in1, const COMPLEX8 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} \times \text{in2}\) over COMPLEX8 vectors in1 and in2 with len elements. More...
 
int XLALVectorAddCOMPLEX8 (COMPLEX8 *out, const COMPLEX8 *in1, const COMPLEX8 *in2, const UINT4 len)
 Compute \(\text{out} = \text{in1} + \text{in2}\) over COMPLEX8 vectors in1 and in2 with len elements. More...
 

Vector by Scalar Operations

int XLALVectorShiftREAL4 (REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len)
 Compute \(\text{out} = \text{scalar} + \text{in}\) over REAL4 vector in with len elements. More...
 
int XLALVectorScaleREAL4 (REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len)
 Compute \(\text{out} = \text{scalar} \times \text{in}\) over REAL4 vector in with len elements. More...
 
int XLALVectorScaleREAL8 (REAL8 *out, REAL8 scalar, const REAL8 *in, const UINT4 len)
 Compute \(\text{out} = \text{scalar} \times \text{in}\) over REAL8 vector in with len elements. More...
 
int XLALVectorShiftREAL8 (REAL8 *out, REAL8 scalar, const REAL8 *in, const UINT4 len)
 Compute \(\text{out} = \text{scalar} + \text{in}\) over REAL8 vector in with len elements. More...
 
int XLALVectorScaleCOMPLEX8 (COMPLEX8 *out, COMPLEX8 scalar, const COMPLEX8 *in, const UINT4 len)
 Compute \(\text{out} = \text{scalar} \times \text{in}\) over COMPLEX8 vector in with len elements. More...
 
int XLALVectorShiftCOMPLEX8 (COMPLEX8 *out, COMPLEX8 scalar, const COMPLEX8 *in, const UINT4 len)
 Compute \(\text{out} = \text{scalar} + \text{in}\) over COMPLEX8 vector in with len elements. More...
 

Vector Element Finding Operations

int XLALVectorFindVectorLessEqualREAL4 (UINT4 *count, UINT4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
 Count and return indexes (in count and out respectively) of vector elements where \(\text{in1} \le \text{in2}\). More...
 
int XLALVectorFindScalarLessEqualREAL4 (UINT4 *count, UINT4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len)
 Count and return indexes (in count and out respectively) of vector elements where \(\text{scalar} \le \text{in2}\). More...
 

Function Documentation

◆ XLALCreateUINT4VectorAligned()

UINT4VectorAligned* XLALCreateUINT4VectorAligned ( const UINT4  length,
const UINT4  align 
)

Create a new UINT4VectorAligned struct with length length and alignment align.

◆ XLALResizeUINT4VectorAligned()

UINT4VectorAligned* XLALResizeUINT4VectorAligned ( UINT4VectorAligned in,
const UINT4  length,
const UINT4  align 
)

Resize an existing UINT4VectorAligned struct to length length and alignment align.

◆ XLALDestroyUINT4VectorAligned()

void XLALDestroyUINT4VectorAligned ( UINT4VectorAligned in)

Free a UINT4VectorAligned struct.

◆ XLALCreateREAL4VectorAligned()

REAL4VectorAligned* XLALCreateREAL4VectorAligned ( const UINT4  length,
const UINT4  align 
)

Create a new REAL4VectorAligned struct with length length and alignment align.

◆ XLALResizeREAL4VectorAligned()

REAL4VectorAligned* XLALResizeREAL4VectorAligned ( REAL4VectorAligned in,
const UINT4  length,
const UINT4  align 
)

Resize an existing REAL4VectorAligned struct to length length and alignment align.

◆ XLALDestroyREAL4VectorAligned()

void XLALDestroyREAL4VectorAligned ( REAL4VectorAligned in)

Free a REAL4VectorAligned struct.

◆ XLALCreateREAL8VectorAligned()

REAL8VectorAligned* XLALCreateREAL8VectorAligned ( const UINT4  length,
const UINT4  align 
)

Create a new REAL8VectorAligned struct with length length and alignment align.

◆ XLALResizeREAL8VectorAligned()

REAL8VectorAligned* XLALResizeREAL8VectorAligned ( REAL8VectorAligned in,
const UINT4  length,
const UINT4  align 
)

Resize an existing REAL8VectorAligned struct to length length and alignment align.

◆ XLALDestroyREAL8VectorAligned()

void XLALDestroyREAL8VectorAligned ( REAL8VectorAligned in)

Free a REAL8VectorAligned struct.

◆ XLALCreateCOMPLEX8VectorAligned()

COMPLEX8VectorAligned* XLALCreateCOMPLEX8VectorAligned ( const UINT4  length,
const UINT4  align 
)

Create a new COMPLEX8VectorAligned struct with length length and alignment align.

◆ XLALResizeCOMPLEX8VectorAligned()

COMPLEX8VectorAligned* XLALResizeCOMPLEX8VectorAligned ( COMPLEX8VectorAligned in,
const UINT4  length,
const UINT4  align 
)

Resize an existing COMPLEX8VectorAligned struct to length length and alignment align.

◆ XLALDestroyCOMPLEX8VectorAligned()

void XLALDestroyCOMPLEX8VectorAligned ( COMPLEX8VectorAligned in)

Free a COMPLEX8VectorAligned struct.

◆ XLALCreateCOMPLEX16VectorAligned()

COMPLEX16VectorAligned* XLALCreateCOMPLEX16VectorAligned ( const UINT4  length,
const UINT4  align 
)

Create a new COMPLEX16VectorAligned struct with length length and alignment align.

◆ XLALResizeCOMPLEX16VectorAligned()

COMPLEX16VectorAligned* XLALResizeCOMPLEX16VectorAligned ( COMPLEX16VectorAligned in,
const UINT4  length,
const UINT4  align 
)

Resize an existing COMPLEX16VectorAligned struct to length length and alignment align.

◆ XLALDestroyCOMPLEX16VectorAligned()

void XLALDestroyCOMPLEX16VectorAligned ( COMPLEX16VectorAligned in)

Free a COMPLEX16VectorAligned struct.

◆ XLALVectorINT4FromREAL4()

int XLALVectorINT4FromREAL4 ( INT4 out,
const REAL4 in,
const UINT4  len 
)

Cast (i.e.

truncate) REAL4 vector in to INT4 vector out, with len elements.

◆ XLALVectorSinREAL4()

int XLALVectorSinREAL4 ( REAL4 out,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out} = \sin(\text{in})\) over REAL4 vectors out, in with len elements.

◆ XLALVectorCosREAL4()

int XLALVectorCosREAL4 ( REAL4 out,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out} = \cos(\text{in})\) over REAL4 vectors out, in with len elements.

◆ XLALVectorExpREAL4()

int XLALVectorExpREAL4 ( REAL4 out,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out} = \exp(\text{in})\) over REAL4 vectors out, in with len elements.

◆ XLALVectorLogREAL4()

int XLALVectorLogREAL4 ( REAL4 out,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out} = \log(\text{in})\) over REAL4 vectors out, in with len elements.

◆ XLALVectorRoundREAL4()

int XLALVectorRoundREAL4 ( REAL4 out,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out} = round ( \text{in} )\) over REAL4 vectors out, in with len elements.

◆ XLALVectorRoundREAL8()

int XLALVectorRoundREAL8 ( REAL8 out,
const REAL8 in,
const UINT4  len 
)

Compute \(\text{out} = round ( \text{in} )\) over REAL8 vectors out, in with len elements.

◆ XLALVectorSinCosREAL4()

int XLALVectorSinCosREAL4 ( REAL4 out1,
REAL4 out2,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out1} = \sin(\text{in}), \text{out2} = \cos(\text{in})\) over REAL4 vectors out1, out2, in with len elements.

◆ XLALVectorSinCos2PiREAL4()

int XLALVectorSinCos2PiREAL4 ( REAL4 out1,
REAL4 out2,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out1} = \sin(2\pi \text{in}), \text{out2} = \cos(2\pi \text{in})\) over REAL4 vectors out1, out2, in with len elements.

◆ XLALVectorAddREAL4()

int XLALVectorAddREAL4 ( REAL4 out,
const REAL4 in1,
const REAL4 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} + \text{in2}\) over REAL4 vectors in1 and in2 with len elements.

◆ XLALVectorSubREAL4()

int XLALVectorSubREAL4 ( REAL4 out,
const REAL4 in1,
const REAL4 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} - \text{in2}\) over REAL4 vectors in1 and in2 with len elements.

◆ XLALVectorMultiplyREAL4()

int XLALVectorMultiplyREAL4 ( REAL4 out,
const REAL4 in1,
const REAL4 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} \times \text{in2}\) over REAL4 vectors in1 and in2 with len elements.

◆ XLALVectorMaxREAL4()

int XLALVectorMaxREAL4 ( REAL4 out,
const REAL4 in1,
const REAL4 in2,
const UINT4  len 
)

Compute \(\text{out} = max ( \text{in1}, \text{in2} )\) over REAL4 vectors in1 and in2 with len elements.

◆ XLALVectorAddREAL8()

int XLALVectorAddREAL8 ( REAL8 out,
const REAL8 in1,
const REAL8 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} + \text{in2}\) over REAL8 vectors in1 and in2 with len elements.

◆ XLALVectorSubREAL8()

int XLALVectorSubREAL8 ( REAL8 out,
const REAL8 in1,
const REAL8 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} - \text{in2}\) over REAL8 vectors in1 and in2 with len elements.

◆ XLALVectorMultiplyREAL8()

int XLALVectorMultiplyREAL8 ( REAL8 out,
const REAL8 in1,
const REAL8 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} \times \text{in2}\) over REAL8 vectors in1 and in2 with len elements.

◆ XLALVectorMaxREAL8()

int XLALVectorMaxREAL8 ( REAL8 out,
const REAL8 in1,
const REAL8 in2,
const UINT4  len 
)

Compute \(\text{out} = max ( \text{in1}, \text{in2} )\) over REAL8 vectors in1 and in2 with len elements.

◆ XLALVectorMultiplyCOMPLEX8()

int XLALVectorMultiplyCOMPLEX8 ( COMPLEX8 out,
const COMPLEX8 in1,
const COMPLEX8 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} \times \text{in2}\) over COMPLEX8 vectors in1 and in2 with len elements.

◆ XLALVectorAddCOMPLEX8()

int XLALVectorAddCOMPLEX8 ( COMPLEX8 out,
const COMPLEX8 in1,
const COMPLEX8 in2,
const UINT4  len 
)

Compute \(\text{out} = \text{in1} + \text{in2}\) over COMPLEX8 vectors in1 and in2 with len elements.

◆ XLALVectorShiftREAL4()

int XLALVectorShiftREAL4 ( REAL4 out,
REAL4  scalar,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out} = \text{scalar} + \text{in}\) over REAL4 vector in with len elements.

◆ XLALVectorScaleREAL4()

int XLALVectorScaleREAL4 ( REAL4 out,
REAL4  scalar,
const REAL4 in,
const UINT4  len 
)

Compute \(\text{out} = \text{scalar} \times \text{in}\) over REAL4 vector in with len elements.

◆ XLALVectorScaleREAL8()

int XLALVectorScaleREAL8 ( REAL8 out,
REAL8  scalar,
const REAL8 in,
const UINT4  len 
)

Compute \(\text{out} = \text{scalar} \times \text{in}\) over REAL8 vector in with len elements.

◆ XLALVectorShiftREAL8()

int XLALVectorShiftREAL8 ( REAL8 out,
REAL8  scalar,
const REAL8 in,
const UINT4  len 
)

Compute \(\text{out} = \text{scalar} + \text{in}\) over REAL8 vector in with len elements.

◆ XLALVectorScaleCOMPLEX8()

int XLALVectorScaleCOMPLEX8 ( COMPLEX8 out,
COMPLEX8  scalar,
const COMPLEX8 in,
const UINT4  len 
)

Compute \(\text{out} = \text{scalar} \times \text{in}\) over COMPLEX8 vector in with len elements.

◆ XLALVectorShiftCOMPLEX8()

int XLALVectorShiftCOMPLEX8 ( COMPLEX8 out,
COMPLEX8  scalar,
const COMPLEX8 in,
const UINT4  len 
)

Compute \(\text{out} = \text{scalar} + \text{in}\) over COMPLEX8 vector in with len elements.

◆ XLALVectorFindVectorLessEqualREAL4()

int XLALVectorFindVectorLessEqualREAL4 ( UINT4 count,
UINT4 out,
const REAL4 in1,
const REAL4 in2,
const UINT4  len 
)

Count and return indexes (in count and out respectively) of vector elements where \(\text{in1} \le \text{in2}\).

◆ XLALVectorFindScalarLessEqualREAL4()

int XLALVectorFindScalarLessEqualREAL4 ( UINT4 count,
UINT4 out,
REAL4  scalar,
const REAL4 in,
const UINT4  len 
)

Count and return indexes (in count and out respectively) of vector elements where \(\text{scalar} \le \text{in2}\).