HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE > Class Template Reference

Sparse, square matrix representing a 3D stencil operator of size STENCIL_SIZE. More...

#include <ConjGradient.h>

Classes

class  ConstRow
 Read-only accessor to a row of this matrix. More...
 
class  ConstValueIter
 Iterator over the stored values in a row of this matrix. More...
 
struct  IsFiniteOp
 
struct  MatrixCopyOp
 
class  RowEditor
 Read/write accessor to a row of this matrix. More...
 

Public Types

using ValueType = ValueType_
 
using VectorType = Vector< ValueType >
 
using Ptr = SharedPtr< SparseStencilMatrix >
 

Public Member Functions

 SparseStencilMatrix (SizeType n)
 Construct an n x n matrix with at most STENCIL_SIZE nonzero elements per row. More...
 
 SparseStencilMatrix (const SparseStencilMatrix &)
 Deep copy the given matrix. More...
 
void setValue (SizeType row, SizeType col, const ValueType &)
 Set the value at the given coordinates. More...
 
ConstRow getConstRow (SizeType row) const
 Return a read-only view onto the given row of this matrix. More...
 
RowEditor getRowEditor (SizeType row)
 Return a read/write view onto the given row of this matrix. More...
 
template<typename VecValueType >
void vectorMultiply (const Vector< VecValueType > &inVec, Vector< VecValueType > &resultVec) const
 Multiply this matrix by inVec and return the result in resultVec. More...
 
template<typename VecValueType >
void vectorMultiply (const VecValueType *inVec, VecValueType *resultVec) const
 Multiply this matrix by the vector represented by the array inVec and return the result in resultVec. More...
 
template<typename OtherValueType >
bool eq (const SparseStencilMatrix< OtherValueType, STENCIL_SIZE > &other, ValueType eps=Tolerance< ValueType >::value()) const
 Return true if this matrix is equivalent to the given matrix to within the specified tolerance. More...
 
bool isFinite () const
 Return true if every element of this matrix has a finite value. More...
 
std::string str () const
 Return a string representation of this matrix. More...
 
SizeType numRows () const
 Return the number of rows in this matrix. More...
 
SizeType size () const
 Return the number of rows in this matrix. More...
 
const ValueTypegetValue (SizeType row, SizeType col) const
 Return the value at the given coordinates. More...
 
const ValueTypeoperator() (SizeType row, SizeType col) const
 Return the value at the given coordinates. More...
 
template<typename Scalar >
void scale (const Scalar &s)
 Multiply all elements in the matrix by s;. More...
 
template<typename Scalar >
SparseStencilMatrixoperator*= (const Scalar &s)
 Multiply all elements in the matrix by s;. More...
 

Static Public Attributes

static constexpr ValueType sZeroValue = zeroVal<ValueType>()
 

Detailed Description

template<typename ValueType, SizeType STENCIL_SIZE>
class openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >

Sparse, square matrix representing a 3D stencil operator of size STENCIL_SIZE.

The implementation is a variation on compressed row storage (CRS).

Definition at line 39 of file ConjGradient.h.

Member Typedef Documentation

template<typename ValueType, SizeType STENCIL_SIZE>
using openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::Ptr = SharedPtr<SparseStencilMatrix>

Definition at line 242 of file ConjGradient.h.

template<typename ValueType, SizeType STENCIL_SIZE>
using openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::ValueType = ValueType_

Definition at line 240 of file ConjGradient.h.

template<typename ValueType, SizeType STENCIL_SIZE>
using openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::VectorType = Vector<ValueType>

Definition at line 241 of file ConjGradient.h.

Constructor & Destructor Documentation

template<typename ValueType , SizeType STENCIL_SIZE>
openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::SparseStencilMatrix ( SizeType  n)
inline

Construct an n x n matrix with at most STENCIL_SIZE nonzero elements per row.

Definition at line 819 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::SparseStencilMatrix ( const SparseStencilMatrix< ValueType, STENCIL_SIZE > &  other)
inline

