|
| typedef std::map< KEY_TYPE, VALUE_TYPE > | InnerMap |
| | Typedef to keep the code more readable. More...
|
| |
| typedef InnerMap::iterator | InnerIt |
| | Typedef to keep the code more readable. More...
|
| |
| typedef InnerMap::const_iterator | ConstInnerIt |
| | Typedef to keep the code more readable. More...
|
| |
| typedef std::map< KEY_TYPE, std::map< KEY_TYPE, VALUE_TYPE > * > | OuterMap |
| | Typedef to keep the code more readable. More...
|
| |
| typedef OuterMap::iterator | OuterIt |
| | Typedef to keep the code more readable. More...
|
| |
| typedef OuterMap::const_iterator | ConstOuterIt |
| | Typedef to keep the code more readable. More...
|
| |
| typedef std::map< KEY_TYPE, VALUE_TYPE > | InnerMapMixed |
| | Typedef to keep the code more readable. More...
|
| |
| typedef InnerMapMixed::iterator | InnerMixedIt |
| | Typedef to keep the code more readable. More...
|
| |
| typedef InnerMapMixed::const_iterator | ConstInnerMixedIt |
| | Typedef to keep the code more readable const version. More...
|
| |
| typedef std::map< KEY_TYPE, std::map< KEY_TYPE, VALUE_TYPE > * > | OuterMapMixed |
| | Typedef to keep the code more readable. More...
|
| |
| typedef OuterMapMixed::iterator | OuterMixedIt |
| | Typedef to keep the code more readable. More...
|
| |
| typedef OuterMapMixed::const_iterator | ConstOuterMixedIt |
| | Typedef to keep the code more readable const version. More...
|
| |
template<class KEY_TYPE, class VALUE_TYPE>
class oomph::MapMatrix< KEY_TYPE, VALUE_TYPE >
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// 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:
Vector<Rubbish*> object_pt;
[...]
int nentry=object_pt.size();
MapMatrix<Rubbish*,int> like_a_matrix;
for (
int i=1;
i<nentry;
i++)
{
for (
int j=1;
j<nentry;
j++)
{
like_a_matrix(object_pt[
i],object_pt[
j])=number;
}
}
oomph_info <<
"Matrix has nnz() " << like_a_matrix.nnz() <<
" and size() " << like_a_matrix.size() << std::endl;
oomph_info <<
"\n\n\n Here are the nonzero entries: i, j, a(i,j)\n";
like_a_matrix(object_pt[1],object_pt[2])+=13;
Rubbish* temp_pt=new Rubbish(20);
like_a_matrix(object_pt[1],temp_pt)+=13;
oomph_info <<
"\n\n\n Here are the nonzero entries: i, j, a(i,j)\n";
int i
Definition: BiCGSTAB_step_by_step.cpp:9
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2