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

#include <GAS_ProjectNonDivergentVariational.h>

Public Member Functions

 UT_SparseMatrixELLT ()
 
 UT_SparseMatrixELLT (inttype rows, int nzeros)
 
void init (inttype rows, int nzeros)
 
void zero ()
 
exint getNumRows () const
 
int getNonZerosPerRow () const
 
const UT_ValArray< T > & getRowValues () const
 
UT_ValArray< T > & getRowValues ()
 
const UT_ValArray< inttype > & getColumns () const
 
UT_ValArray< inttype > & getColumns ()
 
exint index (inttype row, int nz) const
 
bool appendRowElement (inttype row, inttype 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, bool exint>
class UT_SparseMatrixELLT< T, colmajor, exint >

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, bool exint>
UT_SparseMatrixELLT< T, colmajor, exint >::UT_SparseMatrixELLT ( )
template<typename T, bool colmajor, bool exint>
UT_SparseMatrixELLT< T, colmajor, exint >::UT_SparseMatrixELLT ( inttype  rows,
int  nzeros 
)

Member Function Documentation

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

Definition at line 543 of file UT_SparseMatrix.h.

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

Copy to the supplied SparseMatrix.

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

Definition at line 533 of file UT_SparseMatrix.h.

template<typename T, bool colmajor, bool exint>
UT_ValArray<inttype>& UT_SparseMatrixELLT< T, colmajor, exint >::getColumns ( )
inline

Definition at line 534 of file UT_SparseMatrix.h.

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

Definition at line 528 of file UT_SparseMatrix.h.

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

Definition at line 526 of file UT_SparseMatrix.h.

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

Definition at line 530 of file UT_SparseMatrix.h.

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

Definition at line 531 of file UT_SparseMatrix.h.

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

Definition at line 536 of file UT_SparseMatrix.h.

template<typename T, bool colmajor, bool exint>
void UT_SparseMatrixELLT< T, colmajor, exint >::init ( inttype  rows,
int  nzeros 
)
template<typename T, bool colmajor, bool exint>
void UT_SparseMatrixELLT< T, colmajor, exint >::multVecAndDot ( const UT_VectorT< T > &  v,
UT_VectorT< T > &  result,
fpreal64 dotpq 
) const
template<typename T, bool colmajor, bool exint>
void UT_SparseMatrixELLT< T, colmajor, exint >::multVecAndDotUpTo ( const UT_VectorT< T > &  v,
UT_VectorT< T > &  result,
fpreal64 dotpq,
exint  solverbase 
) const
template<typename T, bool colmajor, bool exint>
void UT_SparseMatrixELLT< T, colmajor, exint >::printSparseMatlab ( std::ostream &  os,
const UT_String varname 
) const
template<typename T, bool colmajor, bool exint>
void UT_SparseMatrixELLT< T, colmajor, exint >::printSparseMatrixMarket ( std::ostream &  os) const
template<typename T, bool colmajor, bool exint>
void UT_SparseMatrixELLT< T, colmajor, exint >::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 exint>
bool UT_SparseMatrixELLT< T, colmajor, exint >::shouldMultiThread ( ) const
inline

Definition at line 564 of file UT_SparseMatrix.h.

template<typename T, bool colmajor, bool exint>
float UT_SparseMatrixELLT< T, colmajor, exint >::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, bool exint>
UT_SparseMatrixELLT< T, colmajor, exint >::THREADED_METHOD ( UT_SparseMatrixELLT< T, colmajor, exint ,
shouldMultiThread()  ,
sortRows   
) const
template<typename T, bool colmajor, bool exint>
UT_SparseMatrixELLT< T, colmajor, exint >::THREADED_METHOD1_CONST ( UT_SparseMatrixELLT< T, colmajor, exint ,
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, bool exint>
UT_SparseMatrixELLT< T, colmajor, exint >::THREADED_METHOD2_CONST ( UT_SparseMatrixELLT< T, colmajor, exint ,
shouldMultiThread()  ,
multVec  ,
const UT_VectorT< T > &  ,
v  ,
UT_VectorT< T > &  ,
result   
) const
template<typename T, bool colmajor, bool exint>
void UT_SparseMatrixELLT< T, colmajor, exint >::zero ( )

Member Data Documentation

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

Definition at line 579 of file UT_SparseMatrix.h.

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

Definition at line 586 of file UT_SparseMatrix.h.

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

Definition at line 586 of file UT_SparseMatrix.h.


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