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

#include <rtcVarMat.h>

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

List of all members.

Public Member Functions

VarMat< T > & add (const VarMat< T > &m)
VarMat< T > & add (const T a)
void addSubMat (int r, int c, const VarMat< T > &m)
int compareTo (const VarMat< T > &m) const
VarSMat< T > covarianceMatrixOfRows () const
bool equalTo (const VarMat< T > &m, const T tol=T(0)) const
VarVec< T > getCol (int c) const
VarVec< T > getRow (int r) const
VarMat< T > getSubMat (int i, int j, int sub_rows, int sub_cols)
interpolate (const float i, const float j) const
int length () const
VarVec< T > meanOfRows () const
VarMat< T > normalRand (const T mean=T(0), const T stdev=T(1))
VarMat< bool > operator!= (const VarMat< T > &m) const
VarMat< T > operator* (const T a) const
VarVec< T > operator* (const VarVec< T > &v) const
VarMat< T > operator* (const VarMat< T > &m) const
void operator*= (const T a)
void operator*= (const VarMat< T > &m)
VarMat< T > operator+ (const VarMat< T > &m) const
VarMat< T > operator+ (const T a) const
void operator+= (const VarMat< T > &m)
void operator+= (const T a)
VarMat< T > operator- (const VarMat< T > &m) const
VarMat< T > operator- () const
VarMat< T > operator- (const T a) const
void operator-= (const VarMat< T > &m)
void operator-= (const T a)
VarMat< T > operator/ (const T a) const
void operator/= (const T a)
VarMat< bool > operator< (const VarMat< T > &m) const
VarMat< bool > operator<= (const VarMat< T > &m) const
template<class U >
VarMat< T > & operator= (const VarMat< U > &m)
template<class U , int M, int N>
VarMat< T > & operator= (const Mat< U, M, N > &m)
VarMat< bool > operator== (const VarMat< T > &m) const
VarMat< bool > operator> (const VarMat< T > &m) const
VarMat< bool > operator>= (const VarMat< T > &m) const
void perform (T(*mathFun)(T))
template<class U >
void set (const VarMat< U > &m)
template<class U , int M, int N>
void set (const Mat< U, M, N > &m)
void setCol (int j, const VarVec< T > &v)
void setRow (int i, const VarVec< T > &v)
void setSubMat (int r, int c, const VarMat< T > &m)
VarMat< T > & subtract (const VarMat< T > &m)
VarMat< T > & subtract (const T a)
void subtractSubMat (int r, int c, const VarMat< T > &m)
VarVec< T > sum () const
VarMat< T > transposed () const
VarMat< T > uniformRand (const T a=T(0), const T b=T(1))
 VarMat ()
 VarMat (int rows, int cols)
 VarMat (int rows, int cols, const T *d)
 VarMat (int rows, int cols, const T a)
 VarMat (const Array< T, 2 > &a)
template<class U >
 VarMat (const VarMat< U > &m)
template<class U , int M, int N>
 VarMat (const Mat< U, M, N > &m)

Detailed Description

template<class T>
class rtc::VarMat< T >

Mathematical matrix container class.

The VarMat class allows the representation of n x m matrices. The rows will be indexed between 0 and n-1, and the columns between 0 and m-1.

The matrix class is a container class implemented as template.

If you need to create a matrix of floats with 20 rows and 15 columns, all elements initialized with an initial value of 4.27 just create it:

 rtc::VarMat<float> myMat(20,15,4.27f) // creates matrix with 300 elements
                                       // all initialized with 4.27f

To access the matrix elements use the access operators. There are many possibilities. With at(const int row, const int col) is possible to access an element directly.

Definition at line 60 of file rtcVarMat.h.


Constructor & Destructor Documentation

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

default Ctor

Definition at line 191 of file rtcVarMat.h.

template<class T >
rtc::VarMat< T >::VarMat ( int  rows,
int  cols 
) [inline]

Ctor that initializes an empty matrix.

Parameters:
rowsthe number of rows
colsthe number of columns

Definition at line 198 of file rtcVarMat.h.

template<class T >
rtc::VarMat< T >::VarMat ( int  rows,
int  cols,
const T *  d 
) [inline]

Ctor that initializes from an array.

Parameters:
rowsthe number of rows
colsthe number of columns
dthe (row major) data array of length rows*cols

Definition at line 207 of file rtcVarMat.h.

template<class T >
rtc::VarMat< T >::VarMat ( int  rows,
int  cols,
const T  a 
) [inline]

