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

Description

Mathematical operations on Vec's, such as min, max, rounding, etc.

See also
Masked Mathematical Operations

Functions

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::abs (const Vec< T, SIMD_WIDTH > &a)
 Computes the absolute value of the elements of a Vec.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::ceil (const Vec< T, SIMD_WIDTH > &a)
 Rounds the elements of a Vec up to the nearest integer.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::floor (const Vec< T, SIMD_WIDTH > &a)
 Rounds the elements of a Vec down to the nearest integer.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::max (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Computes the maximum of the elements of two Vec's.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::min (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Computes the minimum of the elements of two Vec's.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::neg (const Vec< T, SIMD_WIDTH > &a)
 Negates the elements of a Vec.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::round (const Vec< T, SIMD_WIDTH > &a)
 Rounds the elements of a Vec to the nearest integer.
 
template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::truncate (const Vec< T, SIMD_WIDTH > &a)
 Truncates the elements of a Vec to the nearest integer i.e. rounds towards zero.
 

Function Documentation

◆ abs()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::abs ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Computes the absolute value of the elements of a Vec.

For unsigned types, this function simply returns the input Vec.

Parameters
aVec to compute the absolute value of
Returns
Vec containing the absolute value of the elements of the input Vec

◆ ceil()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::ceil ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Rounds the elements of a Vec up to the nearest integer.

For integer types, this function simply returns the input Vec.

Parameters
aVec to round
Returns
Vec containing the rounded elements of the input Vec

◆ floor()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::floor ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Rounds the elements of a Vec down to the nearest integer.

For integer types, this function simply returns the input Vec.

Parameters
aVec to round
Returns
Vec containing the rounded elements of the input Vec

◆ max()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::max ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Computes the maximum of the elements of two Vec's.

Parameters
afirst Vec
bsecond Vec
Returns
Vec containing the maximum of the elements of the input Vec's

◆ min()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::min ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Computes the minimum of the elements of two Vec's.

Parameters
afirst Vec
bsecond Vec
Returns
Vec containing the minimum of the elements of the input Vec's

◆ neg()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::neg ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Negates the elements of a Vec.

This function is only available for signed types.

Parameters
aVec to negate
Returns
Vec containing the negated elements of the input Vec

◆ round()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::round ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Rounds the elements of a Vec to the nearest integer.

For integer types, this function simply returns the input Vec.

Parameters
aVec to round
Returns
Vec containing the rounded elements of the input Vec

◆ truncate()

template<typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::truncate ( const Vec< T, SIMD_WIDTH > & a)
inlinestatic

Truncates the elements of a Vec to the nearest integer i.e. rounds towards zero.

For integer types, this function simply returns the input Vec.

Parameters
aVec to truncate
Returns
Vec containing the truncated elements of the input Vec