Public Member Functions
rtc::VarVec< T > Class Template Reference

#include <rtcVarVec.h>

Inheritance diagram for rtc::VarVec< T >:
Inheritance graph
[legend]

List of all members.

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
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
max () const
VarVec< T > maximize (const VarVec< T > &other)
min () const
VarVec< T > minimize (const VarVec< T > &other)
norm () const
normalize ()
VarVec< T > normalized () const
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
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)
pnorm (float p) const
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)
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

Detailed Description

template<class T>
class rtc::VarVec< T >

A dynamically allocated vector of type T

Definition at line 37 of file rtcVarVec.h.


Constructor & Destructor Documentation

template<class T >
rtc::VarVec< T >::VarVec ( ) [inline]

default Ctor

Definition at line 195 of file rtcVarVec.h.

template<class T >
rtc::VarVec< T >::VarVec ( int  _len) [inline]

Ctor that does no initalization.

Definition at line 200 of file rtcVarVec.h.

template<class T >
rtc::VarVec< T >::VarVec ( int  _len,
const T *  d 
) [inline]

Ctor that initializes elements from an array.

Parameters:
_lensize of the vector
dpointer to the initalization array

Definition at line 207 of file rtcVarVec.h.

template<class T >
rtc::VarVec< T >::VarVec ( int  _len,
const T  a 
) [inline]

Ctor that initializes all elements from a scalar.

Parameters:
_lensize of the vector
athe value to assign to all elements

Definition at line 214 of file rtcVarVec.h.

template<class T >
rtc::VarVec< T >::VarVec ( const Array1< T > &  a) [inline]

Copy Ctor

Parameters:
ais the array to duplicate

Definition at line 220 of file rtcVarVec.h.

template<class T >
template<class U >
rtc::VarVec< T >::VarVec ( const VarVec< U > &  v) [inline]

Casting Ctor that initializes from passed vector.

Parameters:
vis the vector to duplicate

Definition at line 228 of file rtcVarVec.h.

template<class T >
template<class U , int N>
rtc::VarVec< T >::VarVec ( const Vec< U, N > &  v) [inline]

Casting Ctor that initializes from passed vector with type cast.

Parameters:
vis the vector to duplicate

Definition at line 236 of file rtcVarVec.h.


Member Function Documentation

template<class T >
VarVec< T > & rtc::VarVec< T >::add ( const VarVec< T > &  v) [inline]

Vector-Vector addition.

Definition at line 758 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::add ( const T  a) [inline]

Vector-Scalar addition.

Definition at line 901 of file rtcVarVec.h.

template<class T >
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.

Parameters:
vthe vector from which to add values
ithe (zero based) index of the start of the subvector

Definition at line 777 of file rtcVarVec.h.

template<class T >
int rtc::VarVec< T >::compareTo ( const VarVec< T > &  v) const [inline]

Compare the entire vector to the passed vector.

Returns:
1 if all element in this vector are greater than corresponding elements in the passed vector, -1 if they are all less, and 0 otherwise

Definition at line 1164 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::cumsum ( ) const [inline]

Calculates the cumulative sum of the elements in the vector

Returns:
the cumulative of the elements in the vector

Definition at line 483 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::dot ( const VarVec< T > &  v) const [inline]

Calculate the dot (inner) product with another vector.

Parameters:
vthe other vector
Returns:
the inner product

Definition at line 633 of file rtcVarVec.h.

template<class T >
bool rtc::VarVec< T >::equalTo ( const VarVec< T > &  v,
const T  tol = T(0) 
) const [inline]

Compare the entire vector to the passed vector.

Returns:
true of all corresponding elements are within the given tolerance

Definition at line 1188 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::getSubVec ( const int  i,
int  sub_len 
) const [inline]

Get the subvector of length N starting at element i

Parameters:
ithe (zero based) index of the first element of subvector
sub_lenthe length of the subvector
Returns:
subvector of length sub_len

Definition at line 383 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::max ( ) const [inline]

Find the maximum value of the vector

Returns:
the maximum value

Definition at line 453 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::maximize ( const VarVec< T > &  other) [inline]

Maximize values: same as *this = max(*this, _rhs), but faster

Returns:
a vector of the results

Definition at line 611 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::min ( ) const [inline]

Find the minimum value of the vector

Returns:
the minimum value

Definition at line 463 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::minimize ( const VarVec< T > &  other) [inline]

Minimize values: same as *this = min(*this, _rhs), but faster

Returns:
a vector of the results

Definition at line 592 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::norm ( ) const [inline]

Calculate the euclidian norm (2-norm)

Returns:
the square root of the sum of squares of the elements

Definition at line 402 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::normalize ( ) [inline]

Normalize a vector.

Returns:
the 2-norm of the vector before it was normalized

Definition at line 431 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::normalized ( ) const [inline]

Get a normalized version of the vector.

Returns:
the vector normalized

Definition at line 441 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::normSqr ( ) const [inline]

