- Main Page
- Data Structures
- Files

# SRC/slu_scomplex.h

Go to the documentation of this file.

    00001
    00014 #ifndef __SUPERLU_SCOMPLEX /* allow multiple inclusions */
    00015 #define __SUPERLU_SCOMPLEX
    00016
    00017
    00018 #ifndef SCOMPLEX_INCLUDE
    00019 #define SCOMPLEX_INCLUDE
    00020
    00021 typedef struct { float r, i; } complex;
    00022
    00023
    00024 /* Macro definitions */
    00025
    00027 #define c_add(c, a, b) { (c)->r = (a)->r + (b)->r; \
    00028                          (c)->i = (a)->i + (b)->i; }
    00029
    00031 #define c_sub(c, a, b) { (c)->r = (a)->r - (b)->r; \
    00032                          (c)->i = (a)->i - (b)->i; }
    00033
    00035 #define cs_mult(c, a, b) { (c)->r = (a)->r * (b); \
    00036                            (c)->i = (a)->i * (b); }
    00037
    00039 #define cc_mult(c, a, b) { \
    00040         float cr, ci; \
    00041         cr = (a)->r * (b)->r - (a)->i * (b)->i; \
    00042         ci = (a)->i * (b)->r + (a)->r * (b)->i; \
    00043         (c)->r = cr; \
    00044         (c)->i = ci; \
    00045     }
    00046
    00047 #define cc_conj(a, b) { \
    00048         (a)->r = (b)->r; \
    00049         (a)->i = -((b)->i); \
    00050     }
    00051
    00053 #define c_eq(a, b)  ( (a)->r == (b)->r && (a)->i == (b)->i )
    00054
    00055
    00056 #ifdef __cplusplus
    00057 extern "C" {
    00058 #endif
    00059
    00060 /* Prototypes for functions in scomplex.c */
    00061 void c_div(complex *, complex *, complex *);
    00062 double c_abs(complex *);     /* exact */
    00063 double c_abs1(complex *);    /* approximate */
    00064 void c_exp(complex *, complex *);
    00065 void r_cnjg(complex *, complex *);
    00066 double r_imag(complex *);
    00067 complex c_sgn(complex *);
    00068 complex c_sqrt(complex *);
    00069
    00070
    00071
    00072 #ifdef __cplusplus
    00073   }
    00074 #endif
    00075
    00076 #endif
    00077
    00078 #endif  /* __SUPERLU_SCOMPLEX */