basic_math¶
select function (generic::select)¶
template <
    numeric T1, size_t N, numeric T2, numeric T3,
    typename Tout = subtype<std::common_type_t<T2, T3>>>
vec<Tout, N> select(const mask<T1, N> &m, const T2 &x,
                    const T3 &y)
Returns x if m is true, otherwise return y. Order of the arguments is same as in ternary operator.
return m ? x : y
min function (generic::min)¶
template <numeric T1, numeric T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout min(const T1 &x, const T2 &y)
Returns the smaller of two values.
max function (generic::max)¶
template <numeric T1, numeric T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout max(const T1 &x, const T2 &y)
Returns the greater of two values.
absmin function (generic::absmin)¶
template <numeric T1, numeric T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout absmin(const T1 &x, const T2 &y)
Returns the smaller in magnitude of two values.
absmax function (generic::absmax)¶
template <numeric T1, numeric T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout absmax(const T1 &x, const T2 &y)
Returns the greater in magnitude of two values.
abs function (generic::abs)¶
template <numeric T1> T1 abs(const T1 &x)
Returns the absolute value of x. @remarks Supports integer and floating-point numbers, scalars, and vec<>.
bitwisenot function (generic::bitwisenot)¶
template <typename T1> T1 bitwisenot(const T1 &x)
Bitwise Not
bitwisenot class (generic::fn::bitwisenot)¶
bitwisenot
bitwiseand function (generic::bitwiseand)¶
template <typename T1, typename T2>
std::common_type_t<T1, T2> bitwiseand(const T1 &x,
                                      const T2 &y)
Bitwise And
bitwiseand class (generic::fn::bitwiseand)¶
bitwiseand
bitwiseandnot function (generic::bitwiseandnot)¶
template <typename T1, typename T2>
std::common_type_t<T1, T2> bitwiseandnot(const T1 &x,
                                         const T2 &y)
Bitwise And-Not
bitwiseandnot class (generic::fn::bitwiseandnot)¶
bitwiseandnot
bitwiseor function (generic::bitwiseor)¶
template <typename T1, typename T2>
std::common_type_t<T1, T2> bitwiseor(const T1 &x,
                                     const T2 &y)
Bitwise Or
bitwiseor class (generic::fn::bitwiseor)¶
bitwiseor
bitwisexor function (generic::bitwisexor)¶
template <typename T1, typename T2>
std::common_type_t<T1, T2> bitwisexor(const T1 &x,
                                      const T2 &y)
