TabVecMath.h

Classes

Global Functions -- Basic math for table vectors. (full description)
Global Functions -- Transcendental math for table vectors. (full description)
Global Functions -- Further transcendental math for table vectors. (full description)
Global Functions -- Miscellaneous table vector operations. (full description)
Global Functions -- Vector operations on a table vector. (full description)

Basic math for table vectors. (source)

Interface

inline void operator+= (TableVector<T>& left, const ROTableVector<T>& right)
inline void operator-= (TableVector<T>& left, const ROTableVector<T>& right)
inline void operator*= (TableVector<T>& left, const ROTableVector<T>& right)
inline void operator/= (TableVector<T>& left, const ROTableVector<T>& right)
inline void operator+= (TableVector<T>& left, const T& right)
inline void operator-= (TableVector<T>& left, const T& right)
inline void operator*= (TableVector<T>& left, const T& right)
inline void operator/= (TableVector<T>& left, const T& right)
inline TableVector<T> operator+ (const ROTableVector<T>&)
inline TableVector<T> operator- (const ROTableVector<T>&)
inline TableVector<T> operator+ (const ROTableVector<T>& left, const ROTableVector<T>& right)
inline TableVector<T> operator- (const ROTableVector<T>& left, const ROTableVector<T>& right)
inline TableVector<T> operator* (const ROTableVector<T>& left, const ROTableVector<T>& right)
inline TableVector<T> operator/ (const ROTableVector<T>& left, const ROTableVector<T>& right)
inline TableVector<T> operator+ (const ROTableVector<T>& left, const T& right)
inline TableVector<T> operator- (const ROTableVector<T>& left, const T& right)
inline TableVector<T> operator* (const ROTableVector<T>& left, const T& right)
inline TableVector<T> operator/ (const ROTableVector<T>& left, const T& right)
inline TableVector<T> operator+ (const T& left, const ROTableVector<T>& right)
inline TableVector<T> operator- (const T& left, const ROTableVector<T>& right)
inline TableVector<T> operator* (const T& left, const ROTableVector<T>& right)
inline TableVector<T> operator/ (const T& left, const ROTableVector<T>& right)

Description

Synopsis

These global functions do the basic math for table vectors. This means addition, subtraction, multiplication, division and negation. In case two table vectors are used, the left and right operand must be conformant (i.e. have equal length).

Member Description

inline void operator+= (TableVector<T>& left, const ROTableVector<T>& right)

Add 2 table vectors storing result in first one.

inline void operator-= (TableVector<T>& left, const ROTableVector<T>& right)

Subtract 2 table vectors storing result in first one.

inline void operator*= (TableVector<T>& left, const ROTableVector<T>& right)

Multiple 2 table vectors storing result in first one.

inline void operator/= (TableVector<T>& left, const ROTableVector<T>& right)

Divide 2 table vectors storing result in first one.

inline void operator+= (TableVector<T>& left, const T& right)

Add a scalar to each element in the table vector.

inline void operator-= (TableVector<T>& left, const T& right)

Subtract a scalar from each element in the table vector.

inline void operator*= (TableVector<T>& left, const T& right)

Multiple each element in the table vector with a scalar.

inline void operator/= (TableVector<T>& left, const T& right)

Divide each element in the table vector by a scalar.

inline TableVector<T> operator+ (const ROTableVector<T>&)

Unary plus.

inline TableVector<T> operator- (const ROTableVector<T>&)

Unary minus.

inline TableVector<T> operator+ (const ROTableVector<T>& left, const ROTableVector<T>& right)

Add 2 table vectors storing result in a new one.

inline TableVector<T> operator- (const ROTableVector<T>& left, const ROTableVector<T>& right)

Subtract 2 table vectors storing result in a new one.

inline TableVector<T> operator* (const ROTableVector<T>& left, const ROTableVector<T>& right)

Multiple 2 table vectors storing result in a new one.

inline TableVector<T> operator/ (const ROTableVector<T>& left, const ROTableVector<T>& right)

Divide 2 table vectors storing result in a new one.

inline TableVector<T> operator+ (const ROTableVector<T>& left, const T& right)

Add a scalar to each element in the table vector storing result in a new table vector.

inline TableVector<T> operator- (const ROTableVector<T>& left, const T& right)

Subtract a scalar from each element in the table vector storing result in a new table vector.

inline TableVector<T> operator* (const ROTableVector<T>& left, const T& right)

Multiple each element in the table vector with a scalar storing result in a new table vector.

inline TableVector<T> operator/ (const ROTableVector<T>& left, const T& right)

Divide each element in the table vector by a scalar storing result in a new table vector.

inline TableVector<T> operator+ (const T& left, const ROTableVector<T>& right)

Add a scalar to each element in the table vector storing result in a new table vector.

inline TableVector<T> operator- (const T& left, const ROTableVector<T>& right)

Subtract a scalar from each element in the table vector storing result in a new table vector.

inline TableVector<T> operator* (const T& left, const ROTableVector<T>& right)

Multiple each element in the table vector with a scalar storing result in a new table vector.

inline TableVector<T> operator/ (const T& left, const ROTableVector<T>& right)

Divide each element in the table vector by a scalar storing result in a new table vector.

Transcendental math for table vectors. (source)

Interface

