SuperLU 6.0.1
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; } complex;
32
33
34/* Macro definitions */
35
37#define c_add(c, a, b) { (c)->r = (a)->r + (b)->r; \
38 (c)->i = (a)->i + (b)->i; }
39
41#define c_sub(c, a, b) { (c)->r = (a)->r - (b)->r; \
42 (c)->i = (a)->i - (b)->i; }
43
45#define cs_mult(c, a, b) { (c)->r = (a)->r * (b); \
46 (c)->i = (a)->i * (b); }
47
49#define cc_mult(c, a, b) { \
50 float cr, ci; \
51 cr = (a)->r * (b)->r - (a)->i * (b)->i; \
52 ci = (a)->i * (b)->r + (a)->r * (b)->i; \
53 (c)->r = cr; \
54 (c)->i = ci; \
55 }
56
57#define cc_conj(a, b) { \
58 (a)->r = (b)->r; \
59 (a)->i = -((b)->i); \
60 }
61
63#define c_eq(a, b) ( (a)->r == (b)->r && (a)->i == (b)->i )
64
65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70/* Prototypes for functions in scomplex.c */
71void c_div(complex *, complex *, complex *);
72double c_abs(complex *); /* exact */
73double c_abs1(complex *); /* approximate */
74void c_exp(complex *, complex *);
75void r_cnjg(complex *, complex *);
76double r_imag(complex *);
79
80
81
82#ifdef __cplusplus
83 }
84#endif
85
86#endif
87
88#endif /* __SUPERLU_SCOMPLEX */
void r_cnjg(complex *, complex *)
Return the complex conjugate.
Definition: scomplex.c:106
double r_imag(complex *)
Return the imaginary part.
Definition: scomplex.c:113
void c_exp(complex *, complex *)
Return the exponentiation.
Definition: scomplex.c:96
double c_abs1(complex *)
Approximates the abs. Returns abs(z.r) + abs(z.i)
Definition: scomplex.c:84
void c_div(complex *, complex *, complex *)
Complex Division c = a/b.
Definition: scomplex.c:32
complex c_sgn(complex *)
SIGN functions for complex number. Returns z/abs(z)
Definition: scomplex.c:120
complex c_sqrt(complex *)
Square-root of a complex number.
Definition: scomplex.c:135
double c_abs(complex *)
Returns sqrt(z.r^2 + z.i^2)
Definition: scomplex.c:62
Definition: slu_scomplex.h:31
float i
Definition: slu_scomplex.h:31