APFEL 4.8.0
A PDF evolution library in C++
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
apfel::matrix< T > Class Template Reference

The matrix class is a simple implementation of 2d arrays based on a continous memory allocation. Elements are accessible throught the (i,j) operator. More...

#include <matrix.h>

Public Member Functions

 matrix (size_t const &row=0, size_t const &col=0, std::vector< T > const &d={})
 The matrix constructor.
 
 matrix (matrix< T > const &m)
 The matrix copy constructor.
 
void resize (size_t const &row, size_t const &col, T const &v=0)
 Function that resizes object and set default value.
 
void set (T const &v)
 Function that sets all entries of the matrix to the input value.
 
size_t const & size (size_t const &dim) const
 Returns the (row,col) size pair.
 
std::array< size_t, 2 > const & size () const
 Returns the pair of sizes.
 
std::vector< T > const & data () const
 Returns the vector of data.
 
Binary operators involving matrices
T & operator() (size_t const &i, size_t const &j)
 
T const & operator() (size_t const &i, size_t const &j) const
 
matrix< T > & operator= (matrix< T > const &m)
 
matrix< T > & operator+= (matrix< T > const &m)
 
matrix< T > & operator-= (matrix< T > const &m)
 
matrix< T > & operator*= (double const &f)
 
matrix< T > & operator/= (double const &f)
 
matrix< T > & operator*= (matrix< T > const &m)
 

Private Attributes

std::array< size_t, 2 > _size
 The dimension pair.
 
std::vector< T > _data
 The data array.
 

Detailed Description

template<typename T>
class apfel::matrix< T >

The matrix class is a simple implementation of 2d arrays based on a continous memory allocation. Elements are accessible throught the (i,j) operator.

Constructor & Destructor Documentation

◆ matrix() [1/2]

template<typename T >
apfel::matrix< T >::matrix ( size_t const & row = 0,
size_t const & col = 0,
std::vector< T > const & d = {} )

The matrix constructor.

Parameters
rownumber of rows
colnumber of columns
dvector of data (if empty the matrix is filled in with null values)

◆ matrix() [2/2]

template<typename T >
apfel::matrix< T >::matrix ( matrix< T > const & m)

The matrix copy constructor.

Parameters
mmatrix

Member Function Documentation

◆ data()

template<typename T >
std::vector< T > const & apfel::matrix< T >::data ( ) const
inline

Returns the vector of data.

Returns
the vector of data

◆ operator()() [1/2]

template<typename T >
T & apfel::matrix< T >::operator() ( size_t const & i,
size_t const & j )
inline

◆ operator()() [2/2]

template<typename T >
T const & apfel::matrix< T >::operator() ( size_t const & i,
size_t const & j ) const
inline

◆ operator*=() [1/2]

template<typename T >
matrix< T > & apfel::matrix< T >::operator*= ( double const & f)

◆ operator*=() [2/2]

template<typename T >
matrix< T > & apfel::matrix< T >::operator*= ( matrix< T > const & m)

◆ operator+=()

template<typename T >
matrix< T > & apfel::matrix< T >::operator+= ( matrix< T > const & m)

◆ operator-=()

template<typename T >
matrix< T > & apfel::matrix< T >::operator-= ( matrix< T > const & m)

◆ operator/=()

template<typename T >
matrix< T > & apfel::matrix< T >::operator/= ( double const & f)

◆ operator=()

template<typename T >
matrix< T > & apfel::matrix< T >::operator= ( matrix< T > const & m)

◆ resize()

template<typename T >
void apfel::matrix< T >::resize ( size_t const & row,
size_t const & col,
T const & v = 0 )

Function that resizes object and set default value.

Parameters
rownumber of rows
colnumber of columns
vthe default value (default: 0)

◆ set()

template<typename T >
void apfel::matrix< T >::set ( T const & v)

Function that sets all entries of the matrix to the input value.

Parameters
vthe default value

◆ size() [1/2]

template<typename T >
std::array< size_t, 2 > const & apfel::matrix< T >::size ( ) const
inline

Returns the pair of sizes.

Returns
the number of rows and columns

◆ size() [2/2]

template<typename T >
size_t const & apfel::matrix< T >::size ( size_t const & dim) const
inline

Returns the (row,col) size pair.

Parameters
dimthe dimension
Returns
the number of rows and columns

Member Data Documentation

◆ _data

template<typename T >
std::vector<T> apfel::matrix< T >::_data
private

The data array.

◆ _size

template<typename T >
std::array<size_t, 2> apfel::matrix< T >::_size
private

The dimension pair.


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