#include <rtcVarMat.h>
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) |
T | 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) |
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.
rtc::VarMat< T >::VarMat | ( | ) | [inline] |
default Ctor
Definition at line 191 of file rtcVarMat.h.
rtc::VarMat< T >::VarMat | ( | int | rows, |
int | cols | ||
) | [inline] |
Ctor that initializes an empty matrix.
rows | the number of rows |
cols | the number of columns |
Definition at line 198 of file rtcVarMat.h.
rtc::VarMat< T >::VarMat | ( | int | rows, |
int | cols, | ||
const T * | d | ||
) | [inline] |
Ctor that initializes from an array.
rows | the number of rows |
cols | the number of columns |
d | the (row major) data array of length rows*cols |
Definition at line 207 of file rtcVarMat.h.
rtc::VarMat< T >::VarMat | ( | int | rows, |
int | cols, | ||
const T | a | ||
) | [inline] |
Ctor that initializes ALL ELEMENTS to a scalar value.
rows | the number of rows |
cols | the number of columns |
a | the value to which all elements will be set |
Definition at line 216 of file rtcVarMat.h.
rtc::VarMat< T >::VarMat | ( | const Array< T, 2 > & | a | ) | [inline] |
Ctor that initializes from passed matrix.
a | the matrix to be copied. |
Definition at line 223 of file rtcVarMat.h.
Casting Ctor that initializes from passed matrix with type cast.
m | the matrix to be copied. |
Definition at line 232 of file rtcVarMat.h.
rtc::VarMat< T >::VarMat | ( | const Mat< U, M, N > & | m | ) | [inline] |
Casting Ctor that initializes from passed matrix with type cast.
m | the matrix to be copied. |
Definition at line 243 of file rtcVarMat.h.
VarMat< T > & rtc::VarMat< T >::add | ( | const VarMat< T > & | m | ) | [inline] |
Addition.
Definition at line 422 of file rtcVarMat.h.
VarMat< T > & rtc::VarMat< T >::add | ( | const T | a | ) | [inline] |
Addition.
Definition at line 573 of file rtcVarMat.h.
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
i | zero based index of top row of sub-matrix |
j | zero based index of left col of sub-matrix |
m | matrix to be placed with UL corner at (i,j) |
Definition at line 442 of file rtcVarMat.h.
int rtc::VarMat< T >::compareTo | ( | const VarMat< T > & | m | ) | const [inline] |
Compare the entire matrix to the passed matrix.
Definition at line 855 of file rtcVarMat.h.
VarSMat< T > rtc::VarMat< T >::covarianceMatrixOfRows | ( | ) | const [inline] |
Definition at line 1119 of file rtcVarMat.h.
bool rtc::VarMat< T >::equalTo | ( | const VarMat< T > & | m, |
const T | tol = T(0) |
||
) | const [inline] |
Compare the entire matrix to the passed matrix.
Definition at line 878 of file rtcVarMat.h.
VarVec< T > rtc::VarMat< T >::getCol | ( | int | j | ) | const [inline] |
Get a column. Does bounds checking if MATMATH_CHECK_BOUNDS is set
j | zero based index of row to get |
Definition at line 378 of file rtcVarMat.h.
VarVec< T > rtc::VarMat< T >::getRow | ( | int | i | ) | const [inline] |
Get a row. Does bounds checking if MATMATH_CHECK_BOUNDS is set
i | zero based index of row to get |
Definition at line 358 of file rtcVarMat.h.
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
i | zero based index of top row of sub-matrix |
j | zero based index of left col of sub-matrix |
sub_rows | number of rows in sub-matrix |
sub_cols | number of columns in sub-matrix |
Definition at line 401 of file rtcVarMat.h.
T rtc::VarMat< T >::interpolate | ( | const float | i, |
const float | j | ||
) | const [inline] |
Use bilinear interpolation to approximate values between the elements of matrices.
Definition at line 1079 of file rtcVarMat.h.
int rtc::VarMat< T >::length | ( | ) | const [inline] |
Returns the number of matrix elements
Reimplemented from rtc::Array< T, 2 >.
Definition at line 349 of file rtcVarMat.h.
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.
Definition at line 1106 of file rtcVarMat.h.
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.
mean | mean of normal distribution |
stdev | standard deviation of normal distribution |
Definition at line 925 of file rtcVarMat.h.
VarMat< bool > rtc::VarMat< T >::operator!= | ( | const VarMat< T > & | m | ) | const [inline] |
Element-wise test for inequality.
Definition at line 764 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator* | ( | const T | a | ) | const [inline] |
Matrix-Scalar multiplication operator.
Definition at line 625 of file rtcVarMat.h.
VarVec< T > rtc::VarMat< T >::operator* | ( | const VarVec< T > & | v | ) | const [inline] |
Matrix-Vector multiplication operator.
Definition at line 668 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator* | ( | const VarMat< T > & | m | ) | const [inline] |
Matrix-Matrix multiplication operator.
Definition at line 708 of file rtcVarMat.h.
void rtc::VarMat< T >::operator*= | ( | const T | a | ) | [inline] |
Matrix-Scalar multiplication assignement operator.
Definition at line 634 of file rtcVarMat.h.
void rtc::VarMat< T >::operator*= | ( | const VarMat< T > & | m | ) | [inline] |
Matrix-Matrix multiplication assignement operator.
Definition at line 728 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator+ | ( | const VarMat< T > & | m | ) | const [inline] |
Addition operator.
Definition at line 498 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator+ | ( | const T | a | ) | const [inline] |
Addition operator.
Definition at line 591 of file rtcVarMat.h.
void rtc::VarMat< T >::operator+= | ( | const VarMat< T > & | m | ) | [inline] |
Addition assignment operator.
Definition at line 515 of file rtcVarMat.h.
void rtc::VarMat< T >::operator+= | ( | const T | a | ) | [inline] |
Addition assignment operator.
Definition at line 600 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator- | ( | const VarMat< T > & | m | ) | const [inline] |
Subtraction operator.
Definition at line 530 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator- | ( | ) | const [inline] |
Negation operator.
Definition at line 562 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator- | ( | const T | a | ) | const [inline] |
Subtraction operator.
Definition at line 607 of file rtcVarMat.h.
void rtc::VarMat< T >::operator-= | ( | const VarMat< T > & | m | ) | [inline] |
Subtraction assignment operator.
Definition at line 547 of file rtcVarMat.h.
void rtc::VarMat< T >::operator-= | ( | const T | a | ) | [inline] |
Subtraction assignment operator.
Definition at line 616 of file rtcVarMat.h.
VarMat< T > rtc::VarMat< T >::operator/ | ( | const T | a | ) | const [inline] |
Matrix-Scalar division operator.
Definition at line 641 of file rtcVarMat.h.
void rtc::VarMat< T >::operator/= | ( | const T | a | ) | [inline] |
Matrix-Scalar division assignement operator.
Definition at line 650 of file rtcVarMat.h.
VarMat< bool > rtc::VarMat< T >::operator< | ( | const VarMat< T > & | m | ) | const [inline] |
Element-wise test for less.
Definition at line 836 of file rtcVarMat.h.
VarMat< bool > rtc::VarMat< T >::operator<= | ( | const VarMat< T > & | m | ) | const [inline] |
Element-wise test for less or equal.
Definition at line 800 of file rtcVarMat.h.
VarMat< T > & rtc::VarMat< T >::operator= | ( | const VarMat< U > & | m | ) | [inline] |
Set from another matrix with type cast.
m | the matrix to replicate. |
Definition at line 331 of file rtcVarMat.h.
VarMat< T > & rtc::VarMat< T >::operator= | ( | const Mat< U, M, N > & | m | ) | [inline] |
Set from another matrix with type cast.
m | the matrix to replicate. |
Definition at line 339 of file rtcVarMat.h.
VarMat< bool > rtc::VarMat< T >::operator== | ( | const VarMat< T > & | m | ) | const [inline] |
Element-wise test for equality.
Definition at line 746 of file rtcVarMat.h.
VarMat< bool > rtc::VarMat< T >::operator> | ( | const VarMat< T > & | m | ) | const [inline] |
Element-wise test for greater.
Definition at line 818 of file rtcVarMat.h.
VarMat< bool > rtc::VarMat< T >::operator>= | ( | const VarMat< T > & | m | ) | const [inline] |
Element-wise test for greater or equal.
Definition at line 782 of file rtcVarMat.h.
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.
Set from another matrix with type cast.
m | the matrix to replicate. |
Definition at line 313 of file rtcVarMat.h.
void rtc::VarMat< T >::set | ( | const Mat< U, M, N > & | m | ) | [inline] |
Set from another matrix with type cast.
m | the matrix to replicate. |
Definition at line 322 of file rtcVarMat.h.
void rtc::VarMat< T >::setCol | ( | int | j, |
const VarVec< T > & | v | ||
) | [inline] |
Set a column. Does bounds checking if MATMATH_CHECK_BOUNDS is set
i | zero based index of col to set |
v | source vector |
Definition at line 274 of file rtcVarMat.h.
void rtc::VarMat< T >::setRow | ( | int | i, |
const VarVec< T > & | v | ||
) | [inline] |
Set a row. Does bounds checking if MATMATH_CHECK_BOUNDS is set
i | zero based index of row to set |
v | source vector |
Definition at line 256 of file rtcVarMat.h.
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
i | zero based index of top row of sub-matrix |
j | zero based index of left col of sub-matrix |
m | matrix to be placed with UL corner at (i,j) |
Definition at line 293 of file rtcVarMat.h.
VarMat< T > & rtc::VarMat< T >::subtract | ( | const VarMat< T > & | m | ) | [inline] |
Subtraction.
Definition at line 459 of file rtcVarMat.h.
VarMat< T > & rtc::VarMat< T >::subtract | ( | const T | a | ) | [inline] |
Subtraction.
Definition at line 581 of file rtcVarMat.h.
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
i | zero based index of top row of sub-matrix |
j | zero based index of left col of sub-matrix |
m | matrix to be placed with UL corner at (i,j) |
Definition at line 479 of file rtcVarMat.h.
VarVec< T > rtc::VarMat< T >::sum | ( | ) | const [inline] |
Find the sum of the elements in each column in the matrix
Definition at line 1067 of file rtcVarMat.h.
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.
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].
a | start of range |
b | end of range |
Definition at line 913 of file rtcVarMat.h.