Page: (complex)Top, Next: (fft), Prev: (cpl)rtchecks, Up: (cpl)Library Index

# Complex numbers

The complex.cpl library adds complex-number algebra to CPL. Type COMPLEX is in fact an ordinary STRUCTURE defined as
STRUCTURE(REAL REAL,IMAG)
In addition to being used as a structure, a COMPLEX can appear in algebraic expressions and be written or read in the form <real> + <imag> ∗ I. The predefined constant I denotes the imaginary unit. All complex-number operations are inlined for performance. The following functions are defined:
SQRT: square root
EXP: exponential
LOG: logarithm
SIN: sine
COS: cosine
TAN: tangent
ABS: absolute value
NORM: squared absolute value
ARG: argument or phase
CONJG: Conjugate (inlined)
In addition to the ordinary + - ∗ / ^ algebraic operations, an additional product operator is defined as
a | b = CONJG(a)∗b
CONJG(a) and this scalar-product operator are also defined when a and b are arrays of COMPLEX, just as all linear-space (cpl)ARRAY operations are.