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

#include <CE_SparseMatrix.h>

Public Types

typedef T value_type
 

Public Member Functions

 CE_SparseMatrixELLT ()
 
virtual ~CE_SparseMatrixELLT ()
 
void init (int rows, int nzperrow, bool colmajor=true)
 Initialize to the given number of rows and non-zeros per row. More...
 
template<bool colmajor>
void initFromMatrix (const UT_SparseMatrixELLT< T, colmajor > &src, bool block=true)
 Initialize from the provided UT_SparseMatrixELL. More...
 
void matchAndCopyToMatrix (UT_SparseMatrixELLT< T, true > &dst, bool block=true) const
 
int getNumRows () const
 Returns the number of rows. More...
 
int getNonZerosPerRow () const
 Returns the number of non-zeros per row. More...
 
void multVec (const CE_VectorT< T > &v, CE_VectorT< T > &result) const
 Sparse-matrix vector multiply. More...
 
void getDiagonalInv (CE_VectorT< T > &result) const
 Get the inverse of the diagonal. More...
 
float solveConjugateGradient (CE_VectorT< T > &x, const CE_VectorT< T > &b, T tol2=1e-5, int max_iters=-1, int *iterout=NULL) const
 Solve Ax = b using conjugate gradient with Jacobi pre-conditioning,. More...
 

Protected Member Functions

void allocBuffers () const
 
void releaseBuffers ()
 
cl::Kernel loadKernel (const char *kernelName, const char *opt=NULL) const
 
cl::KernelFunctor bind (const char *kernelName) const
 

Protected Attributes

cl::Buffer myRowValsBuffer
 
cl::Buffer myColumnsBuffer
 
int myRows
 
int myNonZeros
 
bool myColMajor
 
cl::NDRange myGlobalRange
 
cl::NDRange myLocalRange
 

Detailed Description

template<typename T>
class CE_SparseMatrixELLT< T >

An ELL-format sparse matrix for OpenCL. This class is fairly limited; its primary purpose is to initialize with an alread-populated UT_SparseMatrixELL, then call its solveConjugateGradient function to solve a linear system using OpenCL.

Definition at line 27 of file CE_SparseMatrix.h.

Member Typedef Documentation

template<typename T >
typedef T CE_SparseMatrixELLT< T >::value_type

Definition at line 31 of file CE_SparseMatrix.h.

Constructor & Destructor Documentation

template<typename T >
CE_SparseMatrixELLT< T >::CE_SparseMatrixELLT ( )
template<typename T >
virtual CE_SparseMatrixELLT< T >::~CE_SparseMatrixELLT ( )
virtual

Member Function Documentation

template<typename T >
void CE_SparseMatrixELLT< T >::allocBuffers ( ) const
protected
template<typename T >
cl::KernelFunctor CE_SparseMatrixELLT< T >::bind ( const char *  kernelName) const
protected
template<typename T >
void CE_SparseMatrixELLT< T >::getDiagonalInv ( CE_VectorT< T > &  result) const

Get the inverse of the diagonal.

template<typename T >
int CE_SparseMatrixELLT< T >::getNonZerosPerRow ( ) const
inline

Returns the number of non-zeros per row.

Definition at line 54 of file CE_SparseMatrix.h.

template<typename T >
int CE_SparseMatrixELLT< T >::getNumRows ( ) const
inline

Returns the number of rows.

Definition at line 51 of file CE_SparseMatrix.h.

template<typename T >
void CE_SparseMatrixELLT< T >::init ( int  rows,
int  nzperrow,
bool  colmajor = true 
)

Initialize to the given number of rows and non-zeros per row.

template<typename T >
template<bool colmajor>
void CE_SparseMatrixELLT< T >::initFromMatrix ( const UT_SparseMatrixELLT< T, colmajor > &  src,
bool  block = true 
)

Initialize from the provided UT_SparseMatrixELL.

Definition at line 82 of file CE_SparseMatrix.h.

template<typename T >
cl::Kernel CE_SparseMatrixELLT< T >::loadKernel ( const char *  kernelName,
const char *  opt = NULL 
) const
protected
template<typename T >
void CE_SparseMatrixELLT< T >::matchAndCopyToMatrix ( UT_SparseMatrixELLT< T, true > &  dst,
bool  block = true 
) const

Copy back to the provided UT_SparseMatrixELL. Only callable with column-major destinations.

template<typename T >
void CE_SparseMatrixELLT< T >::multVec ( const CE_VectorT< T > &  v,
CE_VectorT< T > &  result 
) const

Sparse-matrix vector multiply.

template<typename T >
void CE_SparseMatrixELLT< T >::releaseBuffers ( )
protected
template<typename T >
float CE_SparseMatrixELLT< T >::solveConjugateGradient ( CE_VectorT< T > &  x,
const CE_VectorT< T > &  b,
T  tol2 = 1e-5,
int  max_iters = -1,
int iterout = NULL 
) const

Solve Ax = b using conjugate gradient with Jacobi pre-conditioning,.

Member Data Documentation

template<typename T >
bool CE_SparseMatrixELLT< T >::myColMajor
protected

Definition at line 75 of file CE_SparseMatrix.h.

template<typename T >
cl::Buffer CE_SparseMatrixELLT< T >::myColumnsBuffer
mutableprotected

Definition at line 72 of file CE_SparseMatrix.h.

template<typename T >
cl::NDRange CE_SparseMatrixELLT< T >::myGlobalRange
protected

Definition at line 76 of file CE_SparseMatrix.h.

template<typename T >
cl::NDRange CE_SparseMatrixELLT< T >::myLocalRange
protected

Definition at line 76 of file CE_SparseMatrix.h.

template<typename T >
int CE_SparseMatrixELLT< T >::myNonZeros
protected

Definition at line 74 of file CE_SparseMatrix.h.

template<typename T >
int CE_SparseMatrixELLT< T >::myRows
protected

Definition at line 73 of file CE_SparseMatrix.h.

template<typename T >
cl::Buffer CE_SparseMatrixELLT< T >::myRowValsBuffer
mutableprotected

Definition at line 72 of file CE_SparseMatrix.h.


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