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

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.

References mlrange_cast().

◆ ~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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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=()

assignment operator ATTENTION: implies resizing of matrix

assignment operator

Definition at line 318 of file mlMatrixTemplate.h.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

References mlrange_cast().

◆ 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.

◆ sizeY()

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

return number of rows

Definition at line 209 of file mlMatrixTemplate.h.


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