MapMatrix is a generalised, STL-map-based, sparse(-ish) matrix class. More...
#include <map_matrix.h>
Inheritance diagram for oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >:Public Types | |
| typedef std::map< KEY_TYPE, VALUE_TYPE > | InnerMap |
| Typedef to keep the code more readable. | |
| typedef InnerMap::iterator | InnerIt |
| Typedef to keep the code more readable. | |
| typedef InnerMap::const_iterator | ConstInnerIt |
| Typedef to keep the code more readable. | |
| typedef std::map< KEY_TYPE, std::map< KEY_TYPE, VALUE_TYPE > * > | OuterMap |
| Typedef to keep the code more readable. | |
| typedef OuterMap::iterator | OuterIt |
| Typedef to keep the code more readable. | |
| typedef OuterMap::const_iterator | ConstOuterIt |
| Typedef to keep the code more readable. | |
Public Types inherited from oomph::MapMatrixMixed< KEY_TYPE, KEY_TYPE, VALUE_TYPE > | |
| typedef std::map< KEY_TYPE, VALUE_TYPE > | InnerMapMixed |
| Typedef to keep the code more readable. | |
| typedef InnerMapMixed::iterator | InnerMixedIt |
| Typedef to keep the code more readable. | |
| typedef InnerMapMixed::const_iterator | ConstInnerMixedIt |
| Typedef to keep the code more readable const version. | |
| typedef std::map< KEY_TYPE, std::map< KEY_TYPE, VALUE_TYPE > * > | OuterMapMixed |
| Typedef to keep the code more readable. | |
| typedef OuterMapMixed::iterator | OuterMixedIt |
| Typedef to keep the code more readable. | |
| typedef OuterMapMixed::const_iterator | ConstOuterMixedIt |
| Typedef to keep the code more readable const version. | |
Public Member Functions | |
| MapMatrix () | |
| Default (empty) constructor. | |
| MapMatrix (const MapMatrix< KEY_TYPE, VALUE_TYPE > &map_mat) | |
| Copy constructor. | |
| void | operator= (const MapMatrix &)=delete |
| Broken assignment operator. | |
Public Member Functions inherited from oomph::MapMatrixMixed< KEY_TYPE, KEY_TYPE, VALUE_TYPE > | |
| MapMatrixMixed () | |
| Default (empty) constructor. | |
| MapMatrixMixed (const MapMatrixMixed< KEY_TYPE, KEY_TYPE, VALUE_TYPE > &map_mat) | |
| Copy constructor. | |
| void | operator= (const MapMatrixMixed &)=delete |
| Broken assignment operator. | |
| void | copy_column (const KEY_TYPE &j, std::map< KEY_TYPE, VALUE_TYPE > &copied_map) |
| Copy a single column into its own map. | |
| virtual | ~MapMatrixMixed () |
| Destructor. | |
| void | clear () |
| Wipe all entries. | |
| VALUE_TYPE & | operator() (const KEY_TYPE &i, const KEY_TYPE &j) |
| Return (reference to) entry. Careful: If the entry does not exist then it is created and set to zero. | |
| VALUE_TYPE | get (const KEY_TYPE &i, const KEY_TYPE &j) const |
| Get an element corresponding to the key (i,j) Searches the container for an element with a key equivalent to (i,j) and returns the element if found, otherwise the default 0 value for the value type is returned. The container is not modified. | |
| void | output (std::ostream &outfile) |
| Dump all non-‘zero’ entries to file. Output is in the format ‘i’, ‘j’, ‘entry[i][j]’. | |
| unsigned long | nnz () |
| Work out number of non-‘zero’ entries. | |
| unsigned long | nnz () const |
| Work out number of non-‘zero’ entries, const version. | |
| unsigned long | size () |
| Work out total number of entries. | |
| unsigned long | size () const |
| Work out total number of entries const version. | |
Additional Inherited Members | |
Protected Member Functions inherited from oomph::MapMatrixMixed< KEY_TYPE, KEY_TYPE, VALUE_TYPE > | |
| VALUE_TYPE * | entry_pt (const KEY_TYPE &i, const KEY_TYPE &j) |
| Return pointer to entry. | |
Protected Attributes inherited from oomph::MapMatrixMixed< KEY_TYPE, KEY_TYPE, VALUE_TYPE > | |
| std::map< KEY_TYPE, std::map< KEY_TYPE, VALUE_TYPE > * > | Row_pt |
| Here's the generalised matrix structure: A map of pointers to the maps that hold the entries in each row. | |
MapMatrix is a generalised, STL-map-based, sparse(-ish) matrix class.
The matrix is indexed by indices of type KEY_TYPE and has entries of type VALUE_TYPE. It is a specialisation of the class MapMatrixMixed. Please implement future functions in that class.
Careful: If a zero entry is referenced then it is created in memory. Therefore this isn't really a practical sparse matrix scheme. Do not loop over ‘all’ possible indices as even looking at them will inflate the matrix until it occupies as much space as a full one – use (modification of) output routine to retrieve all nonzero entries.
However, this is not a serious restriction, as the main purpose of this class is to allow non-integer indices.
Example of usage:
Definition at line 507 of file map_matrix.h.
| typedef InnerMap::const_iterator oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >::ConstInnerIt |
Typedef to keep the code more readable.
Definition at line 520 of file map_matrix.h.
| typedef OuterMap::const_iterator oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >::ConstOuterIt |
Typedef to keep the code more readable.
Definition at line 529 of file map_matrix.h.
| typedef InnerMap::iterator oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >::InnerIt |
Typedef to keep the code more readable.
Definition at line 517 of file map_matrix.h.
| typedef std::map<KEY_TYPE, VALUE_TYPE> oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >::InnerMap |
Typedef to keep the code more readable.
Definition at line 514 of file map_matrix.h.
| typedef OuterMap::iterator oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >::OuterIt |
Typedef to keep the code more readable.
Definition at line 526 of file map_matrix.h.
| typedef std::map<KEY_TYPE, std::map<KEY_TYPE, VALUE_TYPE>*> oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >::OuterMap |
Typedef to keep the code more readable.
Definition at line 523 of file map_matrix.h.
|
inline |
Default (empty) constructor.
Definition at line 511 of file map_matrix.h.
|
inline |
Copy constructor.
Definition at line 532 of file map_matrix.h.
|
delete |
Broken assignment operator.