MeVisLab Toolbox Reference
ml::MatrixTemplate< T > Class Template Reference

MatricTemplate implements general Matrix class based on valarray of objects with Template class type for nummeric calculations with dynamic size More...

#include <mlMatrixTemplate.h>

Inheritance diagram for ml::MatrixTemplate< T >:
ml::MatrixSizedTemplate< double, 0, 0 > ml::MatrixSizedTemplate< T, SIZE_X, SIZE_Y >

Public Member Functions

 MatrixTemplate (size_t x, size_t y)
 constructor initialising memory block for requested matrix size More...
 
 MatrixTemplate (const MatrixTemplate< T > &)
 copy constructor More...
 
MatrixTemplate< T > & operator= (const MatrixTemplate< T > &)
 assignment operator ATTENTION: implies resizing of matrix More...
 
 ~MatrixTemplate ()
 destructor: free allocated memory More...
 
void freeMatrix ()
 free allocated memory More...
 
void resizeMatrix (size_t x, size_t y, const T &c=T())
 resize matrix, set new allocated elements to value c More...
 
void overrideMatrix (size_t x, size_t y, const T &c=T())
 resize matrix if necessary, set all elements on value c More...
 
size_t size () const
 return total number of matrix elements More...
 
size_t sizeX () const
 return number of columns More...
 
size_t sizeY () const
 return number of rows More...
 
Slice_iter< Trow (size_t i)
 itterator access to i-te row slice More...
 
Cslice_iter< Trow (size_t i) const
 const itterator access to i-te row slice More...
 
Slice_iter< Tcolumn (size_t i)
 itterator access to i-te column slice More...
 
Cslice_iter< Tcolumn (size_t i) const
 const itterator access to i-te column slice More...
 
std::valarray< T > & array ()
 reference to internal valarray More...
 
 operator T* ()
 pass access to internal valarray More...
 
Fortran-style subscripts
Toperator() (size_t x, size_t y)
 reference of element x,y More...
 
T operator() (size_t x, size_t y) const
 element x,y More...
 
Slice_iter< Toperator() (size_t i)
 slice of first argument (i.e column(i)) More...
 
Cslice_iter< Toperator() (size_t i) const
 const slice of first argument (i.e column(i)) More...
 
C-style subscripts
Slice_iter< Toperator[] (size_t i)
 slice of column(i) More...
 
Cslice_iter< Toperator[] (size_t i) const
 const slice of column(i) More...
 
MatrixTemplate< T > & operator*= (T)
 multiplication of all matrix elements with element-type multiplicator More...
 

Detailed Description

template<class T>
class ml::MatrixTemplate< T >

MatricTemplate implements general Matrix class based on valarray of objects with Template class type for nummeric calculations with dynamic size

Definition at line 193 of file mlMatrixTemplate.h.

Constructor & Destructor Documentation

◆ MatrixTemplate() [1/2]

template<class T >
ml::MatrixTemplate< T >::MatrixTemplate ( size_t  x,
size_t  y 
)

constructor initialising memory block for requested matrix size

ctor

Definition at line 295 of file mlMatrixTemplate.h.

◆ MatrixTemplate() [2/2]

template<class T >
ml::MatrixTemplate< T >::MatrixTemplate ( const MatrixTemplate< T > &  mt)

copy constructor

Definition at line 304 of file mlMatrixTemplate.h.

◆ ~MatrixTemplate()

template<class T >
ml::MatrixTemplate< T >::~MatrixTemplate

destructor: free allocated memory

dtor

Definition at line 331 of file mlMatrixTemplate.h.

Member Function Documentation

◆ array()

template<class T >
std::valarray<T>& ml::MatrixTemplate< T >::array ( )
inline

reference to internal valarray

Definition at line 234 of file mlMatrixTemplate.h.

◆ column() [1/2]

template<class T >
Slice_iter< T > ml::MatrixTemplate< T >::column ( size_t  i)
inline

itterator access to i-te column slice

slice for column access

Definition at line 281 of file mlMatrixTemplate.h.

Referenced by ml::operator*().

◆ column() [2/2]

template<class T >
Cslice_iter< T > ml::MatrixTemplate< T >::column ( size_t  i) const
inline

const itterator access to i-te column slice

const slice for column access

Definition at line 288 of file mlMatrixTemplate.h.

◆ freeMatrix()

template<class T >
void ml::MatrixTemplate< T >::freeMatrix

