COMPLEX - Functions to manipulate complex numbers
cadd add two complex numbers
csub subtract two complex numbers
cmul multiply two complex numbers
cdiv divide two complex numbers
cmplx make a complex number from two real numbers
conjg complex conjugate of a complex number
cneg negate a complex number
cinv invert a complex number
csqrt complex square root of a complex number
cexp complex exponential of a complex number
crmul multiply a complex number by a real number
rcabs real magnitude of a complex number
Structure:
typedef struct _complexStruct { complex number
float r,i;
} complex;
Function Prototypes:
complex cadd (complex a, complex b);
complex csub (complex a, complex b);
complex cmul (complex a, complex b);
complex cdiv (complex a, complex b);
float rcabs (complex z);
complex cmplx (float re, float im);
complex conjg (complex z);
complex cneg (complex z);
complex cinv (complex z);
complex csqrt (complex z);
complex cexp (complex z);
complex crmul (complex a, float x);
Notes:
The function "rcabs" was originally called "fcabs". This produced
a collision on some systems so a new name was chosen.
Reference:
Adapted from Press et al, 1988, Numerical Recipes in C (Appendix E).
Author: Dave Hale, Colorado School of Mines, 06/02/89
Modified: Dave Hale, Colorado School of Mines, 04/26/90
Added function cinv().