#include <rtcVarVec.h>
Public Member Functions | |
VarVec< T > & | add (const VarVec< T > &v) |
VarVec< T > | add (const T a) |
void | addSubVec (const int i, const VarVec< T > &v) |
int | compareTo (const VarVec< T > &v) const |
VarVec< T > | cumsum () const |
T | dot (const VarVec< T > &v) const |
bool | equalTo (const VarVec< T > &v, const T tol=T(0)) const |
VarVec< T > | getSubVec (const int i, int sub_len) const |
T | max () const |
VarVec< T > | maximize (const VarVec< T > &other) |
T | min () const |
VarVec< T > | minimize (const VarVec< T > &other) |
T | norm () const |
T | normalize () |
VarVec< T > | normalized () const |
T | normSqr () const |
bool | operator!= (const VarVec< T > &v) const |
VarVec< T > | operator* (const T a) const |
VarVec< T > | operator* (const VarVec< T > &v) const |
void | operator*= (const T a) |
void | operator*= (const VarVec< T > &v) |
VarVec< T > | operator+ (const VarVec< T > &v) const |
VarVec< T > | operator+ (const T a) const |
void | operator+= (const VarVec< T > &v) |
void | operator+= (const T a) |
VarVec< T > | operator- (const VarVec< T > &v) const |
VarVec< T > | operator- () const |
VarVec< T > | operator- (const T a) const |
void | operator-= (const VarVec< T > &v) |
void | operator-= (const T a) |
VarVec< T > | operator/ (const T a) const |
VarVec< T > | operator/ (const VarVec< T > &v) const |
void | operator/= (const T a) |
void | operator/= (const VarVec< T > &v) |
VarVec< bool > | operator< (const VarVec< T > &v) const |
VarVec< bool > | operator<= (const VarVec< T > &v) const |
VarVec< T > & | operator= (const T a) |
VarVec< T > & | operator= (const T *d) |
VarVec< T > & | operator= (const VarVec< T > &v) |
template<class U > | |
VarVec< T > & | operator= (const VarVec< U > &v) |
bool | operator== (const VarVec< T > &v) const |
VarVec< bool > | operator> (const VarVec< T > &v) const |
VarVec< bool > | operator>= (const VarVec< T > &v) const |
T | operator[] (const int i) const |
T & | operator[] (const int i) |
VarSMat< T > | outer (const VarVec< T > &v) const |
VarSMat< T > | outer () const |
void | perform (T(*mathFun)(T)) |
void | perform (T(*mathFun)(T, T), const T arg2) |
void | perform (T(*mathFun)(T, T), const VarVec< T > &v) |
VarVec< T > | performed (T(*mathFun)(T)) |
VarVec< T > | performed (T(*mathFun)(T, T), const T arg2) |
VarVec< T > | performed (T(*mathFun)(T, T), const VarVec< T > &v) |
T | pnorm (float p) const |
T | prod () const |
bool | read (std::istream &is) |
void | set (const T *d) |
void | set (const T a) |
void | set (const VarVec< T > &v) |
template<class U > | |
void | set (const VarVec< U > &v) |
template<class U , int N> | |
void | set (const Vec< U, N > &v) |
void | setSubVec (const int i, const VarVec< T > &v) |
void | sort (bool ascending=true) |
VarVec< T > | sorted (bool ascending=true) |
VarVec< T > & | subtract (const VarVec< T > &v) |
VarVec< T > | subtract (const T a) |
void | subtractSubVec (const int i, const VarVec< T > &v) |
T | sum () const |
VarVec () | |
VarVec (int len) | |
VarVec (int len, const T *d) | |
VarVec (int len, const T a) | |
VarVec (const Array1< T > &a) | |
template<class U > | |
VarVec (const VarVec< U > &v) | |
template<class U , int N> | |
VarVec (const Vec< U, N > &v) | |
bool | write (std::ostream &os) const |
A dynamically allocated vector of type T
Definition at line 37 of file rtcVarVec.h.
rtc::VarVec< T >::VarVec | ( | ) | [inline] |
default Ctor
Definition at line 195 of file rtcVarVec.h.
rtc::VarVec< T >::VarVec | ( | int | _len | ) | [inline] |
Ctor that does no initalization.
Definition at line 200 of file rtcVarVec.h.
rtc::VarVec< T >::VarVec | ( | int | _len, |
const T * | d | ||
) | [inline] |
Ctor that initializes elements from an array.
_len | size of the vector |
d | pointer to the initalization array |
Definition at line 207 of file rtcVarVec.h.
rtc::VarVec< T >::VarVec | ( | int | _len, |
const T | a | ||
) | [inline] |
Ctor that initializes all elements from a scalar.
_len | size of the vector |
a | the value to assign to all elements |
Definition at line 214 of file rtcVarVec.h.
rtc::VarVec< T >::VarVec | ( | const Array1< T > & | a | ) | [inline] |
Casting Ctor that initializes from passed vector.
v | is the vector to duplicate |
Definition at line 228 of file rtcVarVec.h.
rtc::VarVec< T >::VarVec | ( | const Vec< U, N > & | v | ) | [inline] |
Casting Ctor that initializes from passed vector with type cast.
v | is the vector to duplicate |
Definition at line 236 of file rtcVarVec.h.
VarVec< T > & rtc::VarVec< T >::add | ( | const VarVec< T > & | v | ) | [inline] |
Vector-Vector addition.
Definition at line 758 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::add | ( | const T | a | ) | [inline] |
Vector-Scalar addition.
Definition at line 901 of file rtcVarVec.h.
void rtc::VarVec< T >::addSubVec | ( | const int | i, |
const VarVec< T > & | v | ||
) | [inline] |
Add a subvector by adding elements from i onward with the elements from v.
v | the vector from which to add values |
i | the (zero based) index of the start of the subvector |
Definition at line 777 of file rtcVarVec.h.
int rtc::VarVec< T >::compareTo | ( | const VarVec< T > & | v | ) | const [inline] |
Compare the entire vector to the passed vector.
Definition at line 1164 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::cumsum | ( | ) | const [inline] |
Calculates the cumulative sum of the elements in the vector
Definition at line 483 of file rtcVarVec.h.
T rtc::VarVec< T >::dot | ( | const VarVec< T > & | v | ) | const [inline] |
Calculate the dot (inner) product with another vector.
v | the other vector |
Definition at line 633 of file rtcVarVec.h.
bool rtc::VarVec< T >::equalTo | ( | const VarVec< T > & | v, |
const T | tol = T(0) |
||
) | const [inline] |
Compare the entire vector to the passed vector.
Definition at line 1188 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::getSubVec | ( | const int | i, |
int | sub_len | ||
) | const [inline] |
Get the subvector of length N starting at element i
i | the (zero based) index of the first element of subvector |
sub_len | the length of the subvector |
Definition at line 383 of file rtcVarVec.h.
T rtc::VarVec< T >::max | ( | ) | const [inline] |
Find the maximum value of the vector
Definition at line 453 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::maximize | ( | const VarVec< T > & | other | ) | [inline] |
Maximize values: same as *this = max(*this, _rhs), but faster
Definition at line 611 of file rtcVarVec.h.
T rtc::VarVec< T >::min | ( | ) | const [inline] |
Find the minimum value of the vector
Definition at line 463 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::minimize | ( | const VarVec< T > & | other | ) | [inline] |
Minimize values: same as *this = min(*this, _rhs), but faster
Definition at line 592 of file rtcVarVec.h.
T rtc::VarVec< T >::norm | ( | ) | const [inline] |
Calculate the euclidian norm (2-norm)
Definition at line 402 of file rtcVarVec.h.
T rtc::VarVec< T >::normalize | ( | ) | [inline] |
Normalize a vector.
Definition at line 431 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::normalized | ( | ) | const [inline] |
Get a normalized version of the vector.
Definition at line 441 of file rtcVarVec.h.
T rtc::VarVec< T >::normSqr | ( | ) | const [inline] |
Calculate the square of the euclidan norm (2-norm).
Definition at line 410 of file rtcVarVec.h.
bool rtc::VarVec< T >::operator!= | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise test for inequality.
Definition at line 1047 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator* | ( | const T | a | ) | const [inline] |
Vector-Scalar multiplication operator.
a | the scalar with which to multiply each element of vector |
Definition at line 978 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator* | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise multiplication.
Definition at line 1207 of file rtcVarVec.h.
void rtc::VarVec< T >::operator*= | ( | const T | a | ) | [inline] |
Vector-Scalar multiplication assignment operator.
a | the scalar with which to multiply each element of vector |
Definition at line 998 of file rtcVarVec.h.
void rtc::VarVec< T >::operator*= | ( | const VarVec< T > & | v | ) | [inline] |
Element-wise multiplication assigment.
Definition at line 1225 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator+ | ( | const VarVec< T > & | v | ) | const [inline] |
Vector-Vector addition operator.
Definition at line 828 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator+ | ( | const T | a | ) | const [inline] |
Vector-Scalar addition operator.
a | the scalar to add to each element of vector |
Definition at line 910 of file rtcVarVec.h.
void rtc::VarVec< T >::operator+= | ( | const VarVec< T > & | v | ) | [inline] |
Vector-Vector increment operator.
Definition at line 845 of file rtcVarVec.h.
void rtc::VarVec< T >::operator+= | ( | const T | a | ) | [inline] |
Vector-Scalar increment operator.
a | the scalar by which to increment each element of vector |
Definition at line 920 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator- | ( | const VarVec< T > & | v | ) | const [inline] |
Vector-Vector subtraction operator.
Definition at line 860 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator- | ( | ) | const [inline] |
Vector negation operator.
Definition at line 892 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator- | ( | const T | a | ) | const [inline] |
Vector-Scalar subtraction operator.
a | the scalar to subtract from each element of vector |
Definition at line 936 of file rtcVarVec.h.
void rtc::VarVec< T >::operator-= | ( | const VarVec< T > & | v | ) | [inline] |
Vector-Vector decrement operator.
Definition at line 877 of file rtcVarVec.h.
void rtc::VarVec< T >::operator-= | ( | const T | a | ) | [inline] |
Vector-Scalar decrement operator.
a | the scalar by which to decrement each element of vector |
Definition at line 946 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator/ | ( | const T | a | ) | const [inline] |
Vector-Scalar division operator.
a | the scalar by which to divide each element of vector |
Definition at line 988 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::operator/ | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise division.
Definition at line 1216 of file rtcVarVec.h.
void rtc::VarVec< T >::operator/= | ( | const T | a | ) | [inline] |
Vector-Scalar division assignment operator.
a | the scalar by which to divide each element of vector |
Definition at line 1006 of file rtcVarVec.h.
void rtc::VarVec< T >::operator/= | ( | const VarVec< T > & | v | ) | [inline] |
Element-wise division assignment.
Definition at line 1240 of file rtcVarVec.h.
VarVec< bool > rtc::VarVec< T >::operator< | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise test for less.
Definition at line 1144 of file rtcVarVec.h.
VarVec< bool > rtc::VarVec< T >::operator<= | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise test for less or equal.
Definition at line 1106 of file rtcVarVec.h.
VarVec< T > & rtc::VarVec< T >::operator= | ( | const T | a | ) | [inline] |
Set all elements equal to a scalar.
a | the value to assign to all elements |
Definition at line 291 of file rtcVarVec.h.
VarVec< T > & rtc::VarVec< T >::operator= | ( | const T * | d | ) | [inline] |
Set all elements from an array.
d | pointer to the initalization array |
Definition at line 300 of file rtcVarVec.h.
VarVec< T > & rtc::VarVec< T >::operator= | ( | const VarVec< T > & | v | ) | [inline] |
Set this vector equal to passed vector
v | the vector to replicate |
Definition at line 309 of file rtcVarVec.h.
VarVec< T > & rtc::VarVec< T >::operator= | ( | const VarVec< U > & | v | ) | [inline] |
Set this vector equal to passed vector with type cast.
v | the vector to replicate |
Definition at line 337 of file rtcVarVec.h.
bool rtc::VarVec< T >::operator== | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise test for equality.
Definition at line 1027 of file rtcVarVec.h.
VarVec< bool > rtc::VarVec< T >::operator> | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise test for greater.
Definition at line 1125 of file rtcVarVec.h.
VarVec< bool > rtc::VarVec< T >::operator>= | ( | const VarVec< T > & | v | ) | const [inline] |
Element-wise test for equality.
Definition at line 1087 of file rtcVarVec.h.
T rtc::VarVec< T >::operator[] | ( | const int | i | ) | const [inline] |
Get an element of the vector (by value). Does bounds checking if MATMATH_CHECK_BOUNDS is set
i | the (zero based) index into the vector |
Reimplemented from rtc::Array< T, 1 >.
Definition at line 349 of file rtcVarVec.h.
T & rtc::VarVec< T >::operator[] | ( | const int | i | ) | [inline] |
Get an element of the vector (by reference). Does bounds checking if MATMATH_CHECK_BOUNDS is set
i | the (zero based) index into the vector |
Reimplemented from rtc::Array< T, 1 >.
Definition at line 366 of file rtcVarVec.h.
VarSMat< T > rtc::VarVec< T >::outer | ( | const VarVec< T > & | v | ) | const [inline] |
Calculate the outer product with another vector.
v | the other vector |
Definition at line 652 of file rtcVarVec.h.
VarSMat< T > rtc::VarVec< T >::outer | ( | ) | const [inline] |
Calculate the outer product with itself.
Definition at line 670 of file rtcVarVec.h.
void rtc::VarVec< T >::perform | ( | T(*)(T) | mathFun | ) | [inline] |
Pass each element through the given single-arg math function, replacing the current vector with the result.
Definition at line 509 of file rtcVarVec.h.
void rtc::VarVec< T >::perform | ( | T(*)(T, T) | mathFun, |
const T | arg2 | ||
) | [inline] |
Pass each element through the given double-arg math function, replacing the current vector with the result.
Definition at line 519 of file rtcVarVec.h.
void rtc::VarVec< T >::perform | ( | T(*)(T, T) | mathFun, |
const VarVec< T > & | v | ||
) | [inline] |
Pass each element through the given double-arg math function, replacing the current vector with the result.
Definition at line 529 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::performed | ( | T(*)(T) | mathFun | ) | [inline] |
Pass each element through the given single-arg math function.
Definition at line 548 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::performed | ( | T(*)(T, T) | mathFun, |
const T | arg2 | ||
) | [inline] |
Pass each element through the given single-arg math function.
Definition at line 560 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::performed | ( | T(*)(T, T) | mathFun, |
const VarVec< T > & | vp | ||
) | [inline] |
Pass each element through the given single-arg math function.
Definition at line 572 of file rtcVarVec.h.
T rtc::VarVec< T >::pnorm | ( | float | p | ) | const [inline] |
Calculate general p-norms
p |
Definition at line 421 of file rtcVarVec.h.
T rtc::VarVec< T >::prod | ( | ) | const [inline] |
Find the product of the elements in the vector
Definition at line 497 of file rtcVarVec.h.
bool rtc::VarVec< T >::read | ( | std::istream & | is | ) | [inline] |
Restores state from a binary stream.
Definition at line 1266 of file rtcVarVec.h.
void rtc::VarVec< T >::set | ( | const T * | d | ) | [inline] |
Set all elements from an array.
d | pointer to the initalization array |
Definition at line 255 of file rtcVarVec.h.
void rtc::VarVec< T >::set | ( | const T | a | ) | [inline] |
Set all elements equal to a scalar.
a | the value to assign to all elements |
Reimplemented from rtc::Array< T, 1 >.
Definition at line 247 of file rtcVarVec.h.
void rtc::VarVec< T >::set | ( | const VarVec< T > & | v | ) | [inline] |
Set this vector equal to passed vector
v | the vector to replicate |
Definition at line 263 of file rtcVarVec.h.
Set this vector equal to passed vector with type cast.
v | the vector to replicate |
Definition at line 319 of file rtcVarVec.h.
void rtc::VarVec< T >::set | ( | const Vec< U, N > & | v | ) | [inline] |
Set from another matrix with type cast.
v | is the vector to duplicate |
Definition at line 328 of file rtcVarVec.h.
void rtc::VarVec< T >::setSubVec | ( | const int | i, |
const VarVec< T > & | v | ||
) | [inline] |
Set a subvector by replacing elements from i onward with the elements from v. Replaces elements till the end of either vector is reached.
v | the vector from which to copy values |
i | the (zero based) index of the start of the subvector |
Definition at line 275 of file rtcVarVec.h.
void rtc::VarVec< T >::sort | ( | bool | ascending = true | ) | [inline] |
Creates vector with samples from a uniform distribution on [a,b].
a | start of range |
b | end of range |
mean | mean of normal distribution |
stdev | standard deviation of normal distribution |
mean | mean of normal distribution |
stdev | standard deviation of normal distribution |
ascending | sort in increasing order |
Definition at line 724 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::sorted | ( | bool | ascending = true | ) | [inline] |
Create a copy of the vector with elements sorted.
ascending | sort in increasing order |
Definition at line 747 of file rtcVarVec.h.
VarVec< T > & rtc::VarVec< T >::subtract | ( | const VarVec< T > & | v | ) | [inline] |
Vector-Vector subtraction.
Definition at line 792 of file rtcVarVec.h.
VarVec< T > rtc::VarVec< T >::subtract | ( | const T | a | ) | [inline] |
Vector-Scalar subtraction.
Definition at line 927 of file rtcVarVec.h.
void rtc::VarVec< T >::subtractSubVec | ( | const int | i, |
const VarVec< T > & | v | ||
) | [inline] |
Subtract a subvector by subtracting elements from i onward with the elements from v.
v | the vector from which to subtract values |
i | the (zero based) index of the start of the subvector |
Definition at line 811 of file rtcVarVec.h.
T rtc::VarVec< T >::sum | ( | ) | const [inline] |
Find the sum of the elements in the vector
Definition at line 473 of file rtcVarVec.h.
bool rtc::VarVec< T >::write | ( | std::ostream & | os | ) | const [inline] |
Writes state to a binary stream.
Definition at line 1257 of file rtcVarVec.h.