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#L215
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#L218
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#L221
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
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#L302
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#L294
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#L326
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#L318
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 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; }
KFR_MEM_INTRINSIC constexpr bool operator==(const complex& other) const CMT_NOEXCEPT
{
return re == other.re && im == other.im;
}
KFR_MEM_INTRINSIC constexpr bool operator!=(const complex& other) const CMT_NOEXCEPT
{
return !operator==(other);
}
private:
T re;
T im;
}
https://github.com/kfrlib/kfr/blob//include/kfr/simd/complex_type.hpp#L50
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#L310
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#L408
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#L415
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#L334
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#L423
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#L432
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#L380
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#L387
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#L394
Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/