LocARNA-2.0.0
|
simple 2D matrix class, provides access via operator (int,int) More...
#include <matrix.hh>
Public Types | |
typedef T | elem_t |
type of elements | |
typedef std::vector< elem_t >::size_type | size_type |
size type (from underlying vector) | |
typedef std::pair< size_type, size_type > | size_pair_type |
type for pair of sizes | |
Public Member Functions | |
Matrix () | |
Matrix (size_type xdim, size_type ydim, const elem_t *from=nullptr) | |
size_pair_type | sizes () const |
void | resize (size_type xdim, size_type ydim) |
const elem_t & | operator() (size_type i, size_type j) const |
elem_t & | operator() (size_type i, size_type j) |
const elem_t & | get (size_type i, size_type j) const |
void | set (size_type i, size_type j, const elem_t &x) |
void | fill (const elem_t &val) |
Fill the whole matrix with the given value. More... | |
void | clear () |
template<class UnaryOperator > | |
void | transform (UnaryOperator f) |
Protected Member Functions | |
size_type | addr (size_type i, size_type j) const |
Protected Attributes | |
std::vector< elem_t > | mat_ |
vector storing the matrix entries | |
size_type | xdim_ |
first dimension | |
size_type | ydim_ |
second dimension | |
simple 2D matrix class, provides access via operator (int,int)
|
inline |
Empty constructor
|
inline |
Construct with dimensions, optionally initialize from array
xdim | first dimension of matrix |
ydim | second dimension of matrix |
from | pointer to array of elements |
|
inlineprotected |
Computes address/index in 1D vector from 2D matrix indices
i | first index |
j | second index |
|
inline |
Clear the matrix
|
inline |
Fill the whole matrix with the given value.
val | value assigned to each entry |
|
inline |
Read access to matrix element
i | |
j |
|
inline |
Read/write access to matrix element
i | |
j |
|
inline |
Read access to matrix element
i | |
j |
|
inline |
Resize both dimensions
xdim | first dimension |
ydim | second dimension |
|
inline |
Write access to matrix element
i | |
j | |
x | element value |
|
inline |
Access size
|
inline |
Transform matrix in place due to applying a given function to each element
f | function object |