Bitwise Xor (Exclusive Or)
bitwisexor class (generic::fn::bitwisexor)¶
bitwisexor
shl function (generic::shl)¶
template <typename T1, typename T2>
T1 shl(const T1 &left, const T2 &right)
Bitwise Left shift
shl class (generic::fn::shl)¶
shl
shr function (generic::shr)¶
template <typename T1, typename T2>
T1 shr(const T1 &left, const T2 &right)
Bitwise Right shift
shr class (generic::fn::shr)¶
shr
rol function (generic::rol)¶
template <typename T1, typename T2>
T1 rol(const T1 &left, const T2 &right)
Bitwise Left Rotate
rol class (generic::fn::rol)¶
rol
ror function (generic::ror)¶
template <typename T1, typename T2>
T1 ror(const T1 &left, const T2 &right)
Bitwise Right Rotate
ror class (generic::fn::ror)¶
ror
add function (generic::add)¶
template <numeric T1, numeric T2, numeric... Ts>
constexpr std::common_type_t<T1, T2, Ts...>
add(const T1 &x, const T2 &y, const Ts &...rest)
Returns sum of all the arguments passed to a function.
add class (generic::fn::add)¶
add
sub class (generic::fn::sub)¶
sub
mul function (generic::mul)¶
template <typename T1, typename T2, typename... Ts>
constexpr std::common_type_t<T1, T2, Ts...>
mul(const T1 &x, const T2 &y, const Ts &...rest)
Returns product of all the arguments passed to a function.
mul class (generic::fn::mul)¶
mul
sqr function (generic::sqr)¶
template <numeric T1> constexpr inline T1 sqr(const T1 &x)
Returns square of x.
sqr class (generic::fn::sqr)¶
sqr
cub function (generic::cub)¶
template <numeric T1> constexpr inline T1 cub(const T1 &x)
Returns cube of x.
cub class (generic::fn::cub)¶
cub
pow2 class (generic::fn::pow2)¶
pow2
pow3 class (generic::fn::pow3)¶
pow3
pow4 class (generic::fn::pow4)¶
pow4
pow5 class (generic::fn::pow5)¶
pow5
ipow function (generic::ipow)¶
template <typename T>
constexpr inline T ipow(const T &x, int base)
Raise x to the power base \(x^{base}\)
CHECK( ipow( 10, 3 ) == 1000 );
CHECK( ipow( 0.5, 2 ) == 0.25 );
ipow class (generic::fn::ipow)¶
ipow
sqrsum function (generic::sqrsum)¶
template <typename T1, typename... Ts>
constexpr inline std::common_type_t<T1, Ts...>
sqrsum(const T1 &x, const Ts &...rest)
Return square of the sum of all arguments
CHECK(sqrsum(1,2,3) == 36);
sqrsum class (generic::fn::sqrsum)¶
sqrsum
sqrdiff class (generic::fn::sqrdiff)¶
sqrdiff
div function (generic::div)¶
template <typename T1, typename T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout div(const T1 &x, const T2 &y)
Division
div class (generic::fn::div)¶
div
mod function (generic::mod)¶
template <typename T1, typename T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout mod(const T1 &x, const T2 &y)
Modulo
mod class (generic::fn::mod)¶
mod
rem function (generic::rem)¶
template <typename T1, typename T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout rem(const T1 &x, const T2 &y)
Remainder
rem class (generic::fn::rem)¶
rem
neg function (generic::neg)¶
template <typename T1> inline T1 neg(const T1 &x)
Negation
neg class (generic::fn::neg)¶
neg
fmadd function (generic::fmadd)¶
template <typename T1, typename T2, typename T3>
constexpr std::common_type_t<T1, T2, T3>
fmadd(const T1 &x, const T2 &y, const T3 &z)
Fused Multiply-Add
fmsub function (generic::fmsub)¶
template <typename T1, typename T2, typename T3>
constexpr std::common_type_t<T1, T2, T3>
fmsub(const T1 &x, const T2 &y, const T3 &z)
Fused Multiply-Sub
fmadd class (generic::fn::fmadd)¶
fmadd
fmsub class (generic::fn::fmsub)¶
fmsub
mix function (generic::mix)¶
template <numeric T1, numeric T2, numeric T3>
constexpr std::common_type_t<T1, T2, T3>
mix(const T1 &c, const T2 &x, const T3 &y)
Linear blend of x and y (c must be in the range 0...+1)
Returns x + ( y - x ) * c
mixs function (generic::mixs)¶
template <numeric T1, numeric T2, numeric T3>
constexpr std::common_type_t<T1, T2, T3>
mixs(const T1 &c, const T2 &x, const T3 &y)
Linear blend of x and y (c must be in the range -1...+1)
mix class (generic::fn::mix)¶
mix
mixs class (generic::fn::mixs)¶
mixs
horner function (generic::horner)¶
template <numeric T1, numeric... Ts>
constexpr std::common_type_t<T1, Ts...>
horner(const T1 &x, const Ts &...c)
Calculate polynomial using Horner's method
horner(x, 1, 2, 3) is equivalent to \(3x^2 + 2x + 1\)
horner class (generic::fn::horner)¶
horner
horner_even function (generic::horner_even)¶
template <numeric T1, numeric... Ts>
constexpr std::common_type_t<T1, Ts...>
horner_even(const T1 &x, const Ts &...c)
Calculate polynomial using Horner's method (even powers)
horner_even(x, 1, 2, 3) is equivalent to \(3x^4 + 2x^2 + 1\)
horner_even class (generic::fn::horner_even)¶
horner_even
horner_odd function (generic::horner_odd)¶
template <numeric T1, numeric... Ts>
constexpr std::common_type_t<T1, Ts...>
horner_odd(const T1 &x, const Ts &...c)
Calculate polynomial using Horner's method (odd powers)
horner_odd(x, 1, 2, 3) is equivalent to \(3x^5 + 2x^3 + 1x\)
horner_odd class (generic::fn::horner_odd)¶
horner_odd
reciprocal function (generic::reciprocal)¶
template <typename T> constexpr T reciprocal(const T &x)
Calculate Multiplicative Inverse of x
Returns 1/x
reciprocal class (generic::fn::reciprocal)¶
reciprocal
mulsign class (generic::fn::mulsign)¶
mulsign
swapbyteorder function (generic::swapbyteorder)¶
template <typename T> T swapbyteorder(const T &x)
Swap byte order
swapbyteorder class (generic::fn::swapbyteorder)¶
swapbyteorder
subadd class (generic::fn::subadd)¶
subadd
addsub class (generic::fn::addsub)¶
addsub
packtranspose class (generic::fn::packtranspose)¶
packtranspose
clamp function (generic::clamp)¶
template <numeric T1, numeric T2, numeric T3,
          typename Tout = std::common_type_t<T1, T2, T3>>
Tout clamp(const T1 &x, const T2 &lo, const T3 &hi)
Returns the first argument clamped to a range [lo, hi] @remarks Supports integer and floating-point numbers, scalars, and vec<>.
template <numeric T1, numeric T2,
          typename Tout = std::common_type_t<T1, T2>>
Tout clamp(const T1 &x, const T2 &hi)
Returns the first argument clamped to a range [0, hi] @remarks Supports integer and floating-point numbers, scalars, and vec<>.
sqrt function (generic::sqrt)¶
template <numeric T1> flt_type<T1> sqrt(const T1 &x)
Returns the positive square root of the x. \(\sqrt{x}\)
Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/