Ctor that initializes ALL ELEMENTS to a scalar value.

Parameters:
rowsthe number of rows
colsthe number of columns
athe value to which all elements will be set

Definition at line 216 of file rtcVarMat.h.

template<class T >
rtc::VarMat< T >::VarMat ( const Array< T, 2 > &  a) [inline]

Ctor that initializes from passed matrix.

Parameters:
athe matrix to be copied.

Definition at line 223 of file rtcVarMat.h.

template<class T >
template<class U >
rtc::VarMat< T >::VarMat ( const VarMat< U > &  m) [inline]

Casting Ctor that initializes from passed matrix with type cast.

Parameters:
mthe matrix to be copied.

Definition at line 232 of file rtcVarMat.h.

template<class T >
template<class U , int M, int N>
rtc::VarMat< T >::VarMat ( const Mat< U, M, N > &  m) [inline]

Casting Ctor that initializes from passed matrix with type cast.

Parameters:
mthe matrix to be copied.

Definition at line 243 of file rtcVarMat.h.


Member Function Documentation

template<class T >
VarMat< T > & rtc::VarMat< T >::add ( const VarMat< T > &  m) [inline]

Addition.

Definition at line 422 of file rtcVarMat.h.

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

Addition.

Definition at line 573 of file rtcVarMat.h.

template<class T >
void rtc::VarMat< T >::addSubMat ( int  i,
int  j,
const VarMat< T > &  m 
) [inline]

Add a sub-matrix. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
izero based index of top row of sub-matrix
jzero based index of left col of sub-matrix
mmatrix to be placed with UL corner at (i,j)

Definition at line 442 of file rtcVarMat.h.

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

Compare the entire matrix to the passed matrix.

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

Definition at line 855 of file rtcVarMat.h.

template<class T >
VarSMat< T > rtc::VarMat< T >::covarianceMatrixOfRows ( ) const [inline]

Definition at line 1119 of file rtcVarMat.h.

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

Compare the entire matrix to the passed matrix.

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

Definition at line 878 of file rtcVarMat.h.

template<class T >
VarVec< T > rtc::VarMat< T >::getCol ( int  j) const [inline]

Get a column. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
jzero based index of row to get
Returns:
a column vector

Definition at line 378 of file rtcVarMat.h.

template<class T >
VarVec< T > rtc::VarMat< T >::getRow ( int  i) const [inline]

Get a row. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
izero based index of row to get

Definition at line 358 of file rtcVarMat.h.

template<class T >
VarMat< T > rtc::VarMat< T >::getSubMat ( int  i,
int  j,
int  sub_rows,
int  sub_cols 
) [inline]

Get a sub-matrix. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
izero based index of top row of sub-matrix
jzero based index of left col of sub-matrix
sub_rowsnumber of rows in sub-matrix
sub_colsnumber of columns in sub-matrix
Returns:
a sub-matrix

Definition at line 401 of file rtcVarMat.h.

template<class T >
T rtc::VarMat< T >::interpolate ( const float  i,
const float  j 
) const [inline]

Use bilinear interpolation to approximate values between the elements of matrices.

Returns:
the bilinear interpolation at i,j

Definition at line 1079 of file rtcVarMat.h.

template<class T >
int rtc::VarMat< T >::length ( ) const [inline]

Returns the number of matrix elements

Returns:
the number of matrix elements

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

Definition at line 349 of file rtcVarMat.h.

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

The meanOfRows means the mean of all rows, i.e. a row vector containing (for the arithmetical mean) the sum of all row vectors divided by the number of rows.

Returns:
the mean of all rows

Definition at line 1106 of file rtcVarMat.h.

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

Create matrix of samples from a normal distribution.

Parameters:
meanmean of normal distribution
stdevstandard deviation of normal distribution
Returns:
matrix of normal samples

Definition at line 925 of file rtcVarMat.h.

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

Element-wise test for inequality.

Returns:
matrix of boolean results

Definition at line 764 of file rtcVarMat.h.

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

Matrix-Scalar multiplication operator.

Definition at line 625 of file rtcVarMat.h.

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

Matrix-Vector multiplication operator.

Definition at line 668 of file rtcVarMat.h.

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

Matrix-Matrix multiplication operator.

Definition at line 708 of file rtcVarMat.h.

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

Matrix-Scalar multiplication assignement operator.

Definition at line 634 of file rtcVarMat.h.

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

Matrix-Matrix multiplication assignement operator.

Definition at line 728 of file rtcVarMat.h.

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

Addition operator.

