SparseMatrix< T > Class Template Reference

#include <SparseMatrix.h>

Inheritance diagram for SparseMatrix< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 SparseMatrix ()
 SparseMatrix (unsigned int nrows, unsigned int ncolumns)
unsigned int nRows () const
unsigned int nColumns () const
unsigned int nEntries () const
void setSize (unsigned int nrows, unsigned int ncolumns)
void set (unsigned int row, unsigned int column, T value)
void unset (unsigned int row, unsigned int column)
get (unsigned int row, unsigned int column) const
unsigned int getRow (unsigned int row, const T **entry, const unsigned int **colIndex) const
unsigned int getRow (unsigned int row, vector< T > &e, vector< unsigned int > &c) const
unsigned int getColumn (unsigned int col, vector< T > &entry, vector< unsigned int > &rowIndex) const
void rowOperation (unsigned int row, unary_function< T, void > &f)
void addRow (unsigned int rowNum, const vector< T > &row)
void addRow (unsigned int rowNum, const vector< T > &entry, const vector< unsigned int > &colIndexArg)
void clear ()
void transpose ()
void reorderColumns (const vector< unsigned int > &colMap)
void tripletFill (const vector< unsigned int > &row, const vector< unsigned int > &col, const vector< T > &z)
void pairFill (const vector< unsigned int > &row, const vector< unsigned int > &col, T value)
void printTriplet (const vector< Triplet< T > > &t)
void print () const
void printInternal () const

Protected Attributes

unsigned int nrows_
unsigned int ncolumns_
vector< T > N_
vector< unsigned int > colIndex_
 Non-zero entries in the SparseMatrix.
vector< unsigned int > rowStart_
 Start index in the N_ and colIndex_ vectors, of each row.

template<class T>
class SparseMatrix< T >


Constructor & Destructor Documentation

template<class T>
SparseMatrix< T >::SparseMatrix (  )  [inline]
template<class T>
SparseMatrix< T >::SparseMatrix ( unsigned int  nrows,
unsigned int  ncolumns 
) [inline]

Member Function Documentation

template<class T>
void SparseMatrix< T >::addRow ( unsigned int  rowNum,
const vector< T > &  entry,
const vector< unsigned int > &  colIndexArg 
) [inline]

Used to set an entire row of entries, already in sparse form. Assumes that the SparseMatrix has been suitably allocated. rowNum must be done in increasing order in successive calls.

template<class T>
void SparseMatrix< T >::addRow ( unsigned int  rowNum,
const vector< T > &  row 
) [inline]

Adds a row to the sparse matrix, must go strictly in row order. This is dangerous as there is a test for an empty entry ~0. For many types, ~0 may actually be a perfectly legal entry.

Referenced by SparseMsg::randomConnect(), SparseMatrix< unsigned int >::reorderColumns(), and SparseMatrix< unsigned int >::tripletFill().

template<class T>
void SparseMatrix< T >::clear (  )  [inline]
template<class T>
T SparseMatrix< T >::get ( unsigned int  row,
unsigned int  column 
) const [inline]

Returns the entry identified by row, column. Returns T(0) if not found

Referenced by Stoich::installAndUnschedFuncRate(), printSparseMatrix(), testSparseMatrix2(), testSparseMatrixFill(), and testSparseMatrixReorder().

template<class T>
unsigned int SparseMatrix< T >::getColumn ( unsigned int  col,
vector< T > &  entry,
vector< unsigned int > &  rowIndex 
) const [inline]

This is an unnatural lookup here, across the grain of the sparse matrix. Ideally should use copy_if, but the C++ chaps forgot it.

Referenced by SparseMsg::findOtherEnd().

template<class T>
unsigned int SparseMatrix< T >::getRow ( unsigned int  row,
vector< T > &  e,
vector< unsigned int > &  c 
) const [inline]

getRow: vector version. Used to get an entire row of entries. Returns # entries.

