![]() |
APFEL 4.8.0
A PDF evolution library in C++
|
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. | |
The matrix class is a simple implementation of 2d arrays based on a continous memory allocation. Elements are accessible throught the (i,j) operator.
apfel::matrix< T >::matrix | ( | size_t const & | row = 0, |
size_t const & | col = 0, | ||
std::vector< T > const & | d = {} ) |
The matrix constructor.
row | number of rows |
col | number of columns |
d | vector of data (if empty the matrix is filled in with null values) |
apfel::matrix< T >::matrix | ( | matrix< T > const & | m | ) |
The matrix copy constructor.
m | matrix |
|
inline |
Returns the vector of data.
|
inline |
|
inline |
matrix< T > & apfel::matrix< T >::operator*= | ( | double const & | f | ) |
matrix< T > & apfel::matrix< T >::operator*= | ( | matrix< T > const & | m | ) |
matrix< T > & apfel::matrix< T >::operator+= | ( | matrix< T > const & | m | ) |
matrix< T > & apfel::matrix< T >::operator-= | ( | matrix< T > const & | m | ) |
matrix< T > & apfel::matrix< T >::operator/= | ( | double const & | f | ) |
matrix< T > & apfel::matrix< T >::operator= | ( | matrix< T > const & | m | ) |
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.
row | number of rows |
col | number of columns |
v | the default value (default: 0) |
void apfel::matrix< T >::set | ( | T const & | v | ) |
Function that sets all entries of the matrix to the input value.
v | the default value |
|
inline |
Returns the pair of sizes.
|
inline |
Returns the (row,col) size pair.
dim | the dimension |
|
private |
The data array.
|
private |
The dimension pair.