HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_SparseMatrixELLT< T, colmajor > Class Template Reference

#include <GAS_ProjectNonDivergentVariational.h>

Public Member Functions

 UT_SparseMatrixELLT ()
 
 UT_SparseMatrixELLT (int rows, int nzeros)
 
void init (int rows, int nzeros)
 
void zero ()
 
int getNumRows () const
 
int getNonZerosPerRow () const
 
const UT_ValArray< T > & getRowValues () const
 
UT_ValArray< T > & getRowValues ()
 
const UT_IntArraygetColumns () const
 
UT_IntArraygetColumns ()
 
exint index (int row, int nz) const
 
bool appendRowElement (int row, int col, T val, int &rowidx)
 
 THREADED_METHOD (UT_SparseMatrixELLT, shouldMultiThread(), sortRows) void sortRowsPartial(const UT_JobInfo &info)
 
void removeEffectOfRows (const UT_ExintArray &rows)
 
bool shouldMultiThread () const
 
void copyToSparse (UT_SparseMatrixT< T, false > &A) const
 Copy to the supplied SparseMatrix. More...
 
 THREADED_METHOD1_CONST (UT_SparseMatrixELLT, shouldMultiThread(), getDiagonalInv, UT_VectorT< T > &, out) void getDiagonalInvPartial(UT_VectorT< T > &out
 
 THREADED_METHOD2_CONST (UT_SparseMatrixELLT, shouldMultiThread(), multVec, const UT_VectorT< T > &, v, UT_VectorT< T > &, result) void multVecPartial(const UT_VectorT< T > &v
 
void multVecAndDot (const UT_VectorT< T > &v, UT_VectorT< T > &result, fpreal64 *dotpq) const
 
void multVecAndDotUpTo (const UT_VectorT< T > &v, UT_VectorT< T > &result, fpreal64 *dotpq, exint solverbase) const
 
float solveConjugateGradient (UT_VectorT< T > &x, const UT_VectorT< T > &b, const UT_SparseMatrixRowT< T > *GT, T tol2=1e-5, int max_iters=-1, int *iterout=NULL) const
 
void printSparseMatlab (std::ostream &os, const UT_String &varname) const
 
void printSparseMatrixMarket (std::ostream &os) const
 

Public Attributes

const UT_JobInfo &info const
 
UT_VectorT< T > & result
 
UT_VectorT< T > const
UT_JobInfo &info 
const
 

Detailed Description

template<typename T, bool colmajor>
class UT_SparseMatrixELLT< T, colmajor >

This is another highly specialized varient of the SparseMatrix which allows multithreaded addition of elements to individual rows and supports a conjugate gradient solve. This can be useful for solvers which need to create and solve large linear systems in parallel. It uses the ELL format which is appropriate for matrices with a limited but fairly consistent numer of non-zeros per row, for example the result of discretizations across regular grids.

Definition at line 25 of file GAS_ProjectNonDivergentVariational.h.

Constructor & Destructor Documentation

template<typename T, bool colmajor>
UT_SparseMatrixELLT< T, colmajor >::UT_SparseMatrixELLT ( )
template<typename T, bool colmajor>
UT_SparseMatrixELLT< T, colmajor >::UT_SparseMatrixELLT ( int  rows,
int  nzeros 
)

Member Function Documentation

template<typename T, bool colmajor>
bool UT_SparseMatrixELLT< T, colmajor >::appendRowElement ( int  row,
int  col,
T  val,
int rowidx 
)
inline

Definition at line 536 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::copyToSparse ( UT_SparseMatrixT< T, false > &  A) const

Copy to the supplied SparseMatrix.

template<typename T, bool colmajor>
const UT_IntArray& UT_SparseMatrixELLT< T, colmajor >::getColumns ( ) const
inline

Definition at line 526 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
UT_IntArray& UT_SparseMatrixELLT< T, colmajor >::getColumns ( )
inline

Definition at line 527 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
int UT_SparseMatrixELLT< T, colmajor >::getNonZerosPerRow ( ) const
inline

Definition at line 521 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
int UT_SparseMatrixELLT< T, colmajor >::getNumRows ( ) const
inline

Definition at line 519 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
const UT_ValArray<T>& UT_SparseMatrixELLT< T, colmajor >::getRowValues ( ) const
inline

Definition at line 523 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
UT_ValArray<T>& UT_SparseMatrixELLT< T, colmajor >::getRowValues ( )
inline

Definition at line 524 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
exint UT_SparseMatrixELLT< T, colmajor >::index ( int  row,
int  nz 
) const
inline

Definition at line 529 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::init ( int  rows,
int  nzeros 
)
template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::multVecAndDot ( const UT_VectorT< T > &  v,
UT_VectorT< T > &  result,
fpreal64 dotpq 
) const
template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::multVecAndDotUpTo ( const UT_VectorT< T > &  v,
UT_VectorT< T > &  result,
fpreal64 dotpq,
exint  solverbase 
) const
template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::printSparseMatlab ( std::ostream &  os,
const UT_String varname 
) const
template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::printSparseMatrixMarket ( std::ostream &  os) const
template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::removeEffectOfRows ( const UT_ExintArray rows)

Every reference to given rows is removed from the diagonal. Because searching the whole matrix is expensive, assumes it is a standard fluid matrix, so for each specified row, it looks at all columns that are not itself and removes those.

template<typename T, bool colmajor>
bool UT_SparseMatrixELLT< T, colmajor >::shouldMultiThread ( ) const
inline

Definition at line 557 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
float UT_SparseMatrixELLT< T, colmajor >::solveConjugateGradient ( UT_VectorT< T > &  x,
const UT_VectorT< T > &  b,
const UT_SparseMatrixRowT< T > *  GT,
T  tol2 = 1e-5,
int  max_iters = -1,
int iterout = NULL 
) const

Solves conjugate gradient using our specialized functions. These allow us to perform some normal and dot operations while the cache is still hot. This matrix is the matrix to solve. The provided GT matrix is the upper triangular result of cholesky factoriziation. Norm is hardcoded to 2. If the GT matrix is null, no preconditioner will be used.

template<typename T, bool colmajor>
UT_SparseMatrixELLT< T, colmajor >::THREADED_METHOD ( UT_SparseMatrixELLT< T, colmajor >  ,
shouldMultiThread()  ,
sortRows   
) const
template<typename T, bool colmajor>
UT_SparseMatrixELLT< T, colmajor >::THREADED_METHOD1_CONST ( UT_SparseMatrixELLT< T, colmajor >  ,
shouldMultiThread()  ,
getDiagonalInv  ,
UT_VectorT< T > &  ,
out   
)

Get the inverse of the diagonal. Required for the conjugate gradient solve when using Jacobi pre-conditioning.

template<typename T, bool colmajor>
UT_SparseMatrixELLT< T, colmajor >::THREADED_METHOD2_CONST ( UT_SparseMatrixELLT< T, colmajor >  ,
shouldMultiThread()  ,
multVec  ,
const UT_VectorT< T > &  ,
v  ,
UT_VectorT< T > &  ,
result   
) const
template<typename T, bool colmajor>
void UT_SparseMatrixELLT< T, colmajor >::zero ( )

Member Data Documentation

template<typename T, bool colmajor>
const UT_JobInfo& info UT_SparseMatrixELLT< T, colmajor >::const

Definition at line 572 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
UT_VectorT<T> const UT_JobInfo& info UT_SparseMatrixELLT< T, colmajor >::const

Definition at line 579 of file UT_SparseMatrix.h.

template<typename T, bool colmajor>
UT_VectorT< T > & UT_SparseMatrixELLT< T, colmajor >::result

Definition at line 579 of file UT_SparseMatrix.h.


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