Common definitions (C code)

Aligned memory allocation.

Defines

CT_MEM_DATA_ALIGN

Memory alignment used in dynamic memory allocation, must be a power of 2.

Functions

static inline void *ct_malloc(size_t size)

Allocate ‘size’ bytes of uninitialized storage, and return a pointer to the allocated memory block.

static inline void ct_free(void *memblock)

Deallocate a previously allocated memory block.

static inline void *ct_calloc(size_t num, size_t size)

Allocate storage for an array of ‘num’ objects of ‘size’ bytes, initialize the storage with zeros, and return a pointer to the allocated memory block.

Numeric data types.

Typedefs

typedef float _Complex scomplex

Single-precision complex data type.

typedef double _Complex dcomplex

Double-precision complex data type.

Enums

enum numeric_type

Numeric data type identifiers.

Values:

enumerator CT_SINGLE_REAL

float

enumerator CT_DOUBLE_REAL

double

enumerator CT_SINGLE_COMPLEX

float complex

enumerator CT_DOUBLE_COMPLEX

double complex

enumerator CT_NUM_NUMERIC_TYPES

number of numeric data types

Functions

static inline size_t sizeof_numeric_type(const enum numeric_type dtype)

Numeric data type size in bytes.

static inline enum numeric_type numeric_real_type(const enum numeric_type dtype)

Real numeric data type of the same precision.

static inline const void *numeric_one(const enum numeric_type dtype)

Return a pointer to a static constant variable of the provided data type representing one.

static inline const void *numeric_zero(const enum numeric_type dtype)

Return a pointer to a static constant variable of the provided data type representing zero.

static inline const void *numeric_neg_one(const enum numeric_type dtype)

Return a pointer to a static constant variable of the provided data type representing -1.

static inline void numeric_from_double(const double x, const enum numeric_type dtype, void *alpha)

Convert the double number ‘x’ to the specified type and store result in ‘alpha’.