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

#include <CE_SparseMatrix.h>

Public Types

typedef T value_type
 

Public Member Functions

 CE_SparseMatrixELLT ()
 
virtual ~CE_SparseMatrixELLT ()
 
void init (inttype 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, useexint > &src, bool block=true)
 Initialize from the provided UT_SparseMatrixELL. More...
 
void matchAndCopyToMatrix (UT_SparseMatrixELLT< T, true, useexint > &dst, bool block=true) const
 
inttype 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
 
inttype myRows
 
int myNonZeros
 
bool myColMajor
 
cl::NDRange myGlobalRange
 
cl::NDRange myLocalRange
 

Detailed Description

template<typename T, bool useexint = false>
class CE_SparseMatrixELLT< T, useexint >

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 30 of file CE_SparseMatrix.h.

Member Typedef Documentation

template<typename T , bool useexint = false>
typedef T CE_SparseMatrixELLT< T, useexint >::value_type

Definition at line 36 of file CE_SparseMatrix.h.

Constructor & Destructor Documentation

template<typename T , bool useexint = false>
CE_SparseMatrixELLT< T, useexint >::CE_SparseMatrixELLT ( )
template<typename T , bool useexint = false>
virtual CE_SparseMatrixELLT< T, useexint >::~CE_SparseMatrixELLT ( )
virtual

Member Function Documentation

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

Get the inverse of the diagonal.

template<typename T , bool useexint = false>
int CE_SparseMatrixELLT< T, useexint >::getNonZerosPerRow ( ) const
inline

Returns the number of non-zeros per row.

Definition at line 61 of file CE_SparseMatrix.h.

template<typename T , bool useexint = false>
inttype CE_SparseMatrixELLT< T, useexint >::getNumRows ( ) const
inline

Returns the number of rows.

Definition at line 58 of file CE_SparseMatrix.h.

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

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

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

Initialize from the provided UT_SparseMatrixELL.

Definition at line 89 of file CE_SparseMatrix.h.

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

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

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

Sparse-matrix vector multiply.

template<typename T , bool useexint = false>
void CE_SparseMatrixELLT< T, useexint >::releaseBuffers ( )
protected
template<typename T , bool useexint = false>
float CE_SparseMatrixELLT< T, useexint >::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 useexint = false>
bool CE_SparseMatrixELLT< T, useexint >::myColMajor
protected

Definition at line 82 of file CE_SparseMatrix.h.

template<typename T , bool useexint = false>
cl::Buffer CE_SparseMatrixELLT< T, useexint >::myColumnsBuffer
mutableprotected

Definition at line 79 of file CE_SparseMatrix.h.

template<typename T , bool useexint = false>
cl::NDRange CE_SparseMatrixELLT< T, useexint >::myGlobalRange
protected

Definition at line 83 of file CE_SparseMatrix.h.

template<typename T , bool useexint = false>
cl::NDRange CE_SparseMatrixELLT< T, useexint >::myLocalRange
protected

Definition at line 83 of file CE_SparseMatrix.h.

template<typename T , bool useexint = false>
int CE_SparseMatrixELLT< T, useexint >::myNonZeros
protected

Definition at line 81 of file CE_SparseMatrix.h.

template<typename T , bool useexint = false>
inttype CE_SparseMatrixELLT< T, useexint >::myRows
protected

Definition at line 80 of file CE_SparseMatrix.h.

template<typename T , bool useexint = false>
cl::Buffer CE_SparseMatrixELLT< T, useexint >::myRowValsBuffer
mutableprotected

Definition at line 79 of file CE_SparseMatrix.h.


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