Calculate the square of the euclidan norm (2-norm).

Returns:
the sum of squares of the elements

Definition at line 410 of file rtcVarVec.h.

template<class T >
bool rtc::VarVec< T >::operator!= ( const VarVec< T > &  v) const [inline]

Element-wise test for inequality.

Returns:
vector of boolean results

Definition at line 1047 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator* ( const T  a) const [inline]

Vector-Scalar multiplication operator.

Parameters:
athe scalar with which to multiply each element of vector

Definition at line 978 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator* ( const VarVec< T > &  v) const [inline]

Element-wise multiplication.

Definition at line 1207 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator*= ( const T  a) [inline]

Vector-Scalar multiplication assignment operator.

Parameters:
athe scalar with which to multiply each element of vector

Definition at line 998 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator*= ( const VarVec< T > &  v) [inline]

Element-wise multiplication assigment.

Definition at line 1225 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator+ ( const VarVec< T > &  v) const [inline]

Vector-Vector addition operator.

Definition at line 828 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator+ ( const T  a) const [inline]

Vector-Scalar addition operator.

Parameters:
athe scalar to add to each element of vector

Definition at line 910 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator+= ( const VarVec< T > &  v) [inline]

Vector-Vector increment operator.

Definition at line 845 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator+= ( const T  a) [inline]

Vector-Scalar increment operator.

Parameters:
athe scalar by which to increment each element of vector

Definition at line 920 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator- ( const VarVec< T > &  v) const [inline]

Vector-Vector subtraction operator.

Definition at line 860 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator- ( ) const [inline]

Vector negation operator.

Definition at line 892 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator- ( const T  a) const [inline]

Vector-Scalar subtraction operator.

Parameters:
athe scalar to subtract from each element of vector

Definition at line 936 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator-= ( const VarVec< T > &  v) [inline]

Vector-Vector decrement operator.

Definition at line 877 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator-= ( const T  a) [inline]

Vector-Scalar decrement operator.

Parameters:
athe scalar by which to decrement each element of vector

Definition at line 946 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator/ ( const T  a) const [inline]

Vector-Scalar division operator.

Parameters:
athe scalar by which to divide each element of vector

Definition at line 988 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::operator/ ( const VarVec< T > &  v) const [inline]

Element-wise division.

Definition at line 1216 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator/= ( const T  a) [inline]

Vector-Scalar division assignment operator.

Parameters:
athe scalar by which to divide each element of vector

Definition at line 1006 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::operator/= ( const VarVec< T > &  v) [inline]

Element-wise division assignment.

Definition at line 1240 of file rtcVarVec.h.

template<class T >
VarVec< bool > rtc::VarVec< T >::operator< ( const VarVec< T > &  v) const [inline]

Element-wise test for less.

Returns:
vector of boolean results

Definition at line 1144 of file rtcVarVec.h.

template<class T >
VarVec< bool > rtc::VarVec< T >::operator<= ( const VarVec< T > &  v) const [inline]

Element-wise test for less or equal.

Returns:
vector of boolean results

Definition at line 1106 of file rtcVarVec.h.

template<class T >
VarVec< T > & rtc::VarVec< T >::operator= ( const T  a) [inline]

Set all elements equal to a scalar.

Parameters:
athe value to assign to all elements

Definition at line 291 of file rtcVarVec.h.

template<class T >
VarVec< T > & rtc::VarVec< T >::operator= ( const T *  d) [inline]

Set all elements from an array.

Parameters:
dpointer to the initalization array

Definition at line 300 of file rtcVarVec.h.

template<class T >
VarVec< T > & rtc::VarVec< T >::operator= ( const VarVec< T > &  v) [inline]

Set this vector equal to passed vector

Parameters:
vthe vector to replicate

Definition at line 309 of file rtcVarVec.h.

template<class T >
template<class U >
VarVec< T > & rtc::VarVec< T >::operator= ( const VarVec< U > &  v) [inline]

Set this vector equal to passed vector with type cast.

Parameters:
vthe vector to replicate

Definition at line 337 of file rtcVarVec.h.

template<class T >
bool rtc::VarVec< T >::operator== ( const VarVec< T > &  v) const [inline]

Element-wise test for equality.

Returns:
vector of boolean results

Definition at line 1027 of file rtcVarVec.h.

template<class T >
VarVec< bool > rtc::VarVec< T >::operator> ( const VarVec< T > &  v) const [inline]

Element-wise test for greater.

Returns:
vector of boolean results

Definition at line 1125 of file rtcVarVec.h.

template<class T >
VarVec< bool > rtc::VarVec< T >::operator>= ( const VarVec< T > &  v) const [inline]

Element-wise test for equality.

Returns:
vector of boolean results Element-wise test for inequality.
vector of boolean results Element-wise test for greater or equal.
vector of boolean results

Definition at line 1087 of file rtcVarVec.h.

template<class T >
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

Parameters:
ithe (zero based) index into the vector

