~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/sparse/SuperLU/SRC/scomplex.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T. Chen (new)
  • Date: 2005-03-16 02:15:29 UTC
  • Revision ID: james.westby@ubuntu.com-20050316021529-xrjlowsejs0cijig
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
/*
 
4
 * -- SuperLU routine (version 2.0) --
 
5
 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
 
6
 * and Lawrence Berkeley National Lab.
 
7
 * November 15, 1997
 
8
 *
 
9
 */
 
10
#ifndef __SUPERLU_SCOMPLEX /* allow multiple inclusions */
 
11
#define __SUPERLU_SCOMPLEX
 
12
 
 
13
/* 
 
14
 * This header file is to be included in source files c*.c
 
15
 */
 
16
#ifndef SCOMPLEX_INCLUDE
 
17
#define SCOMPLEX_INCLUDE
 
18
 
 
19
typedef struct { float r, i; } complex;
 
20
 
 
21
 
 
22
/* Macro definitions */
 
23
 
 
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; }
 
27
 
 
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; }
 
31
 
 
32
/* Complex-Double Multiplication */
 
33
#define cs_mult(c, a, b) { (c)->r = (a)->r * (b); \
 
34
                           (c)->i = (a)->i * (b); }
 
35
 
 
36
/* Complex-Complex Multiplication */
 
37
#define cc_mult(c, a, b) { \
 
38
        float cr, ci; \
 
39
        cr = (a)->r * (b)->r - (a)->i * (b)->i; \
 
40
        ci = (a)->i * (b)->r + (a)->r * (b)->i; \
 
41
        (c)->r = cr; \
 
42
        (c)->i = ci; \
 
43
    }
 
44
 
 
45
#define cc_conj(a, b) { \
 
46
        (a)->r = (b)->r; \
 
47
        (a)->i = -((b)->i); \
 
48
    }
 
49
 
 
50
/* Complex equality testing */
 
51
#define c_eq(a, b)  ( (a)->r == (b)->r && (a)->i == (b)->i )
 
52
 
 
53
 
 
54
#ifdef __cplusplus
 
55
extern "C" {
 
56
#endif
 
57
 
 
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 *);
 
65
 
 
66
 
 
67
#ifdef __cplusplus
 
68
  }
 
69
#endif
 
70
 
 
71
#endif
 
72
 
 
73
#endif  /* __SUPERLU_SCOMPLEX */