|
__host__ static __device__ double | real (const magmaDoubleComplex &x) |
|
__host__ static __device__ double | imag (const double &x) |
|
__host__ static __device__ double | conj (const double &x) |
|
__host__ static __device__ double | fabs (const magmaDoubleComplex &x) |
|
__host__ static __device__ double | abs1 (const magmaDoubleComplex &x) |
|
In C++, including magma_operators.h defines the usual unary and binary operators for complex numbers: +, +=, -, -=, *, *=, /, /=, ==, !=.
Additionally, real(), imag(), conj(), fabs(), and abs1() are defined to apply to both complex and real numbers.
In C, there are equivalent macros: MAGMA_Z_{MAKE, REAL, IMAG, ADD, SUB, MUL, DIV, ABS, ABS1, CONJ} for double-complex, MAGMA_C_{...} for float-complex, MAGMA_D_{...} for double, MAGMA_S_{...} for float.
Just the double-complex versions are documented here.
◆ MAGMA_Z_MAKE
#define MAGMA_Z_MAKE |
( |
| r, |
|
|
| i ) |
- Returns
- complex number r + i*sqrt(-1).
◆ MAGMA_Z_REAL
#define MAGMA_Z_REAL |
( |
| a | ) |
|
- Returns
- real component of a.
◆ MAGMA_Z_IMAG
#define MAGMA_Z_IMAG |
( |
| a | ) |
|
- Returns
- imaginary component of a.
◆ MAGMA_Z_ADD
#define MAGMA_Z_ADD |
( |
| a, |
|
|
| b ) |
◆ MAGMA_Z_SUB
#define MAGMA_Z_SUB |
( |
| a, |
|
|
| b ) |
◆ MAGMA_Z_MUL
#define MAGMA_Z_MUL |
( |
| a, |
|
|
| b ) |
◆ MAGMA_Z_DIV
#define MAGMA_Z_DIV |
( |
| a, |
|
|
| b ) |
◆ MAGMA_Z_ABS
- Returns
- absolute value, |a| = sqrt( real(a)^2 + imag(a)^2 ).
◆ MAGMA_Z_ABS1
#define MAGMA_Z_ABS1 |
( |
| a | ) |
|
- Returns
- 1-norm absolute value, | real(a) | + | imag(a) |.
◆ MAGMA_Z_CONJ
#define MAGMA_Z_CONJ |
( |
| a | ) |
|
◆ real()
__host__ static __device__ double real |
( |
const magmaDoubleComplex & | x | ) |
|
|
inlinestatic |
- Returns
- real component of complex number x; x for real number.
◆ imag()
__host__ static __device__ double imag |
( |
const double & | x | ) |
|
|
inlinestatic |
- Returns
- imaginary component of complex number x; 0 for real number.
◆ conj()
__host__ static __device__ double conj |
( |
const double & | x | ) |
|
|
inlinestatic |
- Returns
- conjugate of complex number x; x for real number.
◆ fabs()
__host__ static __device__ double fabs |
( |
const magmaDoubleComplex & | x | ) |
|
|
inlinestatic |
- Returns
- 2-norm absolute value of complex number x: sqrt( real(x)^2 + imag(x)^2 ). math.h or cmath provide fabs for real numbers.
◆ abs1()
__host__ static __device__ double abs1 |
( |
const magmaDoubleComplex & | x | ) |
|
|
inlinestatic |
- Returns
- 1-norm absolute value of complex nmuber x: | real(x) | + | imag(x) |.