Collection of basic arithmetic operations on vectors, SIMD accelerated where possible. More...
Functions | |
template<FloatType T> | |
void | add (T *lhs, const T *rhs, size_t size) noexcept |
template<FloatType T> | |
void | add (T *arr, T scalar, size_t size) noexcept |
template<FloatArrayLike T> | |
void | add (T &lhs, T &rhs) noexcept |
template<FloatArrayLike T> | |
void | add (T &arr, typename T::value_type scalar) noexcept |
template<FloatType T> | |
void | subtract (T *lhs, const T *rhs, size_t size) noexcept |
template<FloatType T> | |
void | subtract (T *arr, T scalar, size_t size) noexcept |
template<FloatArrayLike T> requires std::is_floating_point_v<typename T::value_type> | |
void | subtract (T &lhs, const T &rhs) noexcept |
template<FloatArrayLike T> | |
void | subtract (T &arr, typename T::value_type scalar) noexcept |
template<FloatType T> | |
void | multiply (T *lhs, const T *rhs, size_t size) noexcept |
template<FloatType T> | |
void | multiply (T *arr, T scalar, size_t size) noexcept |
template<FloatArrayLike T> | |
void | multiply (T &lhs, const T &rhs) noexcept |
template<FloatArrayLike T> | |
void | multiply (T &arr, typename T::value_type scalar) noexcept |
template<FloatType T> | |
void | divide (T *lhs, const T *rhs, size_t size) noexcept |
template<FloatType T> | |
void | divide (T *arr, T scalar, size_t size) noexcept |
template<FloatArrayLike T> | |
void | divide (T &lhs, const T &rhs) noexcept |
template<FloatArrayLike T> | |
void | divide (T &arr, typename T::value_type scalar) noexcept |
template<NumericType T> | |
void | copy (T *lhs, const T *rhs, size_t size) noexcept |
template<ArrayLike T> | |
void | copy (T &lhs, const T &rhs) noexcept |
Collection of basic arithmetic operations on vectors, SIMD accelerated where possible.
On macOS this will use Accelerate's vDSP library for SIMD intrinsics. On Windows, Marvin has an optional dependency on Intel's IPP library. If it's found by CMake, these functions will use the IPP implementations of these functions. If it's not found, it will use the fallback implementations, which are simple for loops.
If you're struggling to get IPP installed, Sudara has a great blog post detailing the hoops you need to jump through to get it up and running.
Note that even when using SIMD, it's not guaranteed to be faster than what the compiler might generate with a for loop - I'd recommend benchmarking on the platform you're targeting with the kind of data you'll be using, and choosing whether to use these functions accordingly.
|
noexcept |
Adds the value of scalar
to the values of lhs
, and stores the result in lhs
.
arr | The destination array-like. |
scalar | The value to add to each element of arr . |
|
noexcept |
Adds the values of rhs
to the values of lhs
, and stores the result in lhs
. lhs.size()
must == rhs.size()
.
lhs | The destination array-like. |
rhs | The source array-like. |
|
noexcept |
Adds the value of scalar
to the values of lhs
, and stores the result in lhs
.
arr | A raw pointer to the dest array-like. |
scalar | The value to add to each element of arr . |
size | The number of elements in arr . |
|
noexcept |
Adds the values of rhs
to the values of lhs
, and stores the result in lhs
.
lhs | A raw pointer to the dest array-like. |
rhs | A raw pointer to the source array-like. |
size | The number of elements in lhs and rhs . |
|
noexcept |
Copies the contents of rhs into lhs. lhs.size()
must == rhs.size()
.
lhs | The destination array-like. |
rhs | The source array-like. |
|
noexcept |
Copies the contents of rhs into lhs.
lhs | A raw pointer to the destination array-like. |
rhs | A raw pointer to the source array-like. |
size | The number of elements to copy. |
|
noexcept |
Divides the values of lhs
by the value of scalar
, and stores the result in lhs
.
arr | The destination array-like. |
scalar | The value to divide each element in arr by. |
|
noexcept |
Divides the values of lhs
by the values of rhs
, and stores the result in lhs
. lhs.size()
must == rhs.size()
.
lhs | The destination array-like. |
rhs | The source array-like. |
|
noexcept |
Divides the values of lhs
by the value of scalar
, and stores the result in lhs
.
arr | A raw pointer to the dest array-like. |
scalar | The value to divide each element in arr by. |
size | The number of elements in lhs and rhs . |
|
noexcept |
Divides the values of lhs
by the values of rhs
, and stores the result in lhs
.
lhs | A raw pointer to the dest array-like. |
rhs | A raw pointer to the source array-like. |
size | The number of elements in lhs and rhs . |
|
noexcept |
Multiplies the values of lhs
by the value of scalar
, and stores the result in lhs
.
arr | The destination array-like. |
scalar | The value to multiply each element in arr by. |
|
noexcept |
Multiplies the values of lhs
by the values of rhs
, and stores the result in lhs
. lhs.size()
must == rhs.size()
.
lhs | The destination array-like. |
rhs | The source array-like. |
|
noexcept |
Multiplies the values of lhs
by value of scalar
, and stores the result in lhs
.
arr | A raw pointer to the dest array-like. |
scalar | The value to multiply each element in arr by. |
size | The number of elements in lhs and rhs . |
|
noexcept |
Multiplies the values of lhs
by the values of rhs
, and stores the result in lhs
.
lhs | A raw pointer to the dest array-like. |
rhs | A raw pointer to the source array-like. |
size | The number of elements in lhs and rhs . |
|
noexcept |
Subtracts the value of scalar
from the values of lhs
, and stores the result in lhs
.
arr | The destination array-like. |
scalar | The value to subtract from each element in arr . |
|
noexcept |
Subtracts the values of rhs
from the values of lhs
, and stores the result in lhs
. lhs.size()
must == rhs.size()
.
lhs | The destination array-like. |
rhs | The source array-like. |
|
noexcept |
Subtracts the value of scalar
from the values of lhs
, and stores the result in lhs
.
arr | A raw pointer to the dest array-like. |
scalar | The value to subtract from each element in arr . |
size | The number of elements in lhs and rhs . |
|
noexcept |
Subtracts the values of rhs
from the values of lhs
, and stores the result in lhs
.
lhs | A raw pointer to the dest array-like. |
rhs | A raw pointer to the source array-like. |
size | The number of elements in lhs and rhs . |