28 #ifndef CASA_STLMATH_H
29 #define CASA_STLMATH_H
60 void throwContainerSizes (
const char* name,
size_t l1,
size_t l2);
63 template<
typename CONTAINER>
67 if (left.size() != right.size()) {
68 throwContainerSizes (name, left.size(), right.size());
73 template<
typename CONTAINER>
76 size_t sz = in.size();
78 for (
size_t i=0; i<sz; ++i) {
86 std::vector<T>
operator+ (
const std::vector<T> &left,
87 const std::vector<T> &right)
89 checkContainerSizes(left, right,
"+");
90 std::vector<T> result(left.size());
91 std::transform (left.begin(), left.end(), right.begin(),
92 result.begin(), std::plus<T>());
98 std::vector<T>
operator/ (
const std::vector<T> &left,
const T &right)
100 std::vector<T> result(left.size());
101 std::transform (left.begin(), left.end(), result.begin(),
102 [right](T x) {
return x / right; });
LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
CONTAINER reversedCasaContainer(const CONTAINER &in)
Reverse a Casacore container like IPosition, Block, or Vector.
void checkContainerSizes(const CONTAINER &left, const CONTAINER &right, const char *name)
Check if the sizes of both containers are the same.
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.