next up previous contents
Next: Function: graph() Up: GRASP Routines: General purpose Previous: Function: ratio()   Contents


Function: reciprocal()

void reciprocal(float *b, float *a, int ncomplex)

This routine computes the array $b=1/a$ for an input array $a$ containing complex numbers. The arguments are:

a: Input. The array of $N$ complex numbers a[0..2N-1] with a[2j] and a[2j+1] respectively containing the real and imaginary parts.
b: Output. The array of $N$ complex numbers b[0..2N-1] with b[2j] and b[2j+1] respectively containing the real and imaginary parts of $1/a$.
ncomplex: Input. The number $N$ of complex numbers in the arrays.
Note that the arrays a[] and b[] can be the same.

In order to reduce the potential for overflows (since floating point arithmetic was used), the reciprocals of the complex numbers were computed according to the following formula:

\begin{displaymath}
b = \frac{1}{a} = \frac{1}{x+iy} = \left\{
\begin{array}{l...
...{x(x/y)+y} & \vert x\vert\le\vert y\vert.
\end{array} \right.
\end{displaymath} (16.10.330)

Author: Jolien Creighton, jolien@tapir.caltech.edu
Comments: None.



Bruce Allen 2000-11-19