Generic functions in the Math API targeted to static vector-like sequences. More...
Functions | |
template<class Vector , class ResultVector , class UnaryFunctor > | |
void | mi::math::general::transform (const Vector &vec, ResultVector &result, UnaryFunctor f) |
Generic transform function that applies a unary functor (return value). More... | |
template<class Vector1 , class Vector2 , class ResultVector , class BinaryFunctor> | |
void | mi::math::general::transform (const Vector1 &vec1, const Vector2 &vec2, ResultVector &result, BinaryFunctor f) |
Generic transform function that applies a binary functor (return value). More... | |
template<class Scalar , class Vector , class ResultVector , class BinaryFunctor > | |
void | mi::math::general::transform_left_scalar (const Scalar &s, const Vector &vec, ResultVector &result, BinaryFunctor f) |
Generic transform function that applies a binary functor (return value, LHS scalar). More... | |
template<class Scalar , class Vector , class ResultVector , class BinaryFunctor > | |
void | mi::math::general::transform_right_scalar (const Vector &vec, const Scalar &s, ResultVector &result, BinaryFunctor f) |
Generic transform function that applies a binary functor (return value, RHS scalar). More... | |
template<class Vector , class UnaryFunctor > | |
void | mi::math::general::for_each (Vector &vec, UnaryFunctor f) |
Generic transform function that applies a unary functor (in-place). More... | |
template<class Vector1 , class Vector2 , class BinaryFunctor> | |
void | mi::math::general::for_each (Vector1 &vec1, const Vector2 &vec2, BinaryFunctor f) |
Generic transform function that applies a binary functor (in-place). More... | |
Generic functions in the Math API targeted to static vector-like sequences.
They help, together with the Basic Math Functors in the Math API to implement the operators and functions on vector-like data types, whose number of elements are known at compile time. Thus, optimizations like loop unrolling are possible. These generic functions and the functors are in principle inline.
#include <mi/math/function.h>
|
inline |
Generic transform function that applies a unary functor (in-place).
The transform function applies the unary functor f
to each element of the vector-like value vec
, which is modifiable.
The size of vec
is available as compile-time constant Vector::SIZE
.
|
inline |
Generic transform function that applies a binary functor (in-place).
The transform function applies the binary functor f
to each pair of matching elements of the vector-like values vec1
and vec2
, where vec1
is modifiable and vec2
not.
The size of vec1
is available as compile-time constant Vector::SIZE
and has to be the same as for vec2
.
|
inline |
Generic transform function that applies a unary functor (return value).
The function applies the unary functor f
to each element of the vector-like value vec
and assigns the result to the same coordinate in the vector-like value result
.
Both vector values have to be of the same size, available as compile-time constant Vector::SIZE
.
|
inline |
Generic transform function that applies a binary functor (return value).
The function applies the binary functor f
to each pair of matching elements of the vector-like values vec1
and vec2
and assigns the result to the same coordinate in the vector-like value result
.
All vector values have to be of the same size, available as compile-time constant Vector1::SIZE
.
|
inline |
Generic transform function that applies a binary functor (return value, LHS scalar).
The function applies the binary functor f
to each element of the vector-like values vec
and assigns the result to the same coordinate in the vector-like value result
. The scalar value s
is passed as a left argument to f
and the vector element is passed as a right argument.
All vector values have to be of the same size, available as compile-time constant Vector::SIZE
.
|
inline |
Generic transform function that applies a binary functor (return value, RHS scalar).
The function applies the binary functor f
to each element of the vector-like values vec
and assigns the result to the same coordinate in the vector-like value result
. The scalar value s
is passed as a left argument to f
and the vector element is passed as a right argument.
All vector values have to be of the same size, available as compile-time constant Vector::SIZE
.