template<class T>
unsigned int SparseMatrix< T >::getRow ( unsigned int  row,
const T **  entry,
const unsigned int **  colIndex 
) const [inline]

Used to get an entire row of entries. Returns # entries. Passes back iterators for the row and for the column index.

Ideally I should provide a forall type function so that the user passes in their operation as a functor, and it is applied to the entire row.

Referenced by fillErefsFromMatrix(), Gsolve::fillMathDep(), Gsolve::fillMmEnzDep(), SparseMsg::findOtherEnd(), SparseMsg::firstTgt(), MeshCompt::getNeighbors(), MeshCompt::getStencilRow(), MeshCompt::innerGetStencilRate(), printSparseMatrix(), SparseMatrix< unsigned int >::reorderColumns(), testSparseMatrix(), and SparseMsg::updateAfterFill().

template<class T>
unsigned int SparseMatrix< T >::nColumns (  )  const [inline]
template<class T>
unsigned int SparseMatrix< T >::nEntries (  )  const [inline]
template<class T>
unsigned int SparseMatrix< T >::nRows (  )  const [inline]
template<class T>
void SparseMatrix< T >::pairFill ( const vector< unsigned int > &  row,
const vector< unsigned int > &  col,
value 
) [inline]
template<class T>
void SparseMatrix< T >::print (  )  const [inline]

Prints out the contents in matrix form

Referenced by Stoich::print().

template<class T>
void SparseMatrix< T >::printInternal (  )  const [inline]

Prints out the contents in internal form

template<class T>
void SparseMatrix< T >::printTriplet ( const vector< Triplet< T > > &  t  )  [inline]
template<class T>
void SparseMatrix< T >::reorderColumns ( const vector< unsigned int > &  colMap  )  [inline]

Reorder columns from the matrix based on a map of old to new column indices. newCols contains the indices of columns from the old matrix that are to be retained, in the order that they will occupy in the new matrix. It can have fewer or more indices than the original.

Referenced by testSparseMatrix(), testSparseMatrix2(), and testSparseMatrixReorder().

template<class T>
void SparseMatrix< T >::rowOperation ( unsigned int  row,
unary_function< T, void > &  f 
) [inline]
template<class T>
void SparseMatrix< T >::set ( unsigned int  row,
unsigned int  column,
value 
) [inline]

Assigns and if necessary adds an entry in the matrix. This variant does NOT remove any existing entry.

Referenced by Stoich::installAndUnschedFuncRate(), SparseMsg::setEntry(), testSparseMatrix(), testSparseMatrix2(), and testSparseMatrixReorder().

template<class T>
void SparseMatrix< T >::setSize ( unsigned int  nrows,
unsigned int  ncolumns 
) [inline]
template<class T>
void SparseMatrix< T >::transpose (  )  [inline]

Does a transpose, using as workspace a vector of size 3 N_ 0257 -> 0011122

Referenced by SparseMsg::randomConnect(), Gsolve::rebuildGssaSystem(), testSparseMatrix(), testSparseMatrix2(), and SparseMsg::transpose().

template<class T>
void SparseMatrix< T >::tripletFill ( const vector< unsigned int > &  row,
const vector< unsigned int > &  col,
const vector< T > &  z 
) [inline]
template<class T>
void SparseMatrix< T >::unset ( unsigned int  row,
unsigned int  column 
) [inline]

Removes specified entry.

Referenced by SparseMsg::unsetEntry().


Member Data Documentation

template<class T>
vector< unsigned int > SparseMatrix< T >::colIndex_ [protected]
template<class T>
vector< T > SparseMatrix< T >::N_ [protected]
template<class T>
unsigned int SparseMatrix< T >::ncolumns_ [protected]
template<class T>
unsigned int SparseMatrix< T >::nrows_ [protected]
template<class T>
vector< unsigned int > SparseMatrix< T >::rowStart_ [protected]

The documentation for this class was generated from the following file:

Generated on 1 Jul 2015 for MOOSE by  doxygen 1.6.1