Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
numeric::MathMatrix< T > Class Template Reference

#include <MathMatrix.hh>

Public Member Functions

 MathMatrix ()
 default constructor More...
 
 MathMatrix (const Size NUMBER_ROWS, const Size NUMBER_COLS, const T &FILL_VALUE=T(0))
 construct from dimension and possible filler More...
 
 MathMatrix (const Size NUMBER_ROWS, const Size NUMBER_COLS, const T *DATA)
 construct from dimension and pointer to data More...
 
 MathMatrix (MathMatrix const &MATRIX)
 copy constructor from Matrix More...
 
MathMatrix< T > * Clone () const
 Clone function. More...
 
 ~MathMatrix ()
 destructor More...
 
Size get_number_rows () const
 get number of rows More...
 
Size get_number_cols () const
 get number of columns More...
 
Size get_number_elements () const
 number of elements More...
 
Size size () const
 number of elements More...
 
const Tbegin () const
 pointer to First Element More...
 
Tbegin ()
 pointer to First Element More...
 
const Tend () const
 pointer to end of range More...
 
Tend ()
 pointer to end of range More...
 
MathVector< Tget_row (const Size ROW) const
 
MathVector< Tget_col (const Size COL) const
 
bool is_square () const
 is matrix a square matrix More...
 
bool is_diagonal () const
 is matrix a diagonal matrix More...
 
bool is_tri_diagonal () const
 is matrix a tridiagonal matrix More...
 
bool same_dimensions (const MathMatrix< T > &MATRIX_LHS, const MathMatrix< T > &MATRIX_RHS)
 check dimension agreement of two Matrices More...
 
bool inverse_dimensions (const MathMatrix< T > &MATRIX_LHS, const MathMatrix< T > &MATRIX_RHS)
 check inverse dimension agreement of two Matrices comapre number ros of lhs with number cols of rhs and number cols of lhs with number rows of rhs More...
 
bool multiplication_dimension (const MathMatrix< T > &MATRIX_LHS, const MathMatrix< T > &MATRIX_RHS)
 check dimensions for multiplication A*B compare number cols of lhs with number rows of rhs More...
 
MathMatrix< T > & set_zero ()
 
MathMatrix< Ttranspose (const MathMatrix< T > &MATRIX)
 
MathMatrix< T > & inverse ()
 
MathMatrix< T > & transpose ()
 
MathMatrix< T > & inverse_rectangular_matrix ()
 
MathMatrix< Tinverse_square_matrix ()
 invert small square matrices exactly More...
 
MathMatrix< T > & inverse_diagonal_matrix ()
 
MathMatrix< T > & inverse_tridiagonal_matrix ()
 
MathMatrix< T > & set_unit ()
 
Size pivot (const Size ROW)
 
MathMatrix< T > & replace_row (const Size ROW, const MathVector< T > &VECTOR)
 
MathMatrix< T > & replace_col (const Size COL, const MathVector< T > &VECTOR)
 
MathMatrix< T > & swap_rows (const Size ROW_A, const Size ROW_B)
 
MathMatrix< T > & swap_cols (const Size COL_A, const Size COL_B)
 
bool IsValidPosition (const Size ROW, const Size COL) const
 
Toperator() (const Size ROW, const Size COL)
 return reference to changeable element ( ROW, COL) More...
 
const Toperator() (const Size ROW, const Size COL) const
 return reference to const element ( ROW, COL) More...
 
MathMatrix< T > & operator= (const MathMatrix< T > &MATRIX)
 assignment from Matrix More...
 
MathMatrix< T > & operator= (const T &VALUE)
 assignment from value More...
 
Toperator[] (const Size ROW)
 C-style data access with [] gives a pointer on a ROW. More...
 
const Toperator[] (const Size ROW) const
 C-style data access with [] gives a pointer on a ROW. More...
 
MathMatrix< T > & operator*= (const MathMatrix< T > &MATRIX)
 operator *= Matrix More...
 
MathMatrix< T > & operator*= (const MathVector< T > &VECTOR)
 operator *= VectorBase More...
 

Private Attributes

Size NumberRows_
 
Size NumberCols_
 
Size size_
 
Tdata_
 

Constructor & Destructor Documentation

template<typename T>
numeric::MathMatrix< T >::MathMatrix ( )
inline

default constructor

template<typename T>
numeric::MathMatrix< T >::MathMatrix ( const Size  NUMBER_ROWS,
const Size  NUMBER_COLS,
const T FILL_VALUE = T( 0) 
)
inlineexplicit

construct from dimension and possible filler

Parameters
NUMBER_ROWSnumber of rows in matrix
NUMBER_COLSnumber of cols in matrix
FILL_VALUEassign every element to that value
template<typename T>
numeric::MathMatrix< T >::MathMatrix ( const Size  NUMBER_ROWS,
const Size  NUMBER_COLS,
const T DATA 
)
inline