Reimplemented from rtc::Array< T, 1 >.

Definition at line 349 of file rtcVarVec.h.

template<class T >
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

Parameters:
ithe (zero based) index into the vector

Reimplemented from rtc::Array< T, 1 >.

Definition at line 366 of file rtcVarVec.h.

template<class T >
VarSMat< T > rtc::VarVec< T >::outer ( const VarVec< T > &  v) const [inline]

Calculate the outer product with another vector.

Parameters:
vthe other vector
Returns:
the outer product matrix

Definition at line 652 of file rtcVarVec.h.

template<class T >
VarSMat< T > rtc::VarVec< T >::outer ( ) const [inline]

Calculate the outer product with itself.

Returns:
the outer product matrix

Definition at line 670 of file rtcVarVec.h.

template<class T >
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.

template<class T >
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.

template<class T >
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.

template<class T >
VarVec< T > rtc::VarVec< T >::performed ( T(*)(T)  mathFun) [inline]

Pass each element through the given single-arg math function.

Returns:
a vector of the results

Definition at line 548 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::performed ( T(*)(T, T)  mathFun,
const T  arg2 
) [inline]

Pass each element through the given single-arg math function.

Returns:
a vector of the results

Definition at line 560 of file rtcVarVec.h.

template<class T >
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.

Returns:
a vector of the results

Definition at line 572 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::pnorm ( float  p) const [inline]

Calculate general p-norms

Parameters:
p
Returns:
the pth root of the sum of pth power of the elmements

Definition at line 421 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::prod ( ) const [inline]

Find the product of the elements in the vector

Returns:
the product of the elements in the vector

Definition at line 497 of file rtcVarVec.h.

template<class T >
bool rtc::VarVec< T >::read ( std::istream &  is) [inline]

Restores state from a binary stream.

Definition at line 1266 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::set ( const T *  d) [inline]

Set all elements from an array.

Parameters:
dpointer to the initalization array

Definition at line 255 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::set ( const T  a) [inline]

Set all elements equal to a scalar.

Parameters:
athe value to assign to all elements

Reimplemented from rtc::Array< T, 1 >.

Definition at line 247 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::set ( const VarVec< T > &  v) [inline]

Set this vector equal to passed vector

Parameters:
vthe vector to replicate

Definition at line 263 of file rtcVarVec.h.

template<class T >
template<class U >
void rtc::VarVec< T >::set ( const VarVec< U > &  v) [inline]

Set this vector equal to passed vector with type cast.

Parameters:
vthe vector to replicate

Definition at line 319 of file rtcVarVec.h.

template<class T >
template<class U , int N>
void rtc::VarVec< T >::set ( const Vec< U, N > &  v) [inline]

Set from another matrix with type cast.

Parameters:
vis the vector to duplicate

Definition at line 328 of file rtcVarVec.h.

template<class T >
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.

Parameters:
vthe vector from which to copy values
ithe (zero based) index of the start of the subvector

Definition at line 275 of file rtcVarVec.h.

template<class T >
void rtc::VarVec< T >::sort ( bool  ascending = true) [inline]

Creates vector with samples from a uniform distribution on [a,b].

Parameters:
astart of range
bend of range
Returns:
vector of uniform samples Create vector with samples from a normal distribution.
Parameters:
meanmean of normal distribution
stdevstandard deviation of normal distribution
Returns:
vector of normal samples Create vector from a multivariate gaussian distribution.
Parameters:
meanmean of normal distribution
stdevstandard deviation of normal distribution
Returns:
vector of a multivariate gaussian distribution Sort elements.
Parameters:
ascendingsort in increasing order

Definition at line 724 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::sorted ( bool  ascending = true) [inline]

Create a copy of the vector with elements sorted.

Parameters:
ascendingsort in increasing order
Returns:
sorted vector

Definition at line 747 of file rtcVarVec.h.

template<class T >
VarVec< T > & rtc::VarVec< T >::subtract ( const VarVec< T > &  v) [inline]

Vector-Vector subtraction.

Definition at line 792 of file rtcVarVec.h.

template<class T >
VarVec< T > rtc::VarVec< T >::subtract ( const T  a) [inline]

Vector-Scalar subtraction.

Definition at line 927 of file rtcVarVec.h.

template<class T >
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.

Parameters:
vthe vector from which to subtract values
ithe (zero based) index of the start of the subvector

Definition at line 811 of file rtcVarVec.h.

template<class T >
T rtc::VarVec< T >::sum ( ) const [inline]

Find the sum of the elements in the vector

Returns:
the sum of the elements in the vector

Definition at line 473 of file rtcVarVec.h.

template<class T >
bool rtc::VarVec< T >::write ( std::ostream &  os) const [inline]

Writes state to a binary stream.

Definition at line 1257 of file rtcVarVec.h.


The documentation for this class was generated from the following file:


rtc
Author(s): Benjamin Pitzer
autogenerated on Mon Oct 6 2014 10:07:35