2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20#ifndef SHZ_COMPLEX_HPP
21#define SHZ_COMPLEX_HPP
33
34
35
44 SHZ_FORCE_INLINE
complex(
float re,
float im = 0.0f)
noexcept:
45 shz_complex_t({ re, im }) {}
48 SHZ_FORCE_INLINE
complex(
const shz_complex_t& cplx)
noexcept:
52 SHZ_FORCE_INLINE
complex(
const volatile shz_complex_t& cplx)
noexcept:
58
59
60
122
123
124
163 return !(lhs
== rhs);
169
170
171
201
202
203
238
239
240
275
276
277
307
308
309
374
375
376
441
442
443
446 SHZ_FORCE_INLINE
void fft(shz_complex_t* s, size_t size)
noexcept {
Namespace enclosing the SH4ZAM C++ API.
complex ctanf(const complex &c) noexcept
Returns the tangent of the given complex number.
complex ccscf(const complex &c) noexcept
Returns the cosecant of the given complex number.
float cargf(const complex &c) noexcept
Returns the phase angle of the given complex number.
complex cscalef(const complex &lhs, float v) noexcept
Multiplies lhs by the complex number created with v as its real component's value and no imaginary co...
complex cacosf(const complex &c) noexcept
Returns the arccosine of the given complex number.
complex csqrtf(const complex &c) noexcept
Returns the complex square root of the given complex number.
complex csechf(const complex &c) noexcept
Returns the hyperbolic secant of the given complex number.
bool operator!=(const complex &lhs, const complex &rhs) noexcept
Returns true if the two complex numbers are approximately inequal.
complex cexpf(const complex &c) noexcept
Returns the complex base e exponential of the given complex number.
complex operator/(const complex &lhs, const complex &rhs) noexcept
Divides lhs by rhs, returning the complex result.
complex conjf(const complex &c) noexcept
Returns the complex conjugate of the given complex number.
complex csecf(const complex &c) noexcept
Returns the secant of the given complex number.
complex clog10f(const complex &c) noexcept
Returns the complex base 10 logarithm of the given complex number.
complex cdivf(const complex &lhs, const complex &rhs) noexcept
Divides lhs by rhs, returning the complex result.
float cnormf(const complex &c) noexcept
Returns the squared magnitude of the given complex number.
complex casinhf(const complex &c) noexcept
Returns the hyperbolic arcsine of the given complex number.
complex cacoshf(const complex &c) noexcept
Returns the hyperbolic arccosine of the given complex number.
complex clogf(const complex &c) noexcept
returns the complex natural logarithm of the given complex number.
float inv_cabsf(const complex &c) noexcept
Returns the inverse absolute value or magnitude of the given complex number.
complex csubf(const complex &lhs, const complex &rhs) noexcept
Subtracts rhs from lhs, returning the complex result.
complex csinhf(const complex &c) noexcept
Returns the hyperbolic sine of the given complex number.
complex catanf(const complex &c) noexcept
Returns the arctangent of the given complex number.
complex cprojf(const complex &c) noexcept
Returns the projection of the complex number onto the Riemann sphere.
complex operator-(const complex &lhs, const complex &rhs) noexcept
Subtracts rhs from lhs, returning the complex result.
complex cacothf(const complex &c) noexcept
Returns the hyperbolic arccotangent of the given complex number.
complex casecf(const complex &c) noexcept
Returns the arcsecant of the given complex number.
complex ccosf(const complex &c) noexcept
Returns the cosine of the given complex number.
complex ccothf(const complex &c) noexcept
Returns the hyperbolic cotangent of the given complex number.
complex catanhf(const complex &c) noexcept
Returns the hyperbolic arctangent of the given complex number.
complex operator/(const complex &lhs, float rhs) noexcept
Divides lhs by a complex number with the real compoonent given as rhs and no imaginary component.
complex operator*(const complex &lhs, float rhs) noexcept
Multiplies lhs by a complex number with the real component given as rhs and no imaginary component.
complex caddf(const complex &lhs, const complex &rhs) noexcept
Adds the two complex numbers together, returning the complex result.
complex csinf(const complex &c) noexcept
Returns the sine of the given complex number.
float cabsf(const complex &c) noexcept
Returns the absolute value or magnitude of the given complex number.
complex cpolarf(float r, float theta) noexcept
Converts the given polar coordinates into a complex number.
float cimagf(const complex &c) noexcept
Returns the imaginary component of the given complex number.
complex cinitf(float real, float imag) noexcept
Returns a new complex number with the given components.
complex ccotf(const complex &c) noexcept
Returns the cotangent of the given complex number.
complex operator+(const complex &lhs, const complex &rhs) noexcept
Adds the two complex numbers, lhs and rhs, returning the result.
complex casechf(const complex &c) noexcept
Returns the hyperbolic arcsecant of the given complex number.
bool cequalf(const complex &lhs, const complex &rhs) noexcept
Checks for relative equality between lhs and rhs.
complex casinf(const complex &c) noexcept
Returns the arcsine of the given complex number.
complex cpowf(const complex &base, const complex &exp) noexcept
Raises a complex base to a complex power given by exp, returning a complex result.
complex ccschf(const complex &c) noexcept
Returns the hyperbolic cosecant of the given complex number.
float crealf(const complex &c) noexcept
Returns the real component of the given complex number.
complex crecipf(const complex &c) noexcept
Returns the multiplicative reciprocal of the given complex number.
complex cacscf(const complex &c) noexcept
Returns the arccosecant of the given complex number.
complex cacschf(const complex &c) noexcept
Returns the hyperbolic arccosecant of the given complex number.
complex ctanhf(const complex &c) noexcept
Returns the hyperbolic tangent of the given complex number.
complex operator*(const complex &lhs, const complex &rhs) noexcept
Multiplies lhs by rhs, returning the complex result.
complex cacotf(const complex &c) noexcept
Returns the arccotangent of the given complex number.
void fft(shz_complex_t *s, size_t size) noexcept
C++ wrapper around shz_fft(), which computes the FFT of the given buffer.
complex ccoshf(const complex &c) noexcept
Returns the hyperbolic cosine of the given complex number.
bool operator==(const complex &lhs, const complex &rhs) noexcept
Returns true if the two complex numbers are approximately equal.
complex cmulf(const complex &lhs, const complex &rhs) noexcept
Multiplies the two complex numbers together, returning the complex result.
float shz_inv_cabsf(shz_complex_t c) SHZ_NOEXCEPT
Returns the inverse of the absolute value (or inverse of the magnitude) of the complex number,...
shz_complex_t shz_cacoshf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic arccosine of c.
shz_complex_t shz_ccotf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex cotangent of c.
shz_complex_t shz_cmulf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Multiplies two complex numbers together, returning the complex result.
void shz_fft(shz_complex_t *s, size_t size) SHZ_NOEXCEPT
Fast Fourier Transform.
float shz_cimagf(shz_complex_t c) SHZ_NOEXCEPT
Returns the imaginary component of a complex number.
shz_complex_t shz_catanf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex arctangent of c.
shz_complex_t shz_casinf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex arcsine of c.
shz_complex_t shz_csinf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex sine of c.
shz_complex_t shz_csechf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic secant of c.
shz_complex_t shz_ccschf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic cosecant of c.
shz_complex_t shz_crecipf(shz_complex_t c) SHZ_NOEXCEPT
Returns the multiplicative inverse or reciprocal of the complex number, c.
float shz_cabsf(shz_complex_t c) SHZ_NOEXCEPT
Returns the absolute value (or magnitude) of the complex number, c.
shz_complex_t shz_cacothf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic arccotangent of c.
shz_complex_t shz_ctanf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex tangent of c.
shz_complex_t shz_cscalef(shz_complex_t c, float v) SHZ_NOEXCEPT
Scales both componets of the complex number, c, by the value, v, returning the result.
shz_complex_t shz_cprojf(shz_complex_t c) SHZ_NOEXCEPT
Calculates the projection of the complex number, c, onto the Riemann sphere.
shz_complex_t shz_cdivf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Divides lhs by rhs, returning the complex result.
shz_complex_t shz_csubf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Subtracts rhs from lhs and returns the complex result.
shz_complex_t shz_casechf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic arcsecant of c.
shz_complex_t shz_cacotf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex arccotangent of c.
shz_complex_t shz_csqrtf(shz_complex_t c) SHZ_NOEXCEPT
Computes and returns the complex square root of c.
shz_complex_t shz_casinhf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic arcsine of c.
bool shz_cequalf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Checks for equality between two complex numbers with either an absolute or relative tolerance.
float shz_cnormf(shz_complex_t c) SHZ_NOEXCEPT
Returns the squared magnitude of the complex number, c.
shz_complex_t shz_caddf(shz_complex_t lhs, shz_complex_t rhs) SHZ_NOEXCEPT
Adds two complex numbers together and returns the result.
shz_complex_t shz_casecf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex arcsecant of c.
shz_complex_t shz_clogf(shz_complex_t c) SHZ_NOEXCEPT
Computes and returns the complex natural logarithm of c.
float shz_crealf(shz_complex_t c) SHZ_NOEXCEPT
Returns the real component of a complex number.
shz_complex_t shz_csecf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex secant of c.
shz_complex_t shz_cpolarf(float r, float theta) SHZ_NOEXCEPT
Returns a complex number with a magnitude of r, and a phase angle of theta (in radians).
shz_complex_t shz_ccoshf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic cosine of c.
shz_complex_t shz_cexpf(shz_complex_t c) SHZ_NOEXCEPT
Returns the complex base e exponential of c.
shz_complex_t shz_cinitf(float real, float imag) SHZ_NOEXCEPT
Returns a complex number which has been initialized to contain the given component values.
shz_complex_t shz_conjf(shz_complex_t c) SHZ_NOEXCEPT
Returns the complex conjugate of c.
shz_complex_t shz_catanhf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic arctangent of c.
shz_complex_t shz_cpowf(shz_complex_t base, shz_complex_t exp) SHZ_NOEXCEPT
Raises the complex base to the complex exp power, returning a complex result.
shz_complex_t shz_cacschf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic arccosecant of c.
float shz_cargf(shz_complex_t c) SHZ_NOEXCEPT
Returns the phase angle of the complex number, c.
shz_complex_t shz_ccosf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex cosine of c.
shz_complex_t shz_ctanhf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic tangent of c.
shz_complex_t shz_cacosf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex arccosine of c.
shz_complex_t shz_csinhf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic sine of c.
shz_complex_t shz_clog10f(shz_complex_t c) SHZ_NOEXCEPT
Computes and returns the complex base 10 logarithm of c.
shz_complex_t shz_ccothf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex hyperbolic cotangent of c.
shz_complex_t shz_cacscf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex arccosecant of c.
shz_complex_t shz_ccscf(shz_complex_t c) SHZ_NOEXCEPT
Calculates and returns the complex cosecant of c.
float shz_invf(float x) SHZ_NOEXCEPT
Takes the inverse of x using a slighty faster approximation than doing a full division,...
C++ wrapper around a floating-point complex number, real/imaginary pair.
complex & operator*=(float scale) noexcept
Multiplies and accumulates the given complex number by scalar.
complex(const volatile shz_complex_t &cplx) noexcept
Converting constructor for initialization from a volatile value type.
complex & operator/=(const complex &rhs) noexcept
Divides the given complex number by rhs, assigning it to the result.
complex(const complex &rhs) noexcept=default
Default copy constructor.
complex & operator+=(const complex &rhs) noexcept
Adds and accumulates rhs onto the given complex number.
complex(float re, float im=0.0f) noexcept
Value constructor, sets the imaginary component to 0 if none is supplied.
complex(const shz_complex_t &cplx) noexcept
Converting constructor for initializing from the C base type.
complex & operator*=(const complex &rhs) noexcept
Multiplies and accumulates rhs by the given complex number.
complex() noexcept=default
Default constructor.
complex & operator-=(const complex &rhs) noexcept
Subtracts rhs from the given complex number, assigning it to the result.
float real
The real portion of the complex number.
float imag
The imaginary portion of the complex number.