T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
Floating point based Operations

Description

Operations that are based on floating point arithmetic, but can be applied to arbitrary input and output types.

These functions take an input of arbitrary type, convert it to a floating point type, perform an operation in floating point arithmetic, and convert the result to an output of arbitrary type.

Similar to convert(), if the input and output types are of the same size, both the inputs and outputs consist of one Vec. If the types are of different sizes, the input or output consists of multiple Vec's, such that the number of input elements is equal to the number of output elements.

Typedefs

template<typename Tout , typename Tin >
using simd::BigEnoughFloat
 Smallest floating point type that is at least as big as the input and output types.
 

Functions

template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::faddmul (const Vec< Tin, SIMD_WIDTH > vecsIn[numInVecs< Tout, Tin >()], dont_deduce< Tfloat > off, dont_deduce< Tfloat > fac, Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()])
 Adds a floating point constant to the elements of Vec's, then multiplies with a floating point constant in floating point arithmetic.
 
template<size_t DIM, size_t NVEC, typename Tout , typename Tin , size_t SIMD_WIDTH>
static void simd::fdivMsigmoidmul (const Vec< Tin, SIMD_WIDTH > vecsNum[DIM][NVEC], const Vec< Tin, SIMD_WIDTH > vecsDenom[DIM][NVEC], const double w[DIM], const double w0[DIM], double fac, Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()])
 Special function used in MinWarping.
 
template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fdivmul (const Vec< Tin, SIMD_WIDTH > vecsNum[numInVecs< Tout, Tin >()], const Vec< Tin, SIMD_WIDTH > vecsDenom[numInVecs< Tout, Tin >()], dont_deduce< Tfloat > fac, Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()])
 Divides Vec's element-wise, then multiplies with a constant factor in floating point arithmetic.
 
template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fmul (const Vec< Tin, SIMD_WIDTH > vecsIn[numInVecs< Tout, Tin >()], dont_deduce< Tfloat > fac, Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()])
 Multiplies Vec's element-wise with a floating point constant in floating point arithmetic.
 
template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fmuladd (const Vec< Tin, SIMD_WIDTH > vecsIn[numInVecs< Tout, Tin >()], dont_deduce< Tfloat > fac, dont_deduce< Tfloat > off, Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()])
 Multiplies the elements of Vec's with a floating point constant, then adds a floating point constant in floating point arithmetic.
 
template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fwaddmul (const Vec< Tin, SIMD_WIDTH > vecsIn1[numInVecs< Tout, Tin >()], const Vec< Tin, SIMD_WIDTH > vecsIn2[numInVecs< Tout, Tin >()], dont_deduce< Tfloat > w, dont_deduce< Tfloat > fac, Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()])
 Linearly interpolates Vec's element-wise with a constant weight and then scales by a constant factor in floating point arithmetic.
 

Typedef Documentation

◆ BigEnoughFloat

template<typename Tout , typename Tin >
using simd::BigEnoughFloat

Smallest floating point type that is at least as big as the input and output types.

Template Parameters
Toutoutput type
Tininput type

Function Documentation

◆ faddmul()

template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::faddmul ( const Vec< Tin, SIMD_WIDTH > vecsIn[numInVecs< Tout, Tin >()],
dont_deduce< Tfloat > off,
dont_deduce< Tfloat > fac,
Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()] )
inlinestatic

Adds a floating point constant to the elements of Vec's, then multiplies with a floating point constant in floating point arithmetic.

Template Parameters
Tfloatthe floating point type to perform the calculation in. Defaults to BigEnoughFloat<Tout, Tin>
Parameters
[in]vecsIninput Vec's
offfloat constant to add
facfloat constant to multiply with
[out]vecsOutoutput Vec's

◆ fdivMsigmoidmul()

template<size_t DIM, size_t NVEC, typename Tout , typename Tin , size_t SIMD_WIDTH>
static void simd::fdivMsigmoidmul ( const Vec< Tin, SIMD_WIDTH > vecsNum[DIM][NVEC],
const Vec< Tin, SIMD_WIDTH > vecsDenom[DIM][NVEC],
const double w[DIM],
const double w0[DIM],
double fac,
Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()] )
inlinestatic

Special function used in MinWarping.

Parameters
[in]vecsNumNumerator vectors.
[in]vecsDenomDenominator vectors.
[in]wWeights.
[in]w0Weights.
facFactor.
[out]vecsOutOutput vectors.

◆ fdivmul()

template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fdivmul ( const Vec< Tin, SIMD_WIDTH > vecsNum[numInVecs< Tout, Tin >()],
const Vec< Tin, SIMD_WIDTH > vecsDenom[numInVecs< Tout, Tin >()],
dont_deduce< Tfloat > fac,
Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()] )
inlinestatic

Divides Vec's element-wise, then multiplies with a constant factor in floating point arithmetic.

Template Parameters
Tfloatthe floating point type to perform the calculation in. Defaults to BigEnoughFloat<Tout, Tin>
Parameters
[in]vecsNumnumerator Vec's
[in]vecsDenomdenominator Vec's
facfactor to multiply with
[out]vecsOutoutput Vec's
See also
numInVecs(), numOutVecs()

◆ fmul()

template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fmul ( const Vec< Tin, SIMD_WIDTH > vecsIn[numInVecs< Tout, Tin >()],
dont_deduce< Tfloat > fac,
Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()] )
inlinestatic

Multiplies Vec's element-wise with a floating point constant in floating point arithmetic.

Template Parameters
Tfloatthe floating point type to perform the calculation in. Defaults to BigEnoughFloat<Tout, Tin>
Parameters
[in]vecsIninput Vec's
facfactor
[out]vecsOutoutput Vec's

◆ fmuladd()

template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fmuladd ( const Vec< Tin, SIMD_WIDTH > vecsIn[numInVecs< Tout, Tin >()],
dont_deduce< Tfloat > fac,
dont_deduce< Tfloat > off,
Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()] )
inlinestatic

Multiplies the elements of Vec's with a floating point constant, then adds a floating point constant in floating point arithmetic.

Template Parameters
Tfloatthe floating point type to perform the calculation in. Defaults to BigEnoughFloat<Tout, Tin>
Parameters
[in]vecsIninput Vec's
facfloat constant to multiply with
offfloat constant to add
[out]vecsOutoutput Vec's

◆ fwaddmul()

template<typename Tout , typename Tin , typename Tfloat = BigEnoughFloat<Tout, Tin>, size_t SIMD_WIDTH>
static void simd::fwaddmul ( const Vec< Tin, SIMD_WIDTH > vecsIn1[numInVecs< Tout, Tin >()],
const Vec< Tin, SIMD_WIDTH > vecsIn2[numInVecs< Tout, Tin >()],
dont_deduce< Tfloat > w,
dont_deduce< Tfloat > fac,
Vec< Tout, SIMD_WIDTH > vecsOut[numOutVecs< Tout, Tin >()] )
inlinestatic

Linearly interpolates Vec's element-wise with a constant weight and then scales by a constant factor in floating point arithmetic.

The result is calculated as: out = fac * (w * v1 + (1 - w) * v2) (implemented as out = fac * (v2 + w * (v1 - v2))).

Template Parameters
Tfloatthe floating point type to perform the calculation in. Defaults to BigEnoughFloat<Tout, Tin>
Parameters
[in]vecsIn1first input Vec's
[in]vecsIn2second input Vec's
winterpolation weight
facscaling factor
[out]vecsOutoutput Vec's