4
* -- SuperLU routine (version 2.0) --
5
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
6
* and Lawrence Berkeley National Lab.
10
#ifndef __SUPERLU_DCOMPLEX /* allow multiple inclusions */
11
#define __SUPERLU_DCOMPLEX
14
* This header file is to be included in source files z*.c
16
#ifndef DCOMPLEX_INCLUDE
17
#define DCOMPLEX_INCLUDE
19
typedef struct { double r, i; } doublecomplex;
22
/* Macro definitions */
24
/* Complex Addition c = a + b */
25
#define z_add(c, a, b) { (c)->r = (a)->r + (b)->r; \
26
(c)->i = (a)->i + (b)->i; }
28
/* Complex Subtraction c = a - b */
29
#define z_sub(c, a, b) { (c)->r = (a)->r - (b)->r; \
30
(c)->i = (a)->i - (b)->i; }
32
/* Complex-Double Multiplication */
33
#define zd_mult(c, a, b) { (c)->r = (a)->r * (b); \
34
(c)->i = (a)->i * (b); }
36
/* Complex-Complex Multiplication */
37
#define zz_mult(c, a, b) { \
39
cr = (a)->r * (b)->r - (a)->i * (b)->i; \
40
ci = (a)->i * (b)->r + (a)->r * (b)->i; \
45
#define zz_conj(a, b) { \
50
/* Complex equality testing */
51
#define z_eq(a, b) ( (a)->r == (b)->r && (a)->i == (b)->i )
58
/* Prototypes for functions in dcomplex.c */
59
void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
60
double z_abs(doublecomplex *); /* exact */
61
double z_abs1(doublecomplex *); /* approximate */
62
void z_exp(doublecomplex *, doublecomplex *);
63
void d_cnjg(doublecomplex *r, doublecomplex *z);
64
double d_imag(doublecomplex *);
73
#endif /* __SUPERLU_DCOMPLEX */