Complex API
The complex number API serves as a replacement for C and C++'s <complex.h>, offering fast, accelerated approximations for each routine. The API is mostly modeled after C99's <complex.h>, although it also supports being used from C++ via shz::complex. The API also features shz_fft(), an SH4 optimized fast-fourier transform.
- C header:
#include <sh4zam/shz_complex.h> - C++ header:
#include <sh4zam/shz_complex.hpp> - C++ types:
shz::complex - Symbols: 52
Suffixes
Section titled “Suffixes”Suffixes used in this module. The full list is in Naming and Suffixes.
_fsrra: UsesFSRRA(fast approximate 1/sqrt(x)). The argument or denominator must be positive. Faster, less precise.
Preprocessor
Section titled “Preprocessor”Macros and preprocessor constants.
| Symbol | Description |
|---|---|
SHZ_CMPLXF | Initializes a complex number. |
SHZ_CMPLXF32 | Initializes a complex number. |
SHZ_I | Unit imaginary constant, 'I'. |
Basic operations on complex numbers.
| Symbol | Description |
|---|---|
shz_cinitf | Returns a complex number which has been initialized to contain the given component values. |
shz_cpolarf | Returns a complex number with a magnitude of r, and a phase angle of theta (in radians). |
shz_cequalf | Checks for equality between two complex numbers with either an absolute or relative tolerance. |
shz_crealf | Returns the real component of a complex number. |
shz_cimagf | Returns the imaginary component of a complex number. |
Arithmetic
Section titled “Arithmetic”Arithmetic operations on complex numbers.
| Symbol | Description |
|---|---|
shz_caddf | Adds two complex numbers together and returns the result. |
shz_csubf | Subtracts rhs from lhs and returns the complex result. |
shz_cmulf | Multiplies two complex numbers together, returning the complex result. |
shz_cdivf | Divides lhs by rhs, returning the complex result. |
shz_cscalef | Scales both componets of the complex number, c, by the value, v, returning the result. |
shz_crecipf | Returns the multiplicative inverse or reciprocal of the complex number, c. |
Manipulation
Section titled “Manipulation”Extract or modify complex components.
| Symbol | Description |
|---|---|
shz_cabsf | Returns the absolute value (or magnitude) of the complex number, c. |
shz_inv_cabsf | Returns the inverse of the absolute value (or inverse of the magnitude) of the complex number, c. |
shz_cnormf | Returns the squared magnitude of the complex number, c. |
shz_cargf | Returns the phase angle of the complex number, c. |
shz_conjf | Returns the complex conjugate of c. |
shz_cprojf | Calculates the projection of the complex number, c, onto the Riemann sphere. |
Transcendental
Section titled “Transcendental”Complex transcendental functions.
| Symbol | Description |
|---|---|
shz_csqrtf | Computes and returns the complex square root of c. |
shz_cpowf | Raises the complex base to the complex exp power, returning a complex result. |
shz_cexpf | Returns the complex base e exponential of c. |
shz_clogf | Computes and returns the complex natural logarithm of c. |
shz_clog10f | Computes and returns the complex base 10 logarithm of c. |
Spherical Trigonometry
Section titled “Spherical Trigonometry”Complex spherical trigonometric functions.
| Symbol | Description |
|---|---|
shz_csinf | Calculates and returns the complex sine of c. |
shz_ccosf | Calculates and returns the complex cosine of c. |
shz_ctanf | Calculates and returns the complex tangent of c. |
shz_ccscf | Calculates and returns the complex cosecant of c. |
shz_csecf | Calculates and returns the complex secant of c. |
shz_ccotf | Calculates and returns the complex cotangent of c. |
shz_casinf | Calculates and returns the complex arcsine of c. |
shz_cacosf | Calculates and returns the complex arccosine of c. |
shz_catanf | Calculates and returns the complex arctangent of c. |
shz_cacscf | Calculates and returns the complex arccosecant of c. |
shz_casecf | Calculates and returns the complex arcsecant of c. |
shz_cacotf | Calculates and returns the complex arccotangent of c. |
Hyperbolic Trigonometry
Section titled “Hyperbolic Trigonometry”Complex hyperbolic trigonometric functions.
| Symbol | Description |
|---|---|
shz_csinhf | Calculates and returns the complex hyperbolic sine of c. |
shz_ccoshf | Calculates and returns the complex hyperbolic cosine of c. |
shz_ctanhf | Calculates and returns the complex hyperbolic tangent of c. |
shz_ccschf | Calculates and returns the complex hyperbolic cosecant of c. |
shz_csechf | Calculates and returns the complex hyperbolic secant of c. |
shz_ccothf | Calculates and returns the complex hyperbolic cotangent of c. |
shz_casinhf | Calculates and returns the complex hyperbolic arcsine of c. |
shz_cacoshf | Calculates and returns the complex hyperbolic arccosine of c. |
shz_catanhf | Calculates and returns the complex hyperbolic arctangent of c. |
shz_cacschf | Calculates and returns the complex hyperbolic arccosecant of c. |
shz_casechf | Calculates and returns the complex hyperbolic arcsecant of c. |
shz_cacothf | Calculates and returns the complex hyperbolic arccotangent of c. |
Signal Processing
Section titled “Signal Processing”Functions for processing complex signals.
| Symbol | Description |
|---|---|
shz_fft | Fast Fourier Transform. |
| Symbol | Description |
|---|---|
shz_complex_t | Represents a floating-point complex number real/imaginary pair. |
shz_complex | shz_complex_t alias for those who don't like POSIX-style. |