Definition at line 498 of file rtcVarMat.h.

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

Addition operator.

Definition at line 591 of file rtcVarMat.h.

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

Addition assignment operator.

Definition at line 515 of file rtcVarMat.h.

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

Addition assignment operator.

Definition at line 600 of file rtcVarMat.h.

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

Subtraction operator.

Definition at line 530 of file rtcVarMat.h.

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

Negation operator.

Definition at line 562 of file rtcVarMat.h.

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

Subtraction operator.

Definition at line 607 of file rtcVarMat.h.

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

Subtraction assignment operator.

Definition at line 547 of file rtcVarMat.h.

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

Subtraction assignment operator.

Definition at line 616 of file rtcVarMat.h.

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

Matrix-Scalar division operator.

Definition at line 641 of file rtcVarMat.h.

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

Matrix-Scalar division assignement operator.

Definition at line 650 of file rtcVarMat.h.

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

Element-wise test for less.

Returns:
matrix of boolean results

Definition at line 836 of file rtcVarMat.h.

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

Element-wise test for less or equal.

Returns:
matrix of boolean results

Definition at line 800 of file rtcVarMat.h.

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

Set from another matrix with type cast.

Parameters:
mthe matrix to replicate.

Definition at line 331 of file rtcVarMat.h.

template<class T >
template<class U , int M, int N>
VarMat< T > & rtc::VarMat< T >::operator= ( const Mat< U, M, N > &  m) [inline]

Set from another matrix with type cast.

Parameters:
mthe matrix to replicate.

Definition at line 339 of file rtcVarMat.h.

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

Element-wise test for equality.

Returns:
matrix of boolean results

Definition at line 746 of file rtcVarMat.h.

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

Element-wise test for greater.

Returns:
matrix of boolean results

Definition at line 818 of file rtcVarMat.h.

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

Element-wise test for greater or equal.

Returns:
matrix of boolean results

Definition at line 782 of file rtcVarMat.h.

template<class T >
void rtc::VarMat< 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 1059 of file rtcVarMat.h.

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

Set from another matrix with type cast.

Parameters:
mthe matrix to replicate.

Definition at line 313 of file rtcVarMat.h.

template<class T >
template<class U , int M, int N>
void rtc::VarMat< T >::set ( const Mat< U, M, N > &  m) [inline]

Set from another matrix with type cast.

Parameters:
mthe matrix to replicate.

Definition at line 322 of file rtcVarMat.h.

template<class T >
void rtc::VarMat< T >::setCol ( int  j,
const VarVec< T > &  v 
) [inline]

Set a column. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
izero based index of col to set
vsource vector

Definition at line 274 of file rtcVarMat.h.

template<class T >
void rtc::VarMat< T >::setRow ( int  i,
const VarVec< T > &  v 
) [inline]

Set a row. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
izero based index of row to set
vsource vector

Definition at line 256 of file rtcVarMat.h.

template<class T >
void rtc::VarMat< T >::setSubMat ( int  i,
int  j,
const VarMat< T > &  m 
) [inline]

Set a sub-matrix. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
izero based index of top row of sub-matrix
jzero based index of left col of sub-matrix
mmatrix to be placed with UL corner at (i,j)

Definition at line 293 of file rtcVarMat.h.

template<class T >
VarMat< T > & rtc::VarMat< T >::subtract ( const VarMat< T > &  m) [inline]

Subtraction.

Definition at line 459 of file rtcVarMat.h.

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

Subtraction.

Definition at line 581 of file rtcVarMat.h.

template<class T >
void rtc::VarMat< T >::subtractSubMat ( int  i,
int  j,
const VarMat< T > &  m 
) [inline]

Subtract a sub-matrix. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
izero based index of top row of sub-matrix
jzero based index of left col of sub-matrix
mmatrix to be placed with UL corner at (i,j)

Definition at line 479 of file rtcVarMat.h.

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

Find the sum of the elements in each column in the matrix

Returns:
the sum of the elements in each column in the matrix

Definition at line 1067 of file rtcVarMat.h.

template<class T >
VarMat< T > rtc::VarMat< T >::transposed ( ) const [inline]

Return the transpose of the matrix without modifying matrix.

Definition at line 897 of file rtcVarMat.h.

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

Create matrix of samples from a uniform distribution on [a,b].

Parameters:
astart of range
bend of range
Returns:
matrix of uniform samples

Definition at line 913 of file rtcVarMat.h.


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


rtc
Author(s): Benjamin Pitzer
autogenerated on Thu Jan 2 2014 11:04:54