|
template<class Container > |
std::string | to_string (const Container &container, const std::string &delimiter=", ", const std::array< std::string, 2 > &surround={"[", "]"}) |
|
template<class Container , class F > |
Container | elementWisePairOp (const Container &lhs, const Container &rhs, F binaryFunction) |
|
template<class Scalar , class Container , class F > |
Container | elementWiseScalarOp (const Scalar &lhs, const Container &rhs, F binaryFunction) |
|
template<class Container > |
auto | L2Norm (const Container &c) |
|
template<> |
auto | L2Norm< std::array< double, 3 > > (const std::array< double, 3 > &c) |
|
template<class Container > |
auto | L2NormSquared (const Container &c) |
|
template<> |
auto | L2NormSquared< std::array< double, 3 > > (const std::array< double, 3 > &c) |
|
Collection of utility functions and operators for iterable data containers.
Collection of utility functions and operators for iterable data containers like std::array, std::vector, etc.
template<class Container , class F >
Container ArrayUtils::elementWisePairOp |
( |
const Container & |
lhs, |
|
|
const Container & |
rhs, |
|
|
F |
binaryFunction |
|
) |
| |
|
inline |
Applies an element wise binary function F to two containers.
If the containers differ in size the F is only applied to as many elements as are in the smaller container.
- Template Parameters
-
Container | Type for both containers. |
F | Type of binary function. |
- Parameters
-
- Returns
- Element wise F(lhs, rhs).
Definition at line 127 of file ArrayUtils.h.
129 auto retIter = std::begin(ret);
130 auto lhsIter = std::cbegin(lhs);
131 const auto lhsEnd = std::cend(lhs);
132 auto rhsIter = std::cbegin(rhs);
133 const auto rhsEnd = std::cend(rhs);
135 for (; lhsIter != lhsEnd and rhsIter != rhsEnd; ++lhsIter, ++rhsIter, ++retIter) {
136 *retIter = binaryFunction(*lhsIter, *rhsIter);