Data types & complex numbers

Integers --------------------------------- MAGMA uses **magma_int_t** for integers.

Normally, this is mapped to the C/C++ int type. Most systems today use the LP64 convention, meaning long and pointers are 64-bit, while int is 32-bit.

MAGMA also supports the ILP64 convention as an alternative, where int, long, and pointers are all 64-bit. To use this, we typedef magma_int_t to be int64_t. To use ILP64, define MAGMA_ILP64 or MKL_ILP64 when compiling, and link with an ILP64 BLAS and LAPACK library; see make.inc.mkl-ilp64 for an example.

Complex numbers --------------------------------- MAGMA supports complex numbers. Unfortunately, there is not a single standard for how to implement complex numbers in C/C++. Fortunately, most implementations are identical on a binary level, so you can freely cast from one to another. The MAGMA types are: **magmaFloatComplex**, which in CUDA MAGMA is a typedef of cuFloatComplex, and **magmaDoubleComplex**, which in CUDA MAGMA is a typedef of cuDoubleComplex.

For C, we provide macros to manipulate complex numbers. For C++ support, include the magma_operators.h header, which provides overloaded C++ operators and functions.

C macro | C++ operator | Description ----------- | ----------- | ----------- c = MAGMA_*_MAKE(r,i) | | create complex number from real & imaginary parts r = MAGMA_*_REAL(a) | r = real(a) | return real part i = MAGMA_*_IMAG(a) | i = imag(a) | return imaginary part c = MAGMA_*_NEGATE(a) | c = -a; | negate c = MAGMA_*_ADD(a,b) | c = a + b; | add c = MAGMA_*_SUB(a,b) | c = a - b; | subtract c = MAGMA_*_MUL(a,b) | c = a * b; | multiply c = MAGMA_*_DIV(a,b) | c = a / b; | divide c = MAGMA_*_CNJG(a) | c = conj(a) | conjugate r = MAGMA_*_ABS(a) | r = fabs(a) | 2-norm, sqrt( real(a)^2 + imag(a)^2 ) r = MAGMA_*_ABS1(a) | r = abs1(a) | 1-norm, abs(real(a)) + abs(imag(a)) . **Constants** | | **Description** c = MAGMA_*_ZERO | | zero c = MAGMA_*_ONE | | one c = MAGMA_*_NAN | | not-a-number (e.g., 0/0) c = MAGMA_*_INF | | infinity (e.g., 1/0, overflow)

where * is one of the four precisions, S D C Z.


Generated on 3 May 2015 for MAGMA by  doxygen 1.6.1