Deep copy the given matrix.

Definition at line 855 of file ConjGradient.h.

Member Function Documentation

template<typename ValueType, SizeType STENCIL_SIZE>
template<typename OtherValueType >
bool openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::eq ( const SparseStencilMatrix< OtherValueType, STENCIL_SIZE > &  other,
ValueType  eps = Tolerance<ValueType>::value() 
) const
inline

Return true if this matrix is equivalent to the given matrix to within the specified tolerance.

Definition at line 1007 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
SparseStencilMatrix< ValueType, STENCIL_SIZE >::ConstRow openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::getConstRow ( SizeType  row) const
inline

Return a read-only view onto the given row of this matrix.

Definition at line 1075 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
SparseStencilMatrix< ValueType, STENCIL_SIZE >::RowEditor openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::getRowEditor ( SizeType  row)
inline

Return a read/write view onto the given row of this matrix.

Definition at line 1065 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
const ValueType & openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::getValue ( SizeType  row,
SizeType  col 
) const
inline

Return the value at the given coordinates.

Warning
It is not safe to get values from a row while another thread is setting values in that row.

Definition at line 884 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
bool openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::isFinite ( ) const
inline

Return true if every element of this matrix has a finite value.

Definition at line 1042 of file ConjGradient.h.

template<typename ValueType, SizeType STENCIL_SIZE>
SizeType openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::numRows ( ) const
inline

Return the number of rows in this matrix.

Definition at line 258 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
const ValueType & openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::operator() ( SizeType  row,
SizeType  col 
) const
inline

Return the value at the given coordinates.

Warning
It is not safe to get values from a row while another thread is setting values in that row.

Definition at line 893 of file ConjGradient.h.

template<typename ValueType, SizeType STENCIL_SIZE>
template<typename Scalar >
SparseStencilMatrix& openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::operator*= ( const Scalar &  s)
inline

Multiply all elements in the matrix by s;.

Definition at line 285 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
template<typename Scalar >
void openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::scale ( const Scalar &  s)
inline

Multiply all elements in the matrix by s;.

Definition at line 921 of file ConjGradient.h.

template<typename ValueType, SizeType STENCIL_SIZE>
void openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::setValue ( SizeType  row,
SizeType  col,
const ValueType val 
)
inline

Set the value at the given coordinates.

Warning
It is not safe to set values in the same row simultaneously from multiple threads.

Definition at line 874 of file ConjGradient.h.

template<typename ValueType, SizeType STENCIL_SIZE>
SizeType openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::size ( void  ) const
inline

Return the number of rows in this matrix.

Definition at line 259 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
std::string openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::str ( ) const
inline

Return a string representation of this matrix.

Definition at line 1053 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
template<typename VecValueType >
void openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::vectorMultiply ( const Vector< VecValueType > &  inVec,
Vector< VecValueType > &  resultVec 
) const
inline

Multiply this matrix by inVec and return the result in resultVec.

Exceptions
ArithmeticErrorif either inVec or resultVec is not of size N, where N x N is the size of this matrix.

Definition at line 952 of file ConjGradient.h.

template<typename ValueType , SizeType STENCIL_SIZE>
template<typename VecValueType >
void openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::vectorMultiply ( const VecValueType *  inVec,
VecValueType *  resultVec 
) const
inline

Multiply this matrix by the vector represented by the array inVec and return the result in resultVec.

Warning
Both inVec and resultVec must have at least N elements, where N x N is the size of this matrix.

Definition at line 971 of file ConjGradient.h.

Member Data Documentation

template<typename ValueType, SizeType STENCIL_SIZE>
constexpr ValueType openvdb::OPENVDB_VERSION_NAME::math::pcg::SparseStencilMatrix< ValueType, STENCIL_SIZE >::sZeroValue = zeroVal<ValueType>()
inlinestatic

Definition at line 248 of file ConjGradient.h.


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