MDA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | List of all members
MDAT::Matrix< DataType > Class Template Reference

A simple class to produce 2 dimensional matrices. More...

#include <Matrix.hpp>

Public Member Functions

 Matrix (size_t dim1, size_t dim2)
 Constructor setting the size. More...
 
 Matrix (size_t dim1, size_t dim2, DataType init)
 Constructor allowing initialization of fields. More...
 
 Matrix (const Matrix &)=default
 
Matrixoperator= (const Matrix &)=default
 
virtual ~Matrix ()
 Destructor.
 
std::vector< DataType > & operator[] (unsigned int index)
 Access operator. More...
 
const std::vector< DataType > & operator[] (unsigned int index) const
 Access operator. More...
 
void resize (size_t dim_1, size_t dim_2)
 Resizes the matrix to the new dimensions. More...
 
void ensure (size_t dim_1, size_t dim_2)
 
size_t dim1 () const
 Returns the size of the first dimension. More...
 
size_t dim2 () const
 Returns the size of the second dimension. More...
 
void fill (const DataType &value)
 

Detailed Description

template<typename DataType>
class MDAT::Matrix< DataType >

A simple class to produce 2 dimensional matrices.

Constructor & Destructor Documentation

template<typename DataType >
MDAT::Matrix< DataType >::Matrix ( size_t  dim1,
size_t  dim2 
)

Constructor setting the size.

Parameters
dim1Size of the first dimension.
dim2Size of the second dimension.
template<typename DataType>
MDAT::Matrix< DataType >::Matrix ( size_t  dim1,
size_t  dim2,
DataType  init 
)

Constructor allowing initialization of fields.

Parameters
dim1Size of the first dimension.
dim2Size of the second dimension.
initValue to initalize the fields with.

Member Function Documentation

template<typename DataType>
size_t MDAT::Matrix< DataType >::dim1 ( ) const
inline

Returns the size of the first dimension.

Returns
The size of the first dimension.
template<typename DataType>
size_t MDAT::Matrix< DataType >::dim2 ( ) const
inline

Returns the size of the second dimension.

Returns
The size of the second dimension.
template<typename DataType>
std::vector<DataType>& MDAT::Matrix< DataType >::operator[] ( unsigned int  index)
inline

Access operator.

Parameters
indexThe index to acess.
Returns
Reference to the field.
template<typename DataType>
const std::vector<DataType>& MDAT::Matrix< DataType >::operator[] ( unsigned int  index) const
inline

Access operator.

Parameters
indexThe index to acess.
Returns
Reference to the field.
template<typename DataType>
void MDAT::Matrix< DataType >::resize ( size_t  dim_1,
size_t  dim_2 
)
inline

Resizes the matrix to the new dimensions.

Parameters
dim_1The first dimension
dim_2The second dimension