~ubuntu-branches/ubuntu/precise/yagiuda/precise

« back to all changes in this revision

Viewing changes to src/com_hack.h

  • Committer: Bazaar Package Importer
  • Author(s): Joop Stakenborg
  • Date: 2005-08-22 20:20:13 UTC
  • Revision ID: james.westby@ubuntu.com-20050822202013-mhhxp4xirdxrdfx1
Tags: upstream-1.19
ImportĀ upstreamĀ versionĀ 1.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Here are the prototypes of the complex routines that are in the book
 
2
'Numerical recipes in C' by Press et al, 2nd edition, 1992. All references to 
 
3
'float' in that book have been changed to 'double' here. Hence the definitions 
 
4
are not always the same.
 
5
 
 
6
ie a routine:
 
7
                                 fcomplex complex(float re, float im);
 
8
 
 
9
has been changed to:
 
10
 
 
11
             fcomplex complex(double re, double im);
 
12
 
 
13
Hence all the C routines used here *must* be converted to double. Please *dont*
 
14
use the numerical recipes header file 'complex.h', use my 'complex_hack.h' 
 
15
 
 
16
The line:
 
17
 
 
18
typedef struct FCOMPLEX {double r, i;} fcomplex;
 
19
 
 
20
in the file  complex_hack.c must be deleted, since its defined in this file.
 
21
Otherwise its defined twice, which will give a compiler error. */
 
22
 
 
23
typedef struct FCOMPLEX {double r, i;} fcomplex;
 
24
 
 
25
fcomplex Cadd(fcomplex a, fcomplex b);  /* a+b */
 
26
fcomplex Csub(fcomplex a, fcomplex b);  /* a-b */
 
27
fcomplex Cmul(fcomplex a, fcomplex b);  /* a*b */
 
28
fcomplex Complex(double re, double im); /* Set an fcomplex number */
 
29
fcomplex Cdiv(fcomplex a, fcomplex b);  /* a/b */
 
30
double Cabs(fcomplex z);                /* absolute value of z */
 
31
 
 
32
fcomplex RCmul(double x, fcomplex a);   /* real (x) times compelx (a) */
 
33