LocARNA-2.0.0
|
Simple matrix class with restriction to a range. More...
#include <matrices.hh>
Public Member Functions | |
RMatrix () | |
void | resize (size_type xdim, size_type ydim) |
void | restrict (size_type xl, size_type xr, size_type yl, size_type yr) |
Set new restricted range. More... | |
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... | |
![]() | |
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 () |
void | transform (UnaryOperator f) |
Protected Member Functions | |
size_type | addr (size_type i, size_type j) const |
![]() | |
size_type | addr (size_type i, size_type j) const |
Protected Attributes | |
size_type | xl_ |
left end of restriction in first dimension | |
size_type | xr_ |
right end of restriction in first dimension | |
size_type | yl_ |
left end of restriction in second dimension | |
size_type | yr_ |
right end of restriction in second dimension | |
size_type | xfactor_ |
factor for index calculation | |
size_type | offset_ |
offset for index calculation | |
![]() | |
std::vector< elem_t > | mat_ |
vector storing the matrix entries | |
size_type | xdim_ |
first dimension | |
size_type | ydim_ |
second dimension | |
Additional Inherited Members | |
![]() | |
typedef elem_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 | |
Simple matrix class with restriction to a range.
The matrix features a fix maximal range [0..n]x[0..m]. It can be restricted to [xl..xr]x[yl..yr]. After such a restriction, the matrix is invalidated and can only be used with indices (i,j): xl<=i<=xr and yl<=j<=yr
|
inline |
Construct as 0x0-matrix
|
inlineprotected |
Computes address/index in 1D vector from 2D matrix indices
i | first index |
j | second index |
|
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 matrix
Reserves memory in sufficient size and removes any existing restrictions
xdim | |
ydim |
|
inline |
Set new restricted range.
xl | |
xr | |
yl | |
yr |
|
inline |
Write access to matrix element
i | |
j | |
x | element value |