26#ifndef TABLES_TABVECMATH_H
27#define TABLES_TABVECMATH_H
33#include <casacore/casa/aips.h>
34#include <casacore/casa/BasicMath/Math.h>
35#include <casacore/tables/Tables/TableVector.h>
36#include <casacore/tables/Tables/TVecMath.h>
311#define TABVECMATHOPER(NAME, OP, OPA) \
313 inline TableVector<T> aips_name2(operato, OP)(const TableVector<T>& tv, const T& v) { \
314 return TableVector<T>(aips_name2(tabVecRepvalr, NAME)(tv.tabVec(), v)); \
317 inline TableVector<T> aips_name2(operato, OP)(const T& v, const TableVector<T>& tv) { \
318 return TableVector<T>(aips_name2(tabVecRepvall, NAME)(v, tv.tabVec())); \
321 inline TableVector<T> aips_name2(operato, OP)(const TableVector<T>& l, \
322 const TableVector<T>& r) { \
323 return TableVector<T>(aips_name2(tabVecReptv, NAME)(l.tabVec(), r.tabVec())); \
326 inline void aips_name2(operato, OPA)(TableVector<T> & tv, const T& v) { \
327 aips_name2(tabVecRepvalass, NAME)(tv.tabVec(), v); \
330 inline void aips_name2(operato, OPA)(TableVector<T> & l, const TableVector<T>& r) { \
331 aips_name2(tabVecReptvass, NAME)(l.tabVec(), r.tabVec()); \
339#define TABVECMATHFUNC(NAME) \
341 inline TableVector<T> NAME(const TableVector<T>& tv) { \
342 return TableVector<T>(aips_name2(tabVecRep, NAME)(tv.tabVec())); \
344#define TABVECMATHFUNC2(NAME) \
346 inline TableVector<T> NAME(const TableVector<T>& l, const TableVector<T>& r) { \
347 return TableVector<T>(aips_name2(tabVecRep, NAME)(l.tabVec(), r.tabVec())); \
377 return tabVecRepsum(tv.
tabVec());
381 return tabVecRepproduct(tv.
tabVec());
403 tabVecRepindgen(tv.
tabVec(), start, inc);
407 tabVecRepindgen(tv.
tabVec(), start, T(1));
411 tabVecRepindgen(tv.
tabVec(), T(0), T(1));
420 return tabVecRepnorm(tv.
tabVec());
#define TABVECMATHFUNC(NAME)
#define TABVECMATHOPER(NAME, OP, OPA)
#define TABVECMATHFUNC2(NAME)
TabVecRep< T > & tabVec()
Return the TabVecRep reference.
For temporary backward namespace compatibility, use casa as alias for casacore.
LatticeExprNode exp(const LatticeExprNode &expr)
LatticeExprNode asin(const LatticeExprNode &expr)
void minMax(T &min, T &max, const TableVector< T > &tv)
LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode acos(const LatticeExprNode &expr)
T innerProduct(const TableVector< T > &l, const TableVector< T > &r)
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
void indgen(TableVector< T > &tv, T start, T inc)
LatticeExprNode cosh(const LatticeExprNode &expr)
LatticeExprNode atan(const LatticeExprNode &expr)
LatticeExprNode tanh(const LatticeExprNode &expr)
LatticeExprNode log10(const LatticeExprNode &expr)
LatticeExprNode sinh(const LatticeExprNode &expr)
LatticeExprNode sum(const LatticeExprNode &expr)
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
T norm(const TableVector< T > &tv)
LatticeExprNode tan(const LatticeExprNode &expr)
LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
TableVector< T > crossProduct(const TableVector< T > &l, const TableVector< T > &r)
LatticeExprNode sqrt(const LatticeExprNode &expr)
T product(const TableVector< T > &tv)
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
StatAcc & operator+=(const StatAcc &)
LatticeExprNode log(const LatticeExprNode &expr)
LatticeExprNode cos(const LatticeExprNode &expr)
LatticeExprNode floor(const LatticeExprNode &expr)
NewDelAllocator< T > NewDelAllocator< T >::value
LatticeExprNode ceil(const LatticeExprNode &expr)
Functor to get maximum of two values.
Functor to get minimum of two values.
Further transcendental math for table vectors.
TableVector< T > asin(const TableVector< T > &)
TableVector< T > acos(const TableVector< T > &)
TableVector< T > ceil(const TableVector< T > &)
TableVector< T > fabs(const TableVector< T > &)
TableVector< T > pow(const TableVector< T > &value, const double &exponent)
TableVector< T > tan(const TableVector< T > &)
TableVector< T > atan2(const TableVector< T > &y, const TableVector< T > &x)
TableVector< T > floor(const TableVector< T > &)
TableVector< T > tanh(const TableVector< T > &)
TableVector< T > fmod(const TableVector< T > &value, const TableVector< T > &modulo)
TableVector< T > atan(const TableVector< T > &)
void operator/=(TableVector< T > &left, const TableVector< T > &right)
Divide 2 table vectors storing result in first one.
TableVector< T > operator*(const TableVector< T > &left, const TableVector< T > &right)
Multiple 2 table vectors storing result in a new one.
void operator+=(TableVector< T > &left, const T &right)
Add a scalar to each element in the table vector.
TableVector< T > operator+(const T &left, const TableVector< T > &right)
Add a scalar to each element in the table vector storing result in a new table vector.
TableVector< T > operator+(const TableVector< T > &left, const T &right)
Add a scalar to each element in the table vector storing result in a new table vector.
void operator*=(TableVector< T > &left, const T &right)
Multiple each element in the table vector with a scalar.
TableVector< T > operator/(const TableVector< T > &left, const TableVector< T > &right)
Divide 2 table vectors storing result in a new one.
void operator/=(TableVector< T > &left, const T &right)
Divide each element in the table vector by a scalar.
void operator-=(TableVector< T > &left, const T &right)
Subtract a scalar from each element in the table vector.
void operator*=(TableVector< T > &left, const TableVector< T > &right)
Multiple 2 table vectors storing result in first one.
TableVector< T > operator-(const TableVector< T > &)
Unary minus.
TableVector< T > operator-(const TableVector< T > &left, const T &right)
Subtract a scalar from each element in the table vector storing result in a new table vector.
TableVector< T > operator*(const T &left, const TableVector< T > &right)
Multiple each element in the table vector with a scalar storing result in a new table vector.
TableVector< T > operator+(const TableVector< T > &left, const TableVector< T > &right)
Add 2 table vectors storing result in a new one.
TableVector< T > operator-(const T &left, const TableVector< T > &right)
Subtract a scalar from each element in the table vector storing result in a new table vector.
TableVector< T > operator/(const TableVector< T > &left, const T &right)
Divide each element in the table vector by a scalar storing result in a new table vector.
TableVector< T > operator*(const TableVector< T > &left, const T &right)
Multiple each element in the table vector with a scalar storing result in a new table vector.
void operator+=(TableVector< T > &left, const TableVector< T > &right)
Add 2 table vectors storing result in first one.
TableVector< T > operator+(const TableVector< T > &)
Unary plus.
void operator-=(TableVector< T > &left, const TableVector< T > &right)
Subtract 2 table vectors storing result in first one.
TableVector< T > operator-(const TableVector< T > &left, const TableVector< T > &right)
Subtract 2 table vectors storing result in a new one.
TableVector< T > operator/(const T &left, const TableVector< T > &right)
Divide each element in the table vector by a scalar storing result in a new table vector.
Transcendental math for table vectors.
TableVector< T > sin(const TableVector< T > &)
TableVector< T > cos(const TableVector< T > &)
TableVector< T > cosh(const TableVector< T > &)
TableVector< T > sinh(const TableVector< T > &)
TableVector< T > log(const TableVector< T > &)
TableVector< T > sqrt(const TableVector< T > &)
TableVector< T > log10(const TableVector< T > &)
TableVector< T > pow(const TableVector< T > &value, const TableVector< T > &exponent)
TableVector< T > exp(const TableVector< T > &)
Miscellaneous table vector operations.
T sum(const TableVector< T > &)
Sum of all the elements of a table vector.
void indgen(TableVector< T > &, T start)
Fills all elements of the table vector with a sequence starting with "start" incremented by one for e...
void indgen(TableVector< T > &, T start, T inc)
Fills all elements of the table vector with a sequence starting with "start" and incrementing by "inc...
T min(const TableVector< T > &)
The minimum element of the table vector.
void minMax(T &min, T &max, const TableVector< T > &)
This sets min and max to the min and max of the vector to avoid having to do two passes with max() an...
T max(const TableVector< T > &)
The maximum element of the table vector.
void indgen(TableVector< T > &)
Fills all elements of the table vector with a sequence starting with 0 and ending with nelements() - ...
T product(const TableVector< T > &)
Product of all the elements of a table vector.
Vector operations on a table vector.
T innerProduct(const TableVector< T > &left, const TableVector< T > &right)
The inner product of 2 table vectors.
T norm(const TableVector< T > &)
The norm of a table vector.
TableVector< T > crossProduct(const TableVector< T > &left, const TableVector< T > &right)
The cross product of 2 table vectors containing 3 elements.