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_SCOMPLEX /* allow multiple inclusions */
11
#define __SUPERLU_SCOMPLEX
14
* This header file is to be included in source files c*.c
16
#ifndef SCOMPLEX_INCLUDE
17
#define SCOMPLEX_INCLUDE
19
typedef struct { float r, i; } complex;
22
/* Macro definitions */
24
/* Complex Addition c = a + b */
25
#define c_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 c_sub(c, a, b) { (c)->r = (a)->r - (b)->r; \
30
(c)->i = (a)->i - (b)->i; }
32
/* Complex-Double Multiplication */
33
#define cs_mult(c, a, b) { (c)->r = (a)->r * (b); \
34
(c)->i = (a)->i * (b); }
36
/* Complex-Complex Multiplication */
37
#define cc_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 cc_conj(a, b) { \
50
/* Complex equality testing */
51
#define c_eq(a, b) ( (a)->r == (b)->r && (a)->i == (b)->i )
58
/* Prototypes for functions in scomplex.c */
59
void c_div(complex *, complex *, complex *);
60
double c_abs(complex *); /* exact */
61
double c_abs1(complex *); /* approximate */
62
void c_exp(complex *, complex *);
63
void r_cnjg(complex *, complex *);
64
double r_imag(complex *);
73
#endif /* __SUPERLU_SCOMPLEX */