$search

rtc::Vec< T, M > Class Template Reference

#include <rtcVec.h>

Inheritance diagram for rtc::Vec< T, M >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

Vec< T, M > add (const T a)
Vec< T, M > & add (const Vec< T, M > &v)
const T & at (const int i) const
T & at (const int i)
int compareTo (const Vec< T, M > &v) const
Vec< T, M > cumsum () const
dot (const Vec< T, M > &v) const
bool equalTo (const Vec< T, M > &v, const T tol=T(0)) const
template<int N>
Vec< T, N > getSubVec (const int i) const
max () const
Vec< T, M > maximize (const Vec< T, M > &other)
min () const
Vec< T, M > minimize (const Vec< T, M > &other)
norm () const
normalize ()
Vec< T, M > normalized () const
normSqr () const
bool operator!= (const Vec< T, M > &v) const
T & operator() (const int i)
operator() (const int i) const
Vec< T, M > operator* (const Vec< T, M > &v) const
Vec< T, M > operator* (const T a) const
void operator*= (const Vec< T, M > &v)
void operator*= (const T a)
Vec< T, M > operator+ (const T a) const
Vec< T, M > operator+ (const Vec< T, M > &v) const
void operator+= (const T a)
void operator+= (const Vec< T, M > &v)
Vec< T, M > operator- (const T a) const
Vec< T, M > operator- () const
Vec< T, M > operator- (const Vec< T, M > &v) const
void operator-= (const T a)
void operator-= (const Vec< T, M > &v)
Vec< T, M > operator/ (const Vec< T, M > &v) const
Vec< T, M > operator/ (const T a) const
void operator/= (const Vec< T, M > &v)
void operator/= (const T a)
Vec< bool, M > operator< (const Vec< T, M > &v) const
Vec< bool, M > operator<= (const Vec< T, M > &v) const
template<class U >
Vec< T, M > & operator= (const Vec< U, M > &v)
Vec< T, M > & operator= (const Vec< T, M > &v)
Vec< T, M > & operator= (const T *d)
Vec< T, M > & operator= (const T a)
bool operator== (const Vec< T, M > &v) const
Vec< bool, M > operator> (const Vec< T, M > &v) const
Vec< bool, M > operator>= (const Vec< T, M > &v) const
T & operator[] (const int i)
operator[] (const int i) const
SMat< T, M > outer () const
SMat< T, M > outer (const Vec< T, M > &v) const
void perform (T(*mathFun)(T, T), const Vec< T, M > &v)
void perform (T(*mathFun)(T, T), const T arg2)
void perform (T(*mathFun)(T))
Vec< T, M > performed (T(*mathFun)(T, T), const Vec< T, M > &v)
Vec< T, M > performed (T(*mathFun)(T, T), const T arg2)
Vec< T, M > performed (T(*mathFun)(T))
pnorm (float p) const
prod () const
bool read (InputHandler &ih)
template<class U >
void set (const Vec< U, M > &v)
void set (const Vec< T, M > &v)
void set (const T a)
void set (const T *d)
template<int N>
void setSubVec (const int i, const Vec< T, N > &v)
void sort (bool ascending=true)
Vec< T, M > sorted (bool ascending=true)
Vec< T, M > subtract (const T a)
Vec< T, M > & subtract (const Vec< T, M > &v)
sum () const
template<class U >
 Vec (const Vec< U, M > &v)
 Vec (const Vec< T, M > &v)
 Vec (const T a)
 Vec (const T *d)
 Vec ()
bool write (OutputHandler &oh) const

Static Public Member Functions

static Vec< T, M > multivariateGauss (const Vec< T, M > &mean, const SMat< T, M > &cov)
static Vec< T, M > normalRand (const T mean=T(0), const T stdev=T(1))
static Vec< T, M > uniformRand (const T a=T(0), const T b=T(1))

Public Attributes

x [M]
 storage array

Detailed Description

template<class T, int M>
class rtc::Vec< T, M >

An M-Dimensional statically allocated vector. Represents an M dimensional vector of type T

Definition at line 44 of file rtcVec.h.


Constructor & Destructor Documentation

template<class T , int M>
rtc::Vec< T, M >::Vec (  )  [inline]

Ctor that does no initalization.

Definition at line 183 of file rtcVec.h.

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

Ctor that initializes elements from an array.

Parameters:
d pointer to the initalization array

Definition at line 189 of file rtcVec.h.

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