construct from dimension and pointer to data

Parameters
NUMBER_ROWSnumber of rows in matrix
NUMBER_COLSnumber of cols in matrix
DATApointer to field of data
template<typename T>
numeric::MathMatrix< T >::MathMatrix ( MathMatrix< T > const &  MATRIX)
inline

copy constructor from Matrix

Parameters
MATRIXmatrix to be copied from
template<typename T>
numeric::MathMatrix< T >::~MathMatrix ( )
inline

destructor

Member Function Documentation

template<typename T>
const T* numeric::MathMatrix< T >::begin ( ) const
inline

pointer to First Element

Returns
const pointer to first element in range containing all elements of Matrix

Referenced by numeric::operator!=(), numeric::operator*=(), numeric::operator+=(), numeric::operator-=(), numeric::operator/=(), and numeric::operator==().

template<typename T>
T* numeric::MathMatrix< T >::begin ( )
inline

pointer to First Element

Returns
pointer to first element in range containing all elements of Matrix
template<typename T>
MathMatrix< T>* numeric::MathMatrix< T >::Clone ( ) const
inline

Clone function.

Returns
pointer to new MatrixInterface< T>
template<typename T>
const T* numeric::MathMatrix< T >::end ( ) const
inline

pointer to end of range

Returns
const pointer to address one after last element in Matrix

Referenced by numeric::operator!=(), numeric::operator*=(), numeric::operator+=(), numeric::operator-=(), numeric::operator/=(), and numeric::operator==().

template<typename T>
T* numeric::MathMatrix< T >::end ( )
inline

pointer to end of range

Returns
pointer to address one after last element in Matrix
template<typename T>
MathVector< T> numeric::MathMatrix< T >::get_col ( const Size  COL) const
inline
Returns
Col of Matrix

Referenced by numeric::interpolation::spline::BicubicSpline::train().

template<typename T>
Size numeric::MathMatrix< T >::get_number_cols ( ) const
inline
template<typename T>
Size numeric::MathMatrix< T >::get_number_elements ( ) const
inline

number of elements

Returns
total number of elements in matrix

Referenced by numeric::MathMatrix< float >::is_diagonal().

template<typename T>
Size numeric::MathMatrix< T >::get_number_rows ( ) const
inline
template<typename T>
MathVector< T> numeric::MathMatrix< T >::get_row ( const Size  ROW) const
inline
Returns
Row of Matrix

Referenced by numeric::interpolation::spline::BicubicSpline::train().

template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::inverse ( )
inline
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::inverse_diagonal_matrix ( )
inline
template<typename T>
bool numeric::MathMatrix< T >::inverse_dimensions ( const MathMatrix< T > &  MATRIX_LHS,
const MathMatrix< T > &  MATRIX_RHS 
)
inline

check inverse dimension agreement of two Matrices comapre number ros of lhs with number cols of rhs and number cols of lhs with number rows of rhs

Parameters
MATRIX_LHSrhs matrix
MATRIX_RHSlhs matrix
Returns
true if number rows with cols and cols with rows agree between both Matrices
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::inverse_rectangular_matrix ( )
inline
Returns
invert rectangular matrices exactly

Referenced by numeric::MathMatrix< float >::inverse().

template<typename T>
MathMatrix< T> numeric::MathMatrix< T >::inverse_square_matrix ( )
inline
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::inverse_tridiagonal_matrix ( )
inline
Returns
this algorithm was found on this page: http://www.csit.fsu.edu/~burkardt/math2071/math2071.html invert tridiagonal matrix for all diagonal elements

Referenced by numeric::MathMatrix< float >::inverse_square_matrix().

template<typename T>
bool numeric::MathMatrix< T >::is_diagonal ( ) const
inline

is matrix a diagonal matrix

Returns
true if all but the elements in the diagonal are 0

Referenced by numeric::MathMatrix< float >::inverse_square_matrix().

template<typename T>
bool numeric::MathMatrix< T >::is_square ( ) const
inline

is matrix a square matrix

Returns
true if number of cols and rows are idnetical

Referenced by numeric::MathMatrix< float >::inverse(), numeric::MathMatrix< float >::is_diagonal(), and numeric::MathMatrix< float >::is_tri_diagonal().

template<typename T>
bool numeric::MathMatrix< T >::is_tri_diagonal ( ) const
inline

is matrix a tridiagonal matrix

Returns
if diagonal and adjecent diagonals are filled and the rest is 0

Referenced by numeric::MathMatrix< float >::inverse_square_matrix().

