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#L194

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#L197

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#L292

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::cabs, E1> cabs(E1 &&x)

Returns template expression that returns the absolute value (magnitude) of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::cabs, E1> cabs(E1&& x)
{
    return { fn::cabs(), std::forward<E1>(x) };
}

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

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#L277

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::cabssqr, E1>
cabssqr(E1 &&x)

Returns template expression that returns the squared absolute value (magnitude squared) of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::cabssqr, E1> cabssqr(E1&& x)
{
    return { fn::cabssqr(), std::forward<E1>(x) };
}

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

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#L306

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::carg, E1> carg(E1 &&x)

Returns template expression that returns the phase angle (argument) of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::carg, E1> carg(E1&& x)
{
    return { fn::carg(), std::forward<E1>(x) };
}

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

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#L418

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::cartesian, E1>
cartesian(E1 &&x)

Returns template expression that converts complex number to cartesian

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::cartesian, E1> cartesian(E1&& x)
{
    return { fn::cartesian(), std::forward<E1>(x) };
}

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

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#L200

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#L452

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::cconj, E1> cconj(E1 &&x)

Returns template expression that returns the complex conjugate of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::cconj, E1> cconj(E1&& x)
{
    return { fn::cconj(), std::forward<E1>(x) };
}

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

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#L249

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::ccos, E1> ccos(E1 &&x)

Returns template expression that returns the cosine of the the complex value x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::ccos, E1> ccos(E1&& x)
{
    return { fn::ccos(), std::forward<E1>(x) };
}

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

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#L263

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::ccosh, E1> ccosh(E1 &&x)

Returns template expression that returns the hyperbolic cosine of the the complex value x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::ccosh, E1> ccosh(E1&& x)
{
    return { fn::ccosh(), std::forward<E1>(x) };
}

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

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#L281

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#L273

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#L362

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::cexp, E1> cexp(E1 &&x)

Returns template expression that returns \(e\) raised to the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::cexp, E1> cexp(E1&& x)
{
    return { fn::cexp(), std::forward<E1>(x) };
}

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

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#L390

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::cexp10, E1> cexp10(E1 &&x)

Returns template expression that returns 10 raised to the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::cexp10, E1> cexp10(E1&& x)
{
    return { fn::cexp10(), std::forward<E1>(x) };
}

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

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#L376

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::cexp2, E1> cexp2(E1 &&x)

Returns template expression that returns 2 raised to the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::cexp2, E1> cexp2(E1&& x)
{
    return { fn::cexp2(), std::forward<E1>(x) };
}

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

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#L320

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::clog, E1> clog(E1 &&x)

Returns template expression that returns the natural logarithm of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::clog, E1> clog(E1&& x)
{
    return { fn::clog(), std::forward<E1>(x) };
}

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

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#L348

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::clog10, E1> clog10(E1 &&x)

Returns template expression that returns the common (base-10) logarithm of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::clog10, E1> clog10(E1&& x)
{
    return { fn::clog10(), std::forward<E1>(x) };
}

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

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#L334

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::clog2, E1> clog2(E1 &&x)

Returns template expression that returns the binary (base-2) logarithm of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::clog2, E1> clog2(E1&& x)
{
    return { fn::clog2(), std::forward<E1>(x) };
}

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

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#L305

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#L297

complex

complex class

template <typename T> complex

Represents the complex numbers. If KFR_STD_COMPLEX is defined, then kfr::complex is an alias for std::complex.

