SuperLU 7.0.0
slu_scomplex.h
Go to the documentation of this file.
1
24#ifndef __SUPERLU_SCOMPLEX /* allow multiple inclusions */
25#define __SUPERLU_SCOMPLEX
26
27
28#ifndef SCOMPLEX_INCLUDE
29#define SCOMPLEX_INCLUDE
30
31typedef struct { float r, i; } singlecomplex;
32
33#if defined(SUPERLU_TYPEDEF_COMPLEX) || DOXYGEN
36typedef singlecomplex complex;
37#endif
38
39/* Macro definitions */
40
42#define c_add(c, a, b) { (c)->r = (a)->r + (b)->r; \
43 (c)->i = (a)->i + (b)->i; }
44
46#define c_sub(c, a, b) { (c)->r = (a)->r - (b)->r; \
47 (c)->i = (a)->i - (b)->i; }
48
50#define cs_mult(c, a, b) { (c)->r = (a)->r * (b); \
51 (c)->i = (a)->i * (b); }
52
54#define cc_mult(c, a, b) { \
55 float cr, ci; \
56 cr = (a)->r * (b)->r - (a)->i * (b)->i; \
57 ci = (a)->i * (b)->r + (a)->r * (b)->i; \
58 (c)->r = cr; \
59 (c)->i = ci; \
60 }
61
62#define cc_conj(a, b) { \
63 (a)->r = (b)->r; \
64 (a)->i = -((b)->i); \
65 }
66
68#define c_eq(a, b) ( (a)->r == (b)->r && (a)->i == (b)->i )
69
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75/* Prototypes for functions in scomplex.c */
77double c_abs(singlecomplex *); /* exact */
78double c_abs1(singlecomplex *); /* approximate */
81double r_imag(singlecomplex *);
84
85
86
87#ifdef __cplusplus
88 }
89#endif
90
91#endif
92
93#endif /* __SUPERLU_SCOMPLEX */
singlecomplex c_sgn(singlecomplex *)
SIGN functions for complex number. Returns z/abs(z)
Definition: scomplex.c:120
double c_abs(singlecomplex *)
Returns sqrt(z.r^2 + z.i^2)
Definition: scomplex.c:62
void c_exp(singlecomplex *, singlecomplex *)
Return the exponentiation.
Definition: scomplex.c:96
void r_cnjg(singlecomplex *, singlecomplex *)
Return the complex conjugate.
Definition: scomplex.c:106
void c_div(singlecomplex *, singlecomplex *, singlecomplex *)
Complex Division c = a/b.
Definition: scomplex.c:32
double r_imag(singlecomplex *)
Return the imaginary part.
Definition: scomplex.c:113
double c_abs1(singlecomplex *)
Approximates the abs. Returns abs(z.r) + abs(z.i)
Definition: scomplex.c:84
singlecomplex c_sqrt(singlecomplex *)
Square-root of a complex number.
Definition: scomplex.c:135
Definition: slu_scomplex.h:31
float i
Definition: slu_scomplex.h:31