Rosetta
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 T * begin () const
 pointer to First Element More...
 
T * begin ()
 pointer to First Element More...
 
const T * end () const
 pointer to end of range More...
 
T * end ()
 pointer to end of range More...
 
MathVector< T > get_row (const Size ROW) const
 
MathVector< T > get_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< T > transpose (const MathMatrix< T > &MATRIX)
 
MathMatrix< T > & inverse ()
 
MathMatrix< T > & transpose ()
 
MathMatrix< T > & inverse_rectangular_matrix ()
 
MathMatrix< T > inverse_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
 
T & operator() (const Size ROW, const Size COL)
 return reference to changeable element ( ROW, COL) More...
 
const T & operator() (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...
 
T * operator[] (const Size ROW)
 C-style data access with [] gives a pointer on a ROW. More...
 
const T * operator[] (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_
 
T * data_
 

Constructor & Destructor Documentation

◆ MathMatrix() [1/4]

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

default constructor

◆ MathMatrix() [2/4]

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

◆ MathMatrix() [3/4]

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

◆ MathMatrix() [4/4]

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

copy constructor from Matrix

Parameters
MATRIXmatrix to be copied from

References erraser_util::copy(), numeric::MathMatrix< T >::data_, and numeric::MathMatrix< T >::size_.

◆ ~MathMatrix()

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

destructor

Member Function Documentation

◆ begin() [1/2]

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

References numeric::MathMatrix< T >::data_.

◆ begin() [2/2]

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

References numeric::MathMatrix< T >::data_.

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

◆ Clone()

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

Clone function.

Returns
pointer to new MatrixInterface< T>

◆ end() [1/2]

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

pointer to end of range

Returns
pointer to address one after last element in Matrix

References numeric::MathMatrix< T >::data_, and numeric::MathMatrix< T >::size_.

◆ end() [2/2]

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

References numeric::MathMatrix< T >::data_, and numeric::MathMatrix< T >::size_.

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

◆ get_col()

template<typename T >
MathVector< T> numeric::MathMatrix< T >::get_col ( const Size  COL) const
inline

◆ get_number_cols()

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

◆ get_number_elements()

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

number of elements

Returns
total number of elements in matrix

References numeric::MathMatrix< T >::size_.

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

◆ get_number_rows()

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

◆ get_row()

template<typename T >
MathVector< T> numeric::MathMatrix< T >::get_row ( const Size  ROW) const
inline

◆ inverse()

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

◆ inverse_diagonal_matrix()

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

◆ inverse_dimensions()

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

References numeric::MathMatrix< T >::get_number_cols(), and numeric::MathMatrix< T >::get_number_rows().

◆ inverse_rectangular_matrix()

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

◆ inverse_square_matrix()

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

◆ inverse_tridiagonal_matrix()

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

◆ is_diagonal()

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

◆ is_square()

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

◆ is_tri_diagonal()

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

◆ IsValidPosition()

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

◆ multiplication_dimension()

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

References numeric::MathMatrix< T >::get_number_cols(), and numeric::MathMatrix< T >::get_number_rows().

◆ operator()() [1/2]

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

◆ operator()() [2/2]

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

References numeric::MathMatrix< T >::data_, numeric::MathMatrix< T >::NumberCols_, and numeric::MathMatrix< T >::NumberRows_.

◆ operator*=() [1/2]

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

◆ operator*=() [2/2]

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

◆ operator=() [1/2]

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

References erraser_util::copy(), numeric::MathMatrix< T >::data_, numeric::MathMatrix< T >::NumberCols_, numeric::MathMatrix< T >::NumberRows_, and numeric::MathMatrix< T >::size_.

◆ operator=() [2/2]

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

References numeric::MathMatrix< T >::data_, detail::fill(), and numeric::MathMatrix< T >::size_.

◆ operator[]() [1/2]

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

◆ operator[]() [2/2]

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.

References numeric::MathMatrix< T >::data_, numeric::MathMatrix< T >::NumberCols_, and numeric::MathMatrix< T >::NumberRows_.

◆ pivot()

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

References create_a3b_hbs::k, and numeric::MathMatrix< T >::swap_rows().

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

◆ replace_col()

template<typename T >
MathMatrix< T>& numeric::MathMatrix< T >::replace_col ( const Size  COL,
const MathVector< T > &  VECTOR 
)
inline

◆ replace_row()

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)

References numeric::MathVector< T >::begin(), hist2d::dat, numeric::MathVector< T >::end(), numeric::MathMatrix< T >::IsValidPosition(), ptr(), and numeric::MathVector< T >::size().

◆ same_dimensions()

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

References numeric::MathMatrix< T >::get_number_cols(), and numeric::MathMatrix< T >::get_number_rows().

◆ set_unit()

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

◆ set_zero()

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

◆ size()

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

number of elements

Returns
total number of elements in matrix

References numeric::MathMatrix< T >::size_.

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

◆ swap_cols()

template<typename T >
MathMatrix< T>& numeric::MathMatrix< T >::swap_cols ( const Size  COL_A,
const Size  COL_B 
)
inline

◆ swap_rows()

template<typename T >
MathMatrix< T>& numeric::MathMatrix< T >::swap_rows ( const Size  ROW_A,
const Size  ROW_B 
)
inline

◆ transpose() [1/2]

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

◆ transpose() [2/2]

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

Member Data Documentation

◆ data_

template<typename T >
T* numeric::MathMatrix< T >::data_
private

◆ NumberCols_

template<typename T >
Size numeric::MathMatrix< T >::NumberCols_
private

◆ NumberRows_

template<typename T >
Size numeric::MathMatrix< T >::NumberRows_
private

◆ size_

template<typename T >
Size numeric::MathMatrix< T >::size_
private

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