Public Member Functions | Static Public Member Functions | Public Attributes
rtc::Mat< T, M, N > Class Template Reference

#include <rtcMat.h>

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

List of all members.

Public Member Functions

Mat< T, M, N > & add (const Mat< T, M, N > &m)
Mat< T, M, N > & add (const T a)
int compareTo (const Mat< T, M, N > &m) const
SMat< T, N > covarianceMatrixOfRows () const
bool equalTo (const Mat< T, M, N > &m, const T tol=T(0)) const
Vec< T, M > getCol (int c) const
Vec< T, N > getRow (int r) const
template<int P, int Q>
Mat< T, P, Q > getSubMat (const int i, const int j)
interpolate (const float i, const float j) const
 Mat ()
 Mat (const T *d)
 Mat (const T a)
 Mat (const Mat< T, M, N > &m)
template<class U >
 Mat (const Mat< U, M, N > &m)
Vec< T, N > meanOfRows () const
Mat< bool, M, N > operator!= (const Mat< T, M, N > &m) const
operator() (const int r, const int c) const
T & operator() (const int r, const int c)
Mat< T, M, N > operator* (const T a) const
Vec< T, M > operator* (const Vec< T, N > &v) const
template<int P>
Mat< T, M, P > operator* (const Mat< T, N, P > &m) const
void operator*= (const T a)
void operator*= (const Mat< T, N, N > &m)
Mat< T, M, N > operator+ (const Mat< T, M, N > &m) const
Mat< T, M, N > operator+ (const T a) const
void operator+= (const Mat< T, M, N > &m)
void operator+= (const T a)
Mat< T, M, N > operator- (const Mat< T, M, N > &m) const
Mat< T, M, N > operator- () const
Mat< T, M, N > operator- (const T a) const
void operator-= (const Mat< T, M, N > &m)
void operator-= (const T a)
Mat< T, M, N > operator/ (const T a) const
void operator/= (const T a)
Mat< bool, M, N > operator< (const Mat< T, M, N > &m) const
Mat< bool, M, N > operator<= (const Mat< T, M, N > &m) const
Mat< T, M, N > & operator= (const T *d)
Mat< T, M, N > & operator= (const T a)
Mat< T, M, N > & operator= (const Mat< T, M, N > &m)
template<class U >
Mat< T, M, N > & operator= (const Mat< U, M, N > &m)
Mat< bool, M, N > operator== (const Mat< T, M, N > &m) const
Mat< bool, M, N > operator> (const Mat< T, M, N > &m) const
Mat< bool, M, N > operator>= (const Mat< T, M, N > &m) const
void perform (T(*mathFun)(T))
bool read (InputHandler &ih)
void set (const T *d)
void set (const T a)
void set (const Mat< T, M, N > &m)
template<class U >
void set (const Mat< U, M, N > &m)
void setCol (const int j, const Vec< T, M > &v)
void setRow (const int i, const Vec< T, N > &v)
template<int P, int Q>
void setSubMat (const int r, const int c, const Mat< T, P, Q > &m)
Mat< T, M, N > & subtract (const Mat< T, M, N > &m)
Mat< T, M, N > & subtract (const T a)
Vec< T, N > sum () const
Mat< T, N, M > transposed () const
bool write (OutputHandler &oh) const

Static Public Member Functions

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

Public Attributes

x [M *N]
 storage array

Detailed Description

template<class T, int M, int N>
class rtc::Mat< T, M, N >

An MxN matrix.

Definition at line 41 of file rtcMat.h.


Constructor & Destructor Documentation

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

Ctor that doesn't initialize anything.

Definition at line 168 of file rtcMat.h.

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

Ctor that initializes from an array.

Parameters:
dthe (row major) data array of length M*N

Definition at line 174 of file rtcMat.h.

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

Ctor that initializes ALL ELEMENTS to a scalar value.

Parameters:
athe value to which all elements will be set

Definition at line 182 of file rtcMat.h.

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

Ctor that initializes from passed matrix.

Parameters:
mthe matrix to be copied.

Definition at line 190 of file rtcMat.h.

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

Casting Ctor that initializes from passed matrix with type cast.

Parameters:
mthe matrix to replicate.

Definition at line 200 of file rtcMat.h.


Member Function Documentation

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

Addition.

Definition at line 448 of file rtcMat.h.

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

Addition.

Definition at line 509 of file rtcMat.h.

