~ubuntu-branches/ubuntu/lucid/python-scipy/lucid

« back to all changes in this revision

Viewing changes to Lib/sandbox/pysparse/superlu/scomplex.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-07 14:12:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070107141212-mm0ebkh5b37hcpzn
* Remove build dependency on python-numpy-dev.
* python-scipy: Depend on python-numpy instead of python-numpy-dev.
* Package builds on other archs than i386. Closes: #402783.

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
/* Complex equality testing */
 
46
#define c_eq(a, b)  ( (a)->r == (b)->r && (a)->i == (b)->i )
 
47
 
 
48
 
 
49
#ifdef __cplusplus
 
50
extern "C" {
 
51
#endif
 
52
 
 
53
/* Prototypes for functions in scomplex.c */
 
54
void c_div(complex *, complex *, complex *);
 
55
double c_abs(complex *);     /* exact */
 
56
double c_abs1(complex *);    /* approximate */
 
57
void c_exp(complex *, complex *);
 
58
void r_cnjg(complex *, complex *);
 
59
double r_imag(complex *);
 
60
 
 
61
 
 
62
#ifdef __cplusplus
 
63
  }
 
64
#endif
 
65
 
 
66
#endif
 
67
 
 
68
#endif  /* __SUPERLU_SCOMPLEX */