TBCI Numerical high perf. C++ Library  2.8.0
scomplex.h
Go to the documentation of this file.
1 
6 /* $Id: scomplex.h,v 1.2.2.1 2010/08/26 07:58:23 garloff Exp $ */
7 
8 
9 /*
10  * -- SuperLU routine (version 1.1) --
11  * Univ. of California Berkeley, Xerox Palo Alto Research Center,
12  * and Lawrence Berkeley National Lab.
13  * November 15, 1997
14  *
15  */
16 #ifndef __SUPERLU_SCOMPLEX /* allow multiple inclusions */
17 #define __SUPERLU_SCOMPLEX
18 
19 /*
20  * This header file is to be included in source files c*.c
21  */
22 #ifndef SCOMPLEX_INCLUDE
23 #define SCOMPLEX_INCLUDE
24 
25 typedef struct { float r, i; } complex;
26 
27 
28 /* Macro definitions */
29 
30 /* Complex Addition c = a + b */
31 #define c_add(c, a, b) { (c)->r = (a)->r + (b)->r; \
32  (c)->i = (a)->i + (b)->i; }
33 
34 /* Complex Subtraction c = a - b */
35 #define c_sub(c, a, b) { (c)->r = (a)->r - (b)->r; \
36  (c)->i = (a)->i - (b)->i; }
37 
38 /* Complex-Double Multiplication */
39 #define cs_mult(c, a, b) { (c)->r = (a)->r * (b); \
40  (c)->i = (a)->i * (b); }
41 
42 /* Complex-Complex Multiplication */
43 #define cc_mult(c, a, b) { \
44  float cr, ci; \
45  cr = (a)->r * (b)->r - (a)->i * (b)->i; \
46  ci = (a)->i * (b)->r + (a)->r * (b)->i; \
47  (c)->r = cr; \
48  (c)->i = ci; \
49  }
50 
51 /* Complex equality testing */
52 #define c_eq(a, b) ( (a)->r == (b)->r && (a)->i == (b)->i )
53 
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Prototypes for functions in scomplex.c */
60 void c_div(complex *, complex *, complex *);
61 double c_abs(complex *); /* exact */
62 double c_abs1(complex *); /* approximate */
63 void c_exp(complex *, complex *);
64 void r_cnjg(complex *, complex *);
65 double r_imag(complex *);
66 
67 
68 #ifdef __cplusplus
69  }
70 #endif
71 
72 #endif
73 
74 #endif /* __SUPERLU_SCOMPLEX */
double c_abs(const complex *)
double c_abs1(complex *)
float r
Definition: scomplex.h:25
void c_exp(complex *, const complex *)
void c_div(complex *, const complex *, const complex *)
double r_imag(const complex *)
int i
Definition: LM_fit.h:71
Definition: f2c.h:33
void r_cnjg(complex *, complex *)
#define complex