PAL Mathematics: Complex Scalar Arithmetic

Conjugation, inversion, multiplication, division, magnitude, and magnitude approximations for complex scalar values.

PAL Mathematics: Complex Scalar Arithmetic — 17 functions

KiratPalAbscm

Signature
T_FLOAT KiratPalAbscm(T_COMPLEX cValue);
Description
Calculates the element-wise absolute value/magnitude.
Mathematical operation
\(|z|=\sqrt{(\Re z)^2+(\Im z)^2}\)

KiratPalComplexAbs

Signature
T_FLOAT KiratPalComplexAbs(T_COMPLEX cValue);
Description
Calculates the element-wise absolute value/magnitude.
Mathematical operation
\(|z|=\sqrt{(\Re z)^2+(\Im z)^2}\)

KiratPalComplexAbsApprox

Signature
T_FLOAT KiratPalComplexAbsApprox(T_COMPLEX cValue);
Description
Fast approximation of the magnitude of a complex number.
Mathematical operation
\(y=\sqrt{(\Re z)^2+(\Im z)^2}\); the current generic path uses the ordinary square root, so this is numerically the same expression as the exact magnitude.

KiratPalComplexAbsSquared

Signature
T_FLOAT KiratPalComplexAbsSquared(T_COMPLEX cValue);
Description
Returns the squared magnitude of a complex number.
Mathematical operation
\(|z|^2=(\Re z)^2+(\Im z)^2\)

KiratPalComplexBiasedAbsApprox

Signature
T_FLOAT KiratPalComplexBiasedAbsApprox(T_COMPLEX cValue);
Description
Fast deliberately biased approximation of the magnitude of a complex number.
Mathematical operation
\(a(z)=|\Re z|+|\Im z|\) (L1 magnitude; intentionally biased high relative to the Euclidean magnitude).

KiratPalComplexConj

Signature
void KiratPalComplexConj(T_COMPLEX* cSource, T_COMPLEX* cTarget);
Description
Calculates the element-wise complex conjugate.
Mathematical operation
\(y=z^*=\Re z-j\Im z\)

KiratPalComplexConjMult

Signature
void KiratPalComplexConjMult(T_COMPLEX* cFactor, T_COMPLEX* cConjFactor, T_COMPLEX* cProduct);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(y=z_1z_2^*\)

KiratPalComplexConjMultAcc

Signature
void KiratPalComplexConjMultAcc(T_COMPLEX* cFactor, T_COMPLEX* cConjFactor, T_COMPLEX* cProduct);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(y\leftarrow y+z_1z_2^*\)

KiratPalComplexDiv

Signature
void KiratPalComplexDiv(T_COMPLEX* cDividend, T_COMPLEX* cDivisor, T_COMPLEX* cQuotient);
Description
Divides two complex numbers.
Mathematical operation
\(q=\dfrac{z_1z_2^*}{|z_2|^2+\varepsilon_{\mathrm{SYS}}}\)

KiratPalComplexInv

Signature
void KiratPalComplexInv(T_COMPLEX* cValue);
Description
Operation on complex scalar values.
Mathematical operation
\(z\leftarrow\dfrac{z^*}{|z|^2+\varepsilon_{\mathrm{SYS}}}\)

KiratPalComplexMult

Signature
void KiratPalComplexMult(T_COMPLEX* cSourceDest, T_COMPLEX* cFactor);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(z_1\leftarrow z_1z_2\)

KiratPalComplexMultAcc

Signature
void KiratPalComplexMultAcc(T_COMPLEX* cFactor1, T_COMPLEX* cFactor2, T_COMPLEX* cProduct);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(y\leftarrow y+z_1z_2\)

KiratPalComplexMultToDest

Signature
void KiratPalComplexMultToDest(T_COMPLEX* cFactor1, T_COMPLEX* cFactor2, T_COMPLEX* cProduct);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(y=z_1z_2\)

KiratPalFloatComplexDiv

Signature
void KiratPalFloatComplexDiv(T_COMPLEX* cDividend, T_FLOAT* fDivisor, T_COMPLEX* cQuotient);
Description
Divides a complex number by a real scalar using a small numerical safeguard in the denominator.
Mathematical operation
\(q=(\Re z+j\Im z)/(a+10^{-10})\), i.e. \(\Re q=\Re z/(a+10^{-10})\) and \(\Im q=\Im z/(a+10^{-10})\) on the generic ANSI-C path.

KiratPalFloatComplexMult

Signature
void KiratPalFloatComplexMult(T_COMPLEX* cSourceDest, T_FLOAT fFactor);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(z\leftarrow a\,z\)

KiratPalFloatComplexMultAcc

Signature
void KiratPalFloatComplexMultAcc(T_FLOAT* fFactor, T_COMPLEX* cFactor, T_COMPLEX* cProduct);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(y\leftarrow y+a\,z\)

KiratPalFloatComplexMultToDest

Signature
void KiratPalFloatComplexMultToDest(T_FLOAT fFactor, T_COMPLEX* cFactor, T_COMPLEX* cProduct);
Description
Multiplies scalar, vector, or array values element-wise; Acc variants add the product to the destination.
Mathematical operation
\(y=a\,z\)