inline TableVector<T> cos (const ROTableVector<T>&)
inline TableVector<T> cosh (const ROTableVector<T>&)
inline TableVector<T> exp (const ROTableVector<T>&)
inline TableVector<T> log (const ROTableVector<T>&)
inline TableVector<T> log10(const ROTableVector<T>&)
inline TableVector<T> pow (const ROTableVector<T>& value, const ROTableVector<T>& exponent)
inline TableVector<T> sin (const ROTableVector<T>&)
inline TableVector<T> sinh (const ROTableVector<T>&)
inline TableVector<T> sqrt (const ROTableVector<T>&)

Description

Synopsis

These global functions do the transcendental math for table vectors for essentially all numeric types. The functions are sin, sinh, exp, log, pow, etc.. In case two table vectors are used, the left and right operand must be conformant (i.e. have equal length).

Member Description

inline TableVector<T> cos (const ROTableVector<T>&)

inline TableVector<T> cosh (const ROTableVector<T>&)

inline TableVector<T> exp (const ROTableVector<T>&)

inline TableVector<T> log (const ROTableVector<T>&)

inline TableVector<T> log10(const ROTableVector<T>&)

inline TableVector<T> pow (const ROTableVector<T>& value, const ROTableVector<T>& exponent)

inline TableVector<T> sin (const ROTableVector<T>&)

inline TableVector<T> sinh (const ROTableVector<T>&)

inline TableVector<T> sqrt (const ROTableVector<T>&)


Further transcendental math for table vectors. (source)

Interface

inline TableVector<T> acos (const ROTableVector<T>&)
inline TableVector<T> asin (const ROTableVector<T>&)
inline TableVector<T> atan (const ROTableVector<T>&)
inline TableVector<T> atan2(const ROTableVector<T>& y, const ROTableVector<T>& x)
inline TableVector<T> ceil (const ROTableVector<T>&)
inline TableVector<T> fabs (const ROTableVector<T>&)
inline TableVector<T> floor(const ROTableVector<T>&)
inline TableVector<T> fmod (const ROTableVector<T>& value, const ROTableVector<T>& modulo)
inline TableVector<T> pow (const ROTableVector<T>& value, const double& exponent)
inline TableVector<T> tan (const ROTableVector<T>&)
inline TableVector<T> tanh (const ROTableVector<T>&)

Description

Synopsis

These global functions do the transcendental math for table vectors for a limited set of numeric types. The functions are asin, ceil, etc.. In case two table vectors are used, the left and right operand must be conformant (i.e. have equal length).

Member Description

inline TableVector<T> acos (const ROTableVector<T>&)

inline TableVector<T> asin (const ROTableVector<T>&)

inline TableVector<T> atan (const ROTableVector<T>&)

inline TableVector<T> atan2(const ROTableVector<T>& y, const ROTableVector<T>& x)

inline TableVector<T> ceil (const ROTableVector<T>&)

inline TableVector<T> fabs (const ROTableVector<T>&)

inline TableVector<T> floor(const ROTableVector<T>&)

inline TableVector<T> fmod (const ROTableVector<T>& value, const ROTableVector<T>& modulo)

inline TableVector<T> pow (const ROTableVector<T>& value, const double& exponent)

inline TableVector<T> tan (const ROTableVector<T>&)

inline TableVector<T> tanh (const ROTableVector<T>&)


Miscellaneous table vector operations. (source)

Interface

inline void minMax (T& min, T& max, const ROTableVector<T>&)
inline T min (const ROTableVector<T>&)
inline T max (const ROTableVector<T>&)
inline void indgen (TableVector<T>&, Int start, Int inc)
inline void indgen (TableVector<T>&, Int start)
inline void indgen (TableVector<T>&)
inline T sum (const ROTableVector<T>&)
inline T product (const ROTableVector<T>&)

Description

Synopsis

Fill a table vector or calculate the sum, product, minimum or maximum of its elements.

Member Description

inline void minMax (T& min, T& max, const ROTableVector<T>&)

This sets min and max to the min and max of the vector to avoid having to do two passes with max() and min() separately. Requires that the type "T" has comparison operators.

inline T min (const ROTableVector<T>&)

The minimum element of the table vector. Requires that the type "T" has comparison operators.

inline T max (const ROTableVector<T>&)

The maximum element of the table vector. Requires that the type "T" has comparison operators.

inline void indgen (TableVector<T>&, Int start, Int inc)

Fills all elements of the table vector with a sequence starting with "start" and incrementing by "inc" for each element.

inline void indgen (TableVector<T>&, Int start)

Fills all elements of the table vector with a sequence starting with "start" incremented by one for each position in the table vector.

inline void indgen (TableVector<T>&)

Fills all elements of the table vector with a sequence starting with 0 and ending with nelements() - 1.

inline T sum (const ROTableVector<T>&)

Sum of all the elements of a table vector.

inline T product (const ROTableVector<T>&)

Product of all the elements of a table vector.

Warning product can easily overflow.

Vector operations on a table vector. (source)

Interface

inline T innerProduct (const ROTableVector<T>& left, const ROTableVector<T>& right)
inline T norm (const ROTableVector<T>&)
inline TableVector<T> crossProduct (const ROTableVector<T>& left, const ROTableVector<T>& right)

Description

Synopsis

Do vector operations on a table vector (like inner product).

Member Description

inline T innerProduct (const ROTableVector<T>& left, const ROTableVector<T>& right)

The inner product of 2 table vectors. The left and right operands must be conformant (i.e. have equal length).

inline T norm (const ROTableVector<T>&)

The norm of a table vector.

inline TableVector<T> crossProduct (const ROTableVector<T>& left, const ROTableVector<T>& right)

The cross product of 2 table vectors containing 3 elements.