Skip to content

Complex functions


c32 typedef

c32 = complex<f32>

Alias for complex<f32>


c64 typedef

c64 = complex<f64>

Alias for complex<f64>


cabs function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
realtype<T1> cabs(const T1 &x)

Returns the absolute value (magnitude) of the complex number x


cabssqr function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
realtype<T1> cabssqr(const T1 &x)

Returns the squared absolute value (magnitude squared) of the complex number x


carg function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
realtype<T1> carg(const T1 &x)

Returns the phase angle (argument) of the complex number x


cartesian function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 cartesian(const T1 &x)

Converts complex number to cartesian


cbase typedef

cbase = complex<fbase>

Alias for complex<fbase>


cconj function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 cconj(const T1 &x)

Returns the complex conjugate of the complex number x


ccos function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 ccos(const T1 &x)

Returns the cosine of the complex number x


ccosh function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 ccosh(const T1 &x)

Returns the hyperbolic cosine of the complex number x


cdupimag function

template <typename T, size_t N>
vec<complex<T>, N> cdupimag(const vec<complex<T>, N> &x)

Returns vector of complex values with imaginary part duplicated


cdupreal function

template <typename T, size_t N>
vec<complex<T>, N> cdupreal(const vec<complex<T>, N> &x)

Returns vector of complex values with real part duplicated


cexp function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 cexp(const T1 &x)

Returns \(e\) raised to the complex number x


cexp10 function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 cexp10(const T1 &x)

Returns 10 raised to the complex number x


cexp2 function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 cexp2(const T1 &x)

Returns 2 raised to the complex number x


clog function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 clog(const T1 &x)

Returns the natural logarithm of the complex number x


clog10 function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 clog10(const T1 &x)

Returns the common (base-10) logarithm of the complex number x


clog2 function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 clog2(const T1 &x)

Returns the binary (base-2) logarithm of the complex number x


cnegimag function

template <typename T, size_t N>
vec<complex<T>, N> cnegimag(const vec<complex<T>, N> &x)

Returns vector of complex values with imaginary part negated


cnegreal function

template <typename T, size_t N>
vec<complex<T>, N> cnegreal(const vec<complex<T>, N> &x)

Returns vector of complex values with real part negated


csin function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 csin(const T1 &x)

Returns the sine of the complex number x


csinh function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 csinh(const T1 &x)

Returns the hyperbolic sine of the complex number x


csqr function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 csqr(const T1 &x)

Returns square of the complex number x


csqrt function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 csqrt(const T1 &x)

Returns square root of the complex number x


cswapreim function

template <typename T, size_t N>
vec<complex<T>, N> cswapreim(const vec<complex<T>, N> &x)

Returns vector of complex values with real and imaginary parts swapped


imag function

template <typename T>
constexpr T imag(const complex<T> &value)

Returns the imaginary part of the complex value


template <typename T, size_t N>
constexpr vec<T, N> imag(const vec<complex<T>, N> &value)

Returns the imaginary part of the complex value


isreal function

template <typename T> bool isreal(const complex<T> &x)

Returns mask with true for real elements


make_complex function

template <typename T1, typename T2 = T1, size_t N,
          typename T = std::common_type_t<T1, T2>>
constexpr vec<complex<T>, N>
make_complex(const vec<T1, N> &real,
             const vec<T2, N> &imag = T2(0))

Constructs complex value from real and imaginary parts


template <typename T1, typename T2 = T1,
          typename T = std::common_type_t<T1, T2>,
          KFR_ENABLE_IF(is_numeric_args<T1, T2>)>
constexpr complex<T> make_complex(T1 real, T2 imag = T2(0))

Constructs complex value from real and imaginary parts


polar function

template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
T1 polar(const T1 &x)

Converts complex number to polar


real function

template <typename T, KFR_ENABLE_IF(is_numeric<T>)>
constexpr T real(const T &value)

Returns the real part of the complex value


template <typename T>
constexpr T real(const complex<T> &value)

Returns the real part of the complex value


template <typename T, size_t N>
constexpr vec<T, N> real(const vec<complex<T>, N> &value)

Returns the real part of the complex value


Auto-generated from sources, Revision 6aea976a464de59d522d0c629e64bf0c044e6777, https://github.com/kfrlib/kfr/blob/6aea976a464de59d522d0c629e64bf0c044e6777/include/kfr/