Skip to content

Complex functions

c32 typedef

c32 = complex<f32>

Alias for complex

Source code
using c32 = complex<f32>

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L65

c64 typedef

c64 = complex<f64>

Alias for complex

Source code
using c64 = complex<f64>

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L68

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION realtype<T1> cabs(const T1& x)
{
    return intrinsics::cabs(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L256

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION realtype<T1> cabssqr(const T1& x)
{
    return intrinsics::cabssqr(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L249

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION realtype<T1> carg(const T1& x)
{
    return intrinsics::carg(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L263

cartesian function

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

Converts complex number to cartesian

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 cartesian(const T1& x)
{
    return intrinsics::cartesian(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L319

cbase typedef

cbase = complex<fbase>

Alias for complex

Source code
using cbase = complex<fbase>

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L71

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_INTRINSIC T1 cconj(const T1& x)
{
    return intrinsics::cconj(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L302

ccos function

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

Returns the cosine of the complex number x

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 ccos(const T1& x)
{
    return intrinsics::ccos(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L235

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 ccosh(const T1& x)
{
    return intrinsics::ccosh(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L242

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

Source code
template <typename T, size_t N>
KFR_INTRINSIC vec<complex<T>, N> cdupimag(const vec<complex<T>, N>& x)
{
    return ccomp(dupodd(cdecom(x)));
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L152

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

Source code
template <typename T, size_t N>
KFR_INTRINSIC vec<complex<T>, N> cdupreal(const vec<complex<T>, N>& x)
{
    return ccomp(dupeven(cdecom(x)));
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L144

cexp function

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

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 cexp(const T1& x)
{
    return intrinsics::cexp(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L291

cexp10 function

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

Returns 10 raised to the complex number x

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 cexp10(const T1& x)
{
    return intrinsics::cexp10(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L305

cexp2 function

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

Returns 2 raised to the complex number x

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 cexp2(const T1& x)
{
    return intrinsics::cexp2(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L298

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 clog(const T1& x)
{
    return intrinsics::clog(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L270

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 clog10(const T1& x)
{
    return intrinsics::clog10(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L284

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 clog2(const T1& x)
{
    return intrinsics::clog2(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L277

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

Source code
template <typename T, size_t N>
KFR_INTRINSIC vec<complex<T>, N> cnegimag(const vec<complex<T>, N>& x)
{
    return x ^ complex<T>(T(), -T());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L176

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

Source code
template <typename T, size_t N>
KFR_INTRINSIC vec<complex<T>, N> cnegreal(const vec<complex<T>, N>& x)
{
    return x ^ complex<T>(-T(), T());
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L168

csin function

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

Returns the sine of the complex number x

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 csin(const T1& x)
{
    return intrinsics::csin(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L221

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

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 csinh(const T1& x)
{
    return intrinsics::csinh(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L228

csqr function

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

Returns square of the complex number x

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 csqr(const T1& x)
{
    return intrinsics::csqr(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L333

csqrt function

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

Returns square root of the complex number x

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 csqrt(const T1& x)
{
    return intrinsics::csqrt(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L326

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

Source code
template <typename T, size_t N>
KFR_INTRINSIC vec<complex<T>, N> cswapreim(const vec<complex<T>, N>& x)
{
    return ccomp(swap<2>(cdecom(x)));
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L160

imag function

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

Returns the imaginary part of the complex value

Source code
template <typename T>
constexpr KFR_INTRINSIC T imag(const complex<T>& value)
{
    return value.imag();
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L258

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

Source code
template <typename T, size_t N>
constexpr KFR_INTRINSIC vec<T, N> imag(const vec<complex<T>, N>& value)
{
    return odd(cdecom(value));
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L265

isreal function

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

Returns mask with true for real elements

Source code
template <typename T>
KFR_INTRINSIC bool isreal(const complex<T>& x)
{
    return x.imag() == 0;
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L184

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

Source code
template <typename T1, typename T2 = T1, size_t N, typename T = std::common_type_t<T1, T2>>
constexpr KFR_INTRINSIC vec<complex<T>, N> make_complex(const vec<T1, N>& real,
                                                        const vec<T2, N>& imag = T2(0))
{
    return ccomp(interleave(promoteto<T>(real), promoteto<T>(imag)));
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L273

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

Source code
template <typename T1, typename T2 = T1, typename T = std::common_type_t<T1, T2>,
          KFR_ENABLE_IF(is_numeric_args<T1, T2>)>
constexpr KFR_INTRINSIC complex<T> make_complex(T1 real, T2 imag = T2(0))
{
    return complex<T>(promoteto<T>(real), promoteto<T>(imag));
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L282

polar function

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

Converts complex number to polar

Source code
template <typename T1, KFR_ENABLE_IF(is_numeric<T1>)>
KFR_FUNCTION T1 polar(const T1& x)
{
    return intrinsics::polar(x);
}

https://github.com/kfrlib/kfr/blob//include/kfr/math/complex_math.hpp#L312

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

Source code
template <typename T, KFR_ENABLE_IF(is_numeric<T>)>
constexpr KFR_INTRINSIC T real(const T& value)
{
    return value;
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L230

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

Returns the real part of the complex value

Source code
template <typename T>
constexpr KFR_INTRINSIC T real(const complex<T>& value)
{
    return value.real();
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L237

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

Source code
template <typename T, size_t N>
constexpr KFR_INTRINSIC vec<T, N> real(const vec<complex<T>, N>& value)
{
    return even(cdecom(value));
}

https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex.hpp#L244


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