LocARNA-1.8.11
|
Represents a sparse 2D matrix. More...
#include <sparse_matrix.hh>
Classes | |
class | element |
Element of sparse matrix. More... | |
Public Types | |
typedef T | value_t |
type of matrix entries | |
typedef size_t | size_type |
usual definition of size_type | |
typedef std::pair< size_type, size_type > | key_t |
type of matrix index pair | |
typedef map_t::const_iterator | const_iterator |
Stl-compatible constant iterator over matrix elements. More... | |
Public Member Functions | |
SparseMatrix () | |
Empty constructor (with default default value) | |
SparseMatrix (const value_t &def) | |
Construct with default value. More... | |
element | operator() (size_type i, size_type j) |
Access to matrix element. More... | |
const value_t & | operator() (size_type i, size_type j) const |
Read-only access to matrix element of const matrix. More... | |
void | set (size_type i, size_type j, const value_t &val) |
Write access to matrix entry. More... | |
value_t & | ref (size_type i, size_type j) |
Write access to matrix element of const matrix. More... | |
void | reset (size_type i, size_type j) |
Set matrix entry to default value. More... | |
size_type | size () const |
Size of sparse matrix. More... | |
bool | empty () const |
Check for emptiness. More... | |
void | clear () |
Clear the matrix. | |
const_iterator | begin () const |
Begin const iterator over matrix entries. More... | |
const_iterator | end () const |
End const iterator over matrix entries. More... | |
const value_t & | def () const |
Default value. More... | |
Protected Types | |
typedef unordered_map< key_t, value_t, pair_of_size_t_hash >::type | map_t |
map type | |
Protected Attributes | |
map_t | the_map_ |
internal representation of sparse matrix | |
value_t | def_ |
default value of matrix entries | |
Represents a sparse 2D matrix.
Sparse matrix of entries val_t implements the matrix by a hash map. The class is designed to be largely exchangable with the non-sparse Matrix class. (A proxy class is used to provide the same syntax for the interface.)
typedef map_t::const_iterator LocARNA::SparseMatrix< T >::const_iterator |
Stl-compatible constant iterator over matrix elements.
Behaves like a const iterator of the hash map.
|
inlineexplicit |
Construct with default value.
def | default value of entries |
|
inline |
Begin const iterator over matrix entries.
|
inline |
Default value.
|
inline |
Check for emptiness.
|
inline |
End const iterator over matrix entries.
|
inline |
Access to matrix element.
i | index first dimension |
j | index second dimension |
|
inline |
Read-only access to matrix element of const matrix.
i | index first dimension |
j | index second dimension |
|
inline |
Write access to matrix element of const matrix.
i | index first dimension |
j | index second dimension |
|
inline |
Set matrix entry to default value.
i | index first dimension |
j | index second dimension |
|
inline |
Write access to matrix entry.
i | index first dimension |
j | index second dimension |
val | value to be written to entry (i,j) |
|
inline |
Size of sparse matrix.