template<class T, int M, int N>
int rtc::Mat< T, M, N >::compareTo ( const Mat< T, M, N > &  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 712 of file rtcMat.h.

template<class T , int M, int N>
SMat< T, N > rtc::Mat< T, M, N >::covarianceMatrixOfRows ( ) const [inline]

Definition at line 852 of file rtcMat.h.

template<class T, int M, int N>
bool rtc::Mat< T, M, N >::equalTo ( const Mat< T, M, N > &  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 727 of file rtcMat.h.

template<class T , int M, int N>
Vec< T, M > rtc::Mat< T, M, N >::getCol ( int  j) const [inline]

Get a column. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
jzero based index of column to get

Definition at line 405 of file rtcMat.h.

template<class T , int M, int N>
Vec< T, N > rtc::Mat< T, M, N >::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 385 of file rtcMat.h.

template<class T , int M, int N>
template<int P, int Q>
Mat< T, P, Q > rtc::Mat< T, M, N >::getSubMat ( const int  i,
const int  j 
) [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

Definition at line 426 of file rtcMat.h.

template<class T , int M, int N>
T rtc::Mat< T, M, N >::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 815 of file rtcMat.h.

template<class T , int M, int N>
Vec< T, N > rtc::Mat< T, M, N >::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 840 of file rtcMat.h.

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

Create matrix of samples from a multivariate gaussian distribution.

Parameters:
meanmean of normal distribution
covcovariance normal distribution
Returns:
matrix of normal samples

Definition at line 778 of file rtcMat.h.

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

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 766 of file rtcMat.h.

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

Element-wise test for inequality.

Returns:
matrix of boolean results

Definition at line 661 of file rtcMat.h.

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

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

Parameters:
izero based row index
jzero based col index

Definition at line 346 of file rtcMat.h.

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

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

Parameters:
izero based row index
jzero based col index

Definition at line 366 of file rtcMat.h.

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

Matrix-Scalar multiplication operator.

Definition at line 561 of file rtcMat.h.

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

Matrix-Vector multiplication operator.

Definition at line 604 of file rtcMat.h.

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

Matrix-Matrix multiplication operator.

Definition at line 628 of file rtcMat.h.

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

Matrix-Scalar multiplication assignement operator.

Definition at line 570 of file rtcMat.h.

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

Matrix-Matrix multiplication assignement operator.

Definition at line 641 of file rtcMat.h.

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

Addition operator.

Definition at line 466 of file rtcMat.h.

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

Addition operator.

Definition at line 527 of file rtcMat.h.

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

Addition assignment operator.

Definition at line 475 of file rtcMat.h.

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

Addition assignment operator.

Definition at line 536 of file rtcMat.h.

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

Subtraction operator.

Definition at line 482 of file rtcMat.h.

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

Negation operator.

Definition at line 498 of file rtcMat.h.

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

Subtraction operator.

Definition at line 543 of file rtcMat.h.

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

Subtraction assignment operator.

Definition at line 491 of file rtcMat.h.

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

Subtraction assignment operator.

Definition at line 552 of file rtcMat.h.

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

Matrix-Scalar division operator.

Definition at line 577 of file rtcMat.h.

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

Matrix-Scalar division assignement operator.

Definition at line 586 of file rtcMat.h.

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

Element-wise test for less.

Returns:
matrix of boolean results

Definition at line 701 of file rtcMat.h.

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

Element-wise test for less or equal.

Returns:
matrix of boolean results

Definition at line 681 of file rtcMat.h.

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

Set from an array.

Parameters:
dthe (row major) data array of length M*N

Definition at line 235 of file rtcMat.h.

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

Set all elements to a scalar value.

Parameters:
athe value to which all elements will be set

Definition at line 244 of file rtcMat.h.

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

Set from another matrix.

Parameters:
mthe matrix to replicate.

Definition at line 253 of file rtcMat.h.

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

Set from another matrix with type cast.

Parameters:
mthe matrix to replicate.

Definition at line 333 of file rtcMat.h.

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

Element-wise test for equality.

Returns:
matrix of boolean results

Definition at line 651 of file rtcMat.h.

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

Element-wise test for greater.

Returns:
matrix of boolean results

Definition at line 691 of file rtcMat.h.

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

Element-wise test for greater or equal.

Returns:
matrix of boolean results

Definition at line 671 of file rtcMat.h.

template<class T, int M, int N>
void rtc::Mat< T, M, N >::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 795 of file rtcMat.h.

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

Restore state from a stream.

Definition at line 900 of file rtcMat.h.

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

Set from an array.

Parameters:
dthe (row major) data array of length M*N

Definition at line 210 of file rtcMat.h.

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

Set all elements to a scalar value.

Parameters:
athe value to which all elements will be set

Definition at line 218 of file rtcMat.h.

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

Set from another matrix.

Parameters:
mthe matrix to replicate.

Definition at line 227 of file rtcMat.h.

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

Set from another matrix with type cast.

Parameters:
mthe matrix to replicate.

Definition at line 325 of file rtcMat.h.

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

Set a column. Does bounds checking if MATMATH_CHECK_BOUNDS is set

Parameters:
jzero based index of col to set
vsource vector

Definition at line 283 of file rtcMat.h.

template<class T, int M, int N>
void rtc::Mat< T, M, N >::setRow ( const int  i,
const Vec< T, N > &  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 264 of file rtcMat.h.

template<class T, int M, int N>
template<int P, int Q>
void rtc::Mat< T, M, N >::setSubMat ( const int  i,
const int  j,
const Mat< T, P, Q > &  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 303 of file rtcMat.h.

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

Subtraction.

Definition at line 456 of file rtcMat.h.

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

Subtraction.

Definition at line 517 of file rtcMat.h.

template<class T , int M, int N>
Vec< T, N > rtc::Mat< T, M, N >::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 803 of file rtcMat.h.

template<class T , int M, int N>
Mat< T, N, M > rtc::Mat< T, M, N >::transposed ( ) const [inline]

Return the transpose of the matrix without modifying matrix.

Definition at line 738 of file rtcMat.h.

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

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 754 of file rtcMat.h.

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

Write state to a stream.

Definition at line 893 of file rtcMat.h.


Member Data Documentation

template<class T, int M, int N>
T rtc::Mat< T, M, N >::x[M *N]

storage array

Definition at line 44 of file rtcMat.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