AlgoPlus v0.1.0
Loading...
Searching...
No Matches
Mat2d< T, ROWS, COLS > Class Template Reference

Class for 2-dimensional Matrix. More...

#include <mat_2d.h>

Classes

class  Iterator
 Iterator for Mat2d class. More...
 

Public Types

typedef T * iterator
 

Public Member Functions

 Mat2d (std::vector< std::vector< T > > v={})
 constructor for Mat2d class
 
 Mat2d (const T val) noexcept
 constructor for Mat2d class with initializer value
 
 Mat2d (const Mat2d &mat)
 copy constructor for Mat2d class
 
Mat2doperator= (Mat2d &mat)
 operator = for Mat2d class
 
T & operator() (size_t i, size_t j) const
 operator (i, j) for Mat2d class
 
Mat1d< T, COLS > & operator() (size_t i)
 operator () for Mat2d class
 
size_t size () const
 size function
 
size_t cols () const
 cols function
 
size_t rows () const
 rows function
 
Iterator begin ()
 begin() Iterator for Mat2d class
 
Iterator end ()
 end() Iterator for Mat2d class
 

Friends

std::ostream & operator<< (std::ostream &out, Mat2d &mat)
 operator << for Mat2d class
 

Detailed Description

template<typename T, size_t ROWS, size_t COLS>
class Mat2d< T, ROWS, COLS >

Class for 2-dimensional Matrix.

Constructor & Destructor Documentation

◆ Mat2d() [1/2]

template<typename T, size_t ROWS, size_t COLS>
Mat2d< T, ROWS, COLS >::Mat2d ( const T val)
inlineexplicitnoexcept

constructor for Mat2d class with initializer value

Parameters
valthe value that we want all the index of the array to have

◆ Mat2d() [2/2]

template<typename T, size_t ROWS, size_t COLS>
Mat2d< T, ROWS, COLS >::Mat2d ( const Mat2d< T, ROWS, COLS > & mat)
inlineexplicit

copy constructor for Mat2d class

Parameters
matthe 2d matrix we want to copy

Member Function Documentation

◆ begin()

template<typename T, size_t ROWS, size_t COLS>
Iterator Mat2d< T, ROWS, COLS >::begin ( )
inline

begin() Iterator for Mat2d class

Returns
Iterator

◆ cols()

template<typename T, size_t ROWS, size_t COLS>
size_t Mat2d< T, ROWS, COLS >::cols ( ) const
inline

cols function

Returns
size_t the number of elements in each column

◆ end()

template<typename T, size_t ROWS, size_t COLS>
Iterator Mat2d< T, ROWS, COLS >::end ( )
inline

end() Iterator for Mat2d class

Returns
Iterator

◆ operator()() [1/2]

template<typename T, size_t ROWS, size_t COLS>
Mat1d< T, COLS > & Mat2d< T, ROWS, COLS >::operator() ( size_t i)
inline

operator () for Mat2d class

Parameters
iindex that's pointing to the row
Returns
std::vector<T> the array of index i

◆ operator()() [2/2]

template<typename T, size_t ROWS, size_t COLS>
T & Mat2d< T, ROWS, COLS >::operator() ( size_t i,
size_t j ) const
inline

operator (i, j) for Mat2d class

Parameters
iindex that's pointing to the row
jindex that's pointing to the column
Returns
T the element of arr[i][j]

◆ operator=()

template<typename T, size_t ROWS, size_t COLS>
Mat2d & Mat2d< T, ROWS, COLS >::operator= ( Mat2d< T, ROWS, COLS > & mat)
inline

operator = for Mat2d class

Parameters
matthe matrix we want to copy
Returns
Mat2d&

◆ rows()

template<typename T, size_t ROWS, size_t COLS>
size_t Mat2d< T, ROWS, COLS >::rows ( ) const
inline

rows function

Returns
size_t the number of elements in each row

◆ size()

template<typename T, size_t ROWS, size_t COLS>
size_t Mat2d< T, ROWS, COLS >::size ( ) const
inline

size function

Returns
size_t the size of the matrix

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