free allocated memory

free all allocated memory

Definition at line 362 of file mlMatrixTemplate.h.

◆ operator T*()

template<class T >
ml::MatrixTemplate< T >::operator T* ( )
inline

pass access to internal valarray

Definition at line 236 of file mlMatrixTemplate.h.

References T.

◆ operator()() [1/4]

template<class T >
Slice_iter<T> ml::MatrixTemplate< T >::operator() ( size_t  i)
inline

slice of first argument (i.e column(i))

Definition at line 222 of file mlMatrixTemplate.h.

◆ operator()() [2/4]

template<class T >
Cslice_iter<T> ml::MatrixTemplate< T >::operator() ( size_t  i) const
inline

const slice of first argument (i.e column(i))

Definition at line 223 of file mlMatrixTemplate.h.

◆ operator()() [3/4]

template<class T >
T & ml::MatrixTemplate< T >::operator() ( size_t  x,
size_t  y 
)

reference of element x,y

allows Fortran-style element access

Definition at line 371 of file mlMatrixTemplate.h.

◆ operator()() [4/4]

template<class T >
T ml::MatrixTemplate< T >::operator() ( size_t  x,
size_t  y 
) const

element x,y

◆ operator*=()

template<class T >
MatrixTemplate< T > & ml::MatrixTemplate< T >::operator*= ( T  d)

multiplication of all matrix elements with element-type multiplicator

implements element-individual multiplication with element-type operator

Definition at line 451 of file mlMatrixTemplate.h.

◆ operator=()

template<class T >
MatrixTemplate< T > & ml::MatrixTemplate< T >::operator= ( const MatrixTemplate< T > &  mt)

assignment operator ATTENTION: implies resizing of matrix

assignment operator

Definition at line 318 of file mlMatrixTemplate.h.

◆ operator[]() [1/2]

template<class T >
Slice_iter<T> ml::MatrixTemplate< T >::operator[] ( size_t  i)
inline

slice of column(i)

Definition at line 228 of file mlMatrixTemplate.h.

◆ operator[]() [2/2]

template<class T >
Cslice_iter<T> ml::MatrixTemplate< T >::operator[] ( size_t  i) const
inline

const slice of column(i)

Definition at line 229 of file mlMatrixTemplate.h.

◆ overrideMatrix()

template<class T >
void ml::MatrixTemplate< T >::overrideMatrix ( size_t  x,
size_t  y,
const T c = T() 
)

resize matrix if necessary, set all elements on value c

dynamic resize if needed: All elements are set to value c.

Any pointers or references to elements in the controlled sequence are invalidated.

Definition at line 351 of file mlMatrixTemplate.h.

◆ resizeMatrix()

template<class T >
void ml::MatrixTemplate< T >::resizeMatrix ( size_t  x,
size_t  y,
const T c = T() 
)

resize matrix, set new allocated elements to value c

dynamic resize: If it must lengthen the controlled sequence, it appends elements with value c.

Any pointers or references to elements in the controlled sequence are invalidated.

Definition at line 340 of file mlMatrixTemplate.h.

◆ row() [1/2]

template<class T >
Slice_iter< T > ml::MatrixTemplate< T >::row ( size_t  i)
inline

itterator access to i-te row slice

slice for row access

Definition at line 267 of file mlMatrixTemplate.h.

Referenced by ml::mul_mv(), and ml::operator*().

◆ row() [2/2]

template<class T >
Cslice_iter< T > ml::MatrixTemplate< T >::row ( size_t  i) const
inline

const itterator access to i-te row slice

const slice for row access

Definition at line 274 of file mlMatrixTemplate.h.

◆ size()

template<class T >
size_t ml::MatrixTemplate< T >::size ( ) const
inline

return total number of matrix elements

Definition at line 207 of file mlMatrixTemplate.h.

◆ sizeX()

template<class T >
size_t ml::MatrixTemplate< T >::sizeX ( ) const
inline

return number of columns

Definition at line 208 of file mlMatrixTemplate.h.

Referenced by ml::mul_mv(), ml::operator*(), and ml::operator<<().

◆ sizeY()

template<class T >
size_t ml::MatrixTemplate< T >::sizeY ( ) const
inline

return number of rows

Definition at line 209 of file mlMatrixTemplate.h.

Referenced by ml::mul_mv(), ml::operator*(), and ml::operator<<().


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