MIDI Pipeline Reference Manual  2.8.3
complex_midi.h
1 /**********************************************************
2 ***********************************************************
3 * European Southern Observatory
4 * VLTI MIDI Data Reduction Software
5 *
6 * Module name: complex.h
7 * Description:
8 *
9 *
10 * History:
11 * 03-Feb-03 (jmeisner) Created
12 * 03-Mar-03 (csabet) Added title, directives and included in the MIDI pipeline
13 ***********************************************************
14 **********************************************************/
15 #ifndef _COMPLEX_H_MIDI
16 #define _COMPLEX_H_MIDI
17 
18 /**********************************************************
19 * Include files
20 **********************************************************/
21 
22 /**********************************************************
23 * Constant definitions
24 **********************************************************/
25 
26 /**********************************************************
27 * Global Variables
28 **********************************************************/
29 
30 /**********************************************************
31 * Type definitions
32 **********************************************************/
33 struct Complex
34 {
35  float r, i;
36 };
37 
38 extern struct Complex Czero; // CONSTANT for use by apps. DO NOT CHANGE IT, EVER!!!
39 
40 /**********************************************************
41 * Macro Definitions
42 **********************************************************/
43 #define MAKEC(real, imag, result) {result.r = real; result.i = imag;}
44 #define SETTOCONJ(dest, source) {dest.r = source.r; dest.i = -source.i;}
45 
46 /**********************************************************
47 * Function Prototypes
48 **********************************************************/
49 struct Complex Addc(struct Complex, struct Complex);
50 struct Complex Subtractc(struct Complex, struct Complex);
51 struct Complex Multiplyc(struct Complex z1, struct Complex z2);
52 struct Complex Dividec(struct Complex z1, struct Complex z2);
53 
54 // Same as above but use pointers:
55 void AddCptr(struct Complex *result, struct Complex *z1, struct Complex *z2);
56 void SubtractCptr(struct Complex *result, struct Complex *z1, struct Complex *z2);
57 void MultiplyCptr(struct Complex *result, struct Complex *z1, struct Complex *z2);
58 void MultiplyConjPtr(struct Complex *result, struct Complex *z1, struct Complex *z2);
59 
60 struct Complex Scalec(struct Complex z, float scale);
61 struct Complex Unitc(struct Complex z);
62 float Cmag(struct Complex);
63 float Cmag2(struct Complex);
64 void GetEtoJtimes(float, struct Complex *);
65 void GetScaledEtoJtimes(float Angle, struct Complex *Result, float scale);
66 void RotateBy(float, struct Complex *);
67 
68 // New Nov 9, 1999:
69 // Returns a positive real part, if 0 then returns neg imag part.
70 struct Complex Csqrt(struct Complex);
71 void GetExpc(struct Complex *Result, struct Complex z);
72 struct Complex jtimes(struct Complex z);
73 
74 // Richard added on these
75 void printC(struct Complex z);
76 float Arg(struct Complex z);
77 
78 /*********************************************************/
79 #endif
80 /*********************************************************/