Ctor that initializes all elements from a scalar.

Parameters:
a the value to assign to all elements

Definition at line 197 of file rtcVec.h.

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

Ctor that initialized from vector of different type

Parameters:
v is the vector to duplicate

Definition at line 205 of file rtcVec.h.

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

Casting Ctor that initializes from passed vector.

Parameters:
v is the vector to duplicate

Definition at line 215 of file rtcVec.h.


Member Function Documentation

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::add ( const T  a  )  [inline]

Vector-Scalar addition.

Definition at line 784 of file rtcVec.h.

template<class T, int M>
Vec< T, M > & rtc::Vec< T, M >::add ( const Vec< T, M > &  v  )  [inline]

Vector-Vector addition.

Definition at line 725 of file rtcVec.h.

template<class T , int M>
const T & rtc::Vec< T, M >::at ( const int  i  )  const [inline]

Get an element of the vector (by reference). Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
i the (zero based) index into the vector

Definition at line 393 of file rtcVec.h.

template<class T , int M>
T & rtc::Vec< T, M >::at ( const int  i  )  [inline]

Get an element of the vector (by reference). Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
i the (zero based) index into the vector

Definition at line 377 of file rtcVec.h.

template<class T, int M>
int rtc::Vec< T, M >::compareTo ( const Vec< T, M > &  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 993 of file rtcVec.h.

template<class T , int M>
Vec< T, M > rtc::Vec< T, M >::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 501 of file rtcVec.h.

template<class T, int M>
T rtc::Vec< T, M >::dot ( const Vec< T, M > &  v  )  const [inline]

Calculate the dot (inner) product with another vector.

Parameters:
v the other vector
Returns:
the inner product

Definition at line 618 of file rtcVec.h.

template<class T, int M>
bool rtc::Vec< T, M >::equalTo ( const Vec< T, M > &  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 1008 of file rtcVec.h.

template<class T , int M>
template<int N>
Vec< T, N > rtc::Vec< T, M >::getSubVec ( const int  i  )  const [inline]

Get the subvector of length N starting at element i

Parameters:
i the (zero based) index of the first element of subvector

Definition at line 408 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::max (  )  const [inline]

Find the maximum value of the vector

Returns:
the maximum value

Definition at line 471 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::maximize ( const Vec< T, M > &  other  )  [inline]

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

Returns:
a vector of the results

Definition at line 604 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::min (  )  const [inline]

Find the minimum value of the vector

Returns:
the minimum value

Definition at line 481 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::minimize ( const Vec< T, M > &  other  )  [inline]

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

Returns:
a vector of the results

Definition at line 593 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::multivariateGauss ( const Vec< T, M > &  mean,
const SMat< T, M > &  cov 
) [inline, static]

Create vector from a multivariate gaussian distribution.

Parameters:
mean mean of normal distribution
cov covariance of normal distribution
Returns:
vector of a multivariate gaussian distribution

Definition at line 677 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::norm (  )  const [inline]

Calculate the euclidian norm (2-norm)

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

Definition at line 420 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::normalize ( void   )  [inline]

Normalize a vector.

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

Definition at line 449 of file rtcVec.h.

template<class T , int M>
Vec< T, M > rtc::Vec< T, M >::normalized (  )  const [inline]

Get a normalized version of the vector.

Returns:
the vector normalized

Definition at line 459 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::normalRand ( const T  mean = T(0),
const T  stdev = T(1) 
) [inline, static]

Create vector with samples from a normal distribution.

Parameters:
mean mean of normal distribution
stdev standard deviation of normal distribution
Returns:
vector of normal samples

Definition at line 665 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::normSqr (  )  const [inline]

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

Returns:
the sum of squares of the elements

Definition at line 428 of file rtcVec.h.

template<class T, int M>
bool rtc::Vec< T, M >::operator!= ( const Vec< T, M > &  v  )  const [inline]

Element-wise test for inequality.

Returns:
vector of boolean results

Definition at line 921 of file rtcVec.h.

template<class T , int M>
T & rtc::Vec< T, M >::operator() ( const int  i  )  [inline]

Get an element of the vector (by reference). Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
i the (zero based) index into the vector

Definition at line 329 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::operator() ( const int  i  )  const [inline]

Get an element of the vector (by value). Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
i the (zero based) index into the vector

Definition at line 313 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator* ( const Vec< T, M > &  v  )  const [inline]

Element-wise multiplication.

Definition at line 1019 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator* ( const T  a  )  const [inline]

Vector-Scalar multiplication operator.

Parameters:
a the scalar with which to multiply each element of vector

Definition at line 861 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator*= ( const Vec< T, M > &  v  )  [inline]

Element-wise multiplication assigment.

Definition at line 1037 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator*= ( const T  a  )  [inline]

Vector-Scalar multiplication assignment operator.

Parameters:
a the scalar with which to multiply each element of vector

Definition at line 881 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator+ ( const T  a  )  const [inline]

Vector-Scalar addition operator.

Parameters:
a the scalar to add to each element of vector

Definition at line 793 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator+ ( const Vec< T, M > &  v  )  const [inline]

Vector-Vector addition operator.

Definition at line 743 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator+= ( const T  a  )  [inline]

Vector-Scalar increment operator.

Parameters:
a the scalar by which to increment each element of vector

Definition at line 803 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator+= ( const Vec< T, M > &  v  )  [inline]

Vector-Vector increment operator.

Definition at line 752 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator- ( const T  a  )  const [inline]

Vector-Scalar subtraction operator.

Parameters:
a the scalar to subtract from each element of vector

Definition at line 819 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator- (  )  const [inline]

Vector negation operator.

Definition at line 775 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator- ( const Vec< T, M > &  v  )  const [inline]

Vector-Vector subtraction operator.

Definition at line 759 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator-= ( const T  a  )  [inline]

Vector-Scalar decrement operator.

Parameters:
a the scalar by which to decrement each element of vector

Definition at line 829 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator-= ( const Vec< T, M > &  v  )  [inline]

Vector-Vector decrement operator.

Definition at line 768 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator/ ( const Vec< T, M > &  v  )  const [inline]

Element-wise division.

Definition at line 1028 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::operator/ ( const T  a  )  const [inline]

Vector-Scalar division operator.

Parameters:
a the scalar by which to divide each element of vector

Definition at line 871 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator/= ( const Vec< T, M > &  v  )  [inline]

Element-wise division assignment.

Definition at line 1044 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::operator/= ( const T  a  )  [inline]

Vector-Scalar division assignment operator.

Parameters:
a the scalar by which to divide each element of vector

Definition at line 889 of file rtcVec.h.

template<class T, int M>
Vec< bool, M > rtc::Vec< T, M >::operator< ( const Vec< T, M > &  v  )  const [inline]

Element-wise test for less.

Returns:
vector of boolean results

Definition at line 982 of file rtcVec.h.

template<class T, int M>
Vec< bool, M > rtc::Vec< T, M >::operator<= ( const Vec< T, M > &  v  )  const [inline]

Element-wise test for less or equal.

Returns:
vector of boolean results

Definition at line 962 of file rtcVec.h.

template<class T , int M>
template<class U >
Vec< T, M > & rtc::Vec< T, M >::operator= ( const Vec< U, M > &  v  )  [inline]

Set this vector equal to passed vector with type cast.

Parameters:
v the vector to replicate

Definition at line 301 of file rtcVec.h.

template<class T, int M>
Vec< T, M > & rtc::Vec< T, M >::operator= ( const Vec< T, M > &  v  )  [inline]

Set this vector equal to passed vector

Parameters:
v the vector to replicate

Definition at line 271 of file rtcVec.h.

template<class T, int M>
Vec< T, M > & rtc::Vec< T, M >::operator= ( const T *  d  )  [inline]

Set all elements from an array.

Parameters:
d pointer to the initalization array

Definition at line 262 of file rtcVec.h.

template<class T, int M>
Vec< T, M > & rtc::Vec< T, M >::operator= ( const T  a  )  [inline]

Set all elements equal to a scalar.

Parameters:
a the value to assign to all elements

Definition at line 253 of file rtcVec.h.

template<class T, int M>
bool rtc::Vec< T, M >::operator== ( const Vec< T, M > &  v  )  const [inline]

Element-wise test for equality.

Returns:
vector of boolean results

Definition at line 910 of file rtcVec.h.

template<class T, int M>
Vec< bool, M > rtc::Vec< T, M >::operator> ( const Vec< T, M > &  v  )  const [inline]

Element-wise test for greater.

Returns:
vector of boolean results

Definition at line 972 of file rtcVec.h.

template<class T, int M>
Vec< bool, M > rtc::Vec< T, M >::operator>= ( const Vec< T, M > &  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 952 of file rtcVec.h.

template<class T , int M>
T & rtc::Vec< T, M >::operator[] ( const int  i  )  [inline]

Get an element of the vector (by reference). Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
i the (zero based) index into the vector

Definition at line 361 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::operator[] ( const int  i  )  const [inline]

Get an element of the vector (by value). Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
i the (zero based) index into the vector

Definition at line 345 of file rtcVec.h.

template<class T, int M>
SMat< T, M > rtc::Vec< T, M >::outer (  )  const [inline]

Calculate the outer product with itself.

Returns:
the outer product matrix

Definition at line 639 of file rtcVec.h.

template<class T, int M>
SMat< T, M > rtc::Vec< T, M >::outer ( const Vec< T, M > &  v  )  const [inline]

Calculate the outer product with another vector.

Parameters:
v the other vector
Returns:
the outer product matrix

Definition at line 629 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::perform ( T(*)(T, T)  mathFun,
const Vec< T, M > &  v 
) [inline]

Pass each element through the given double-arg math function, replacing the current vector with the result.

Definition at line 547 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::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 537 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::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 527 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::performed ( T(*)(T, T)  mathFun,
const Vec< T, M > &  vp 
) [inline]

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

Returns:
a vector of the results

Definition at line 581 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::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 569 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::performed ( T(*)(T)  mathFun  )  [inline]

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

Returns:
a vector of the results

Definition at line 557 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::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 439 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::prod (  )  const [inline]

Find the product of the elements in the vector

Returns:
the product of the elements in the vector

Definition at line 515 of file rtcVec.h.

template<class T , int M>
bool rtc::Vec< T, M >::read ( InputHandler ih  )  [inline]

Restores state from a binary stream.

Definition at line 1060 of file rtcVec.h.

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

Set this vector equal to passed vector with type cast.

Parameters:
v the vector to replicate

Definition at line 293 of file rtcVec.h.

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

Set this vector equal to passed vector

Parameters:
v the vector to replicate

Definition at line 245 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::set ( const T  a  )  [inline]

Set all elements equal to a scalar.

Parameters:
a the value to assign to all elements

Definition at line 225 of file rtcVec.h.

template<class T, int M>
void rtc::Vec< T, M >::set ( const T *  d  )  [inline]

Set all elements from an array.

Parameters:
d pointer to the initalization array

Definition at line 237 of file rtcVec.h.

template<class T, int M>
template<int N>
void rtc::Vec< T, M >::setSubVec ( const int  i,
const Vec< T, N > &  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:
v the vector from which to copy values
i the (zero based) index of the start of the subvector

Definition at line 283 of file rtcVec.h.

template<class T , int M>
void rtc::Vec< T, M >::sort ( bool  ascending = true  )  [inline]

Sort elements in increasing order.

Returns:
sorted vector

Definition at line 692 of file rtcVec.h.

template<class T , int M>
Vec< T, M > rtc::Vec< T, M >::sorted ( bool  ascending = true  )  [inline]

Create a copy of the vector with elements sorted in increasing order.

Returns:
sorted vector

Definition at line 714 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::subtract ( const T  a  )  [inline]

Vector-Scalar subtraction.

Definition at line 810 of file rtcVec.h.

template<class T, int M>
Vec< T, M > & rtc::Vec< T, M >::subtract ( const Vec< T, M > &  v  )  [inline]

Vector-Vector subtraction.

Definition at line 733 of file rtcVec.h.

template<class T , int M>
T rtc::Vec< T, M >::sum (  )  const [inline]

Find the sum of the elements in the vector

Returns:
the sum of the elements in the vector

Definition at line 491 of file rtcVec.h.

template<class T, int M>
Vec< T, M > rtc::Vec< T, M >::uniformRand ( const T  a = T(0),
const T  b = T(1) 
) [inline, static]

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

Parameters:
a start of range
b end of range
Returns:
vector of uniform samples

Definition at line 653 of file rtcVec.h.

template<class T , int M>
bool rtc::Vec< T, M >::write ( OutputHandler oh  )  const [inline]

Writes state to a binary stream.

Definition at line 1053 of file rtcVec.h.


Member Data Documentation

template<class T, int M>
T rtc::Vec< T, M >::x[M]

storage array

Definition at line 161 of file rtcVec.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


rtc
Author(s): Benjamin Pitzer
autogenerated on Sun Mar 3 11:08:33 2013