Source code
template <typename T>
struct complex
{
    static_assert(is_simd_type<T>, "Incorrect type for complex");
    constexpr static bool is_pod     = true;
    constexpr complex() CMT_NOEXCEPT = default;
    KFR_MEM_INTRINSIC constexpr complex(T re) CMT_NOEXCEPT : re(re), im(0) {}
    KFR_MEM_INTRINSIC constexpr complex(T re, T im) CMT_NOEXCEPT : re(re), im(im) {}
    constexpr complex(const complex&) CMT_NOEXCEPT = default;
    constexpr complex(complex&&) CMT_NOEXCEPT      = default;
    template <typename U>
    KFR_MEM_INTRINSIC constexpr complex(const complex<U>& other) CMT_NOEXCEPT : re(static_cast<T>(other.real())),
                                                                                im(static_cast<T>(other.imag()))
    {
    }
    template <typename U>
    KFR_MEM_INTRINSIC constexpr complex(complex<U>&& other) CMT_NOEXCEPT : re(std::move(other.real())),
                                                                           im(std::move(other.imag()))
    {
    }
#ifdef CMT_COMPILER_GNU
    constexpr complex& operator=(const complex&) CMT_NOEXCEPT = default;
    constexpr complex& operator=(complex&&) CMT_NOEXCEPT = default;
#else
    complex& operator=(const complex&) = default;
    complex& operator=(complex&&) = default;
#endif
    KFR_MEM_INTRINSIC constexpr const T& real() const CMT_NOEXCEPT { return re; }
    KFR_MEM_INTRINSIC constexpr const T& imag() const CMT_NOEXCEPT { return im; }
    KFR_MEM_INTRINSIC constexpr void real(T value) CMT_NOEXCEPT { re = value; }
    KFR_MEM_INTRINSIC constexpr void imag(T value) CMT_NOEXCEPT { im = value; }
private:
    T re;
    T im;
}

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

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

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::csin, E1> csin(E1 &&x)

Returns template expression that returns the sine of the the complex value x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::csin, E1> csin(E1&& x)
{
    return { fn::csin(), std::forward<E1>(x) };
}

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

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#L235

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::csinh, E1> csinh(E1 &&x)

Returns template expression that returns the hyperbolic sine of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::csinh, E1> csinh(E1&& x)
{
    return { fn::csinh(), std::forward<E1>(x) };
}

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

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#L446

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::csqr, E1> csqr(E1 &&x)

Returns template expression that returns square of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::csqr, E1> csqr(E1&& x)
{
    return { fn::csqr(), std::forward<E1>(x) };
}

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

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#L432

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::csqrt, E1> csqrt(E1 &&x)

Returns template expression that returns square root of the complex number x

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::csqrt, E1> csqrt(E1&& x)
{
    return { fn::csqrt(), std::forward<E1>(x) };
}

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

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#L289

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#L394

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#L401

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::imag, E1> imag(E1 &&x)

Returns the imaginary part of the complex value

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_INTRINSIC internal::expression_function<fn::imag, E1> imag(E1&& x)
{
    return { fn::imag{}, std::forward<E1>(x) };
}

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

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#L313

make_complex function

template <typename T1, typename T2 = T1, size_t N,
          typename T = common_type<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 = common_type<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(innercast<T>(real), innercast<T>(imag)));
}

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

template <typename T1, typename T2 = T1,
          typename T = common_type<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 = common_type<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>(innercast<T>(real), innercast<T>(imag));
}

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

template <typename E1, typename E2,
          KFR_ENABLE_IF(is_input_expressions<E1, E2>)>
internal::expression_function<fn::make_complex, E1, E2>
make_complex(E1 &&re, E2 &&im)

Constructs complex value from real and imaginary parts

Source code
template <typename E1, typename E2, KFR_ENABLE_IF(is_input_expressions<E1, E2>)>
KFR_INTRINSIC internal::expression_function<fn::make_complex, E1, E2> make_complex(E1&& re, E2&& im)
{
    return { fn::make_complex{}, std::forward<E1>(re), std::forward<E2>(im) };
}

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

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#L404

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::polar, E1> polar(E1 &&x)

Returns template expression that converts complex number to polar

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_FUNCTION internal::expression_function<fn::polar, E1> polar(E1&& x)
{
    return { fn::polar(), std::forward<E1>(x) };
}

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

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#L359

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#L366

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#L373

template <typename E1,
          KFR_ENABLE_IF(is_input_expression<E1>)>
internal::expression_function<fn::real, E1> real(E1 &&x)

Returns the real part of the complex value

Source code
template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>)>
KFR_INTRINSIC internal::expression_function<fn::real, E1> real(E1&& x)
{
    return { fn::real{}, std::forward<E1>(x) };
}

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


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