template<typename T>
bool numeric::MathMatrix< T >::IsValidPosition ( const Size  ROW,
const Size  COL 
) const
inline
template<typename T>
bool numeric::MathMatrix< T >::multiplication_dimension ( const MathMatrix< T > &  MATRIX_LHS,
const MathMatrix< T > &  MATRIX_RHS 
)
inline

check dimensions for multiplication A*B compare number cols of lhs with number rows of rhs

Parameters
MATRIX_LHSrhs matrix
MATRIX_RHSlhs matrix
Returns
true if number cols rhs and number cols lhs agree
template<typename T>
T& numeric::MathMatrix< T >::operator() ( const Size  ROW,
const Size  COL 
)
inline

return reference to changeable element ( ROW, COL)

Parameters
ROWthe row number, starting with 0
COLthe col number, starting with 0
Returns
changable reference to the element defined bey ROW and COL number

Referenced by numeric::MathMatrix< float >::get_col(), numeric::MathMatrix< float >::inverse_diagonal_matrix(), numeric::MathMatrix< float >::inverse_square_matrix(), numeric::MathMatrix< float >::inverse_tridiagonal_matrix(), numeric::MathMatrix< float >::operator*=(), numeric::MathMatrix< float >::replace_col(), and numeric::MathMatrix< float >::transpose().

template<typename T>
const T& numeric::MathMatrix< T >::operator() ( const Size  ROW,
const Size  COL 
) const
inline

return reference to const element ( ROW, COL)

Parameters
ROWthe row number, starting with 0
COLthe col number, starting with 0
Returns
const element defined bey ROW and COL number
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::operator*= ( const MathMatrix< T > &  MATRIX)
inline

operator *= Matrix

template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::operator*= ( const MathVector< T > &  VECTOR)
inline

operator *= VectorBase

template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::operator= ( const MathMatrix< T > &  MATRIX)
inline

assignment from Matrix

Parameters
MATRIXthe matrix used as source
Returns
reference to this Matrix
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::operator= ( const T VALUE)
inline

assignment from value

Parameters
VALUEall elements are set to that value
Returns
reference to this assigned Matrix
template<typename T>
T* numeric::MathMatrix< T >::operator[] ( const Size  ROW)
inline

C-style data access with [] gives a pointer on a ROW.

Referenced by numeric::MathMatrix< float >::get_row(), and numeric::MathMatrix< float >::operator*=().

template<typename T>
const T* numeric::MathMatrix< T >::operator[] ( const Size  ROW) const
inline

C-style data access with [] gives a pointer on a ROW.

template<typename T>
Size numeric::MathMatrix< T >::pivot ( const Size  ROW)
inline
Returns
private helper function for computing the determinante / inverting a square matrix

Referenced by numeric::MathMatrix< float >::inverse_square_matrix().

template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::replace_col ( const Size  COL,
const MathVector< T > &  VECTOR 
)
inline
Returns
copies elements of argument VECTOR into this object at position (COL)
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::replace_row ( const Size  ROW,
const MathVector< T > &  VECTOR 
)
inline
Returns
copies elements of argument VECTOR into this object at position (ROW)
template<typename T>
bool numeric::MathMatrix< T >::same_dimensions ( const MathMatrix< T > &  MATRIX_LHS,
const MathMatrix< T > &  MATRIX_RHS 
)
inline

check dimension agreement of two Matrices

Parameters
MATRIX_LHSrhs matrix
MATRIX_RHSlhs matrix
Returns
true if number rows and cols are the same between both Matrices
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::set_unit ( )
inline
Returns
set all elements in matrix to T( 0) but diagonal elements to T( 1)

Referenced by numeric::MathMatrix< float >::inverse_square_matrix().

template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::set_zero ( )
inline
template<typename T>
Size numeric::MathMatrix< T >::size ( ) const
inline

number of elements

Returns
total number of elements in matrix

Referenced by numeric::operator-(), and numeric::operator/().

template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::swap_cols ( const Size  COL_A,
const Size  COL_B 
)
inline
Returns
swap columns COL_A and COL_B
template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::swap_rows ( const Size  ROW_A,
const Size  ROW_B 
)
inline
template<typename T>
MathMatrix< T> numeric::MathMatrix< T >::transpose ( const MathMatrix< T > &  MATRIX)
inline
Returns
Transposed of Matrix

Referenced by numeric::MathMatrix< float >::inverse_rectangular_matrix().

template<typename T>
MathMatrix< T>& numeric::MathMatrix< T >::transpose ( )
inline

Member Data Documentation

template<typename T>
T* numeric::MathMatrix< T >::data_
private
template<typename T>
Size numeric::MathMatrix< T >::NumberCols_
private
template<typename T>
Size numeric::MathMatrix< T >::NumberRows_
private
template<typename T>
Size numeric::MathMatrix< T >::size_
private

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