Documentation 6b54b78464
Loading...
Searching...
No Matches
CCompressedSparsePattern< Index_t > Class Template Reference

A simple class to store adjacency information in a compressed format suitable for sparse matrix operations. If built for row-major storage the inner indices are column indices and the pattern should be used as (row,icol), otherwise as (col,irow). More...

#include <graph_toolbox.hpp>

Inheritance diagram for CCompressedSparsePattern< Index_t >:
[legend]

Classes

struct  CInnerIter
 Type to allow range for loops over inner indices. More...
 

Public Types

using IndexType = Index_t
 

Public Member Functions

 CCompressedSparsePattern ()=default
 Default construction.
 
template<class Iterator >
 CCompressedSparsePattern (Iterator outerPtrBegin, Iterator outerPtrEnd, Index_t defaultInnerIdx)
 Construct with default inner indices.
 
 CCompressedSparsePattern (su2vector< Index_t > &&outerPtr, su2vector< Index_t > &&innerIdx)
 Construct from rvalue refs.
 
template<class T >
 CCompressedSparsePattern (const T &outerPtr, const T &innerIdx)
 Construct from vector-like objects of any type with methods "size()" and "data()" (returning a pointer).
 
template<class T >
 CCompressedSparsePattern (const T &lil)
 Build from a "list of lists" type object.
 
void buildDiagPtr ()
 Build a list of pointers to the diagonal entries of the pattern.
 
void buildTransposePtr ()
 Build a list of pointers to the transpose entries of the pattern, requires symmetry.
 
bool empty () const
 
Index_t getOuterSize () const
 
Index_t getNumNonZeros () const
 
Index_t getNumNonZeros (Index_t iOuterIdx) const
 
Index_t getInnerIdx (Index_t iOuterIdx, Index_t iNonZero) const
 
Index_t & getInnerIdx (Index_t iOuterIdx, Index_t iNonZero)
 
CInnerIter getInnerIter (Index_t iOuterIdx) const
 
Index_t findInnerIdx (Index_t iOuterIdx, Index_t iInnerIdx) const
 
bool isNonZero (Index_t iOuterIdx, Index_t iInnerIdx) const
 
Index_t quickFindInnerIdx (Index_t iOuterIdx, Index_t iInnerIdx) const
 
Index_t getDiagPtr (Index_t iDiagIdx) const
 
const Index_t * outerPtr () const
 
const Index_t * innerIdx () const
 
const Index_t * innerIdx (Index_t iOuterIdx) const
 
const Index_t * diagPtr () const
 
const su2vector< Index_t > & transposePtr () const
 
Index_t getMinInnerIdx () const
 
Index_t getMaxInnerIdx () const
 

Detailed Description

template<typename Index_t>
class CCompressedSparsePattern< Index_t >

A simple class to store adjacency information in a compressed format suitable for sparse matrix operations. If built for row-major storage the inner indices are column indices and the pattern should be used as (row,icol), otherwise as (col,irow).

Member Typedef Documentation

◆ IndexType

template<typename Index_t >
using CCompressedSparsePattern< Index_t >::IndexType = Index_t

Constructor & Destructor Documentation

◆ CCompressedSparsePattern() [1/5]

template<typename Index_t >
CCompressedSparsePattern< Index_t >::CCompressedSparsePattern ( )
default

Default construction.

◆ CCompressedSparsePattern() [2/5]

template<typename Index_t >
template<class Iterator >
CCompressedSparsePattern< Index_t >::CCompressedSparsePattern ( Iterator  outerPtrBegin,
Iterator  outerPtrEnd,
Index_t  defaultInnerIdx 
)
inline

Construct with default inner indices.

Parameters
[in]outerPtrBegin- Start of outer pointers.
[in]outerPtrEnd- End of outer pointers.
[in]defaultInnerIdx- Default value for inner indices.

◆ CCompressedSparsePattern() [3/5]

template<typename Index_t >
CCompressedSparsePattern< Index_t >::CCompressedSparsePattern ( su2vector< Index_t > &&  outerPtr,
su2vector< Index_t > &&  innerIdx 
)
inline

Construct from rvalue refs.

Note
This is the most efficient constructor as no data copy occurs.
Parameters
[in]outerPtr- Outer index pointers.
[in]innerIdx- Inner indices.

◆ CCompressedSparsePattern() [4/5]

template<typename Index_t >
template<class T >
CCompressedSparsePattern< Index_t >::CCompressedSparsePattern ( const T &  outerPtr,
const T &  innerIdx 
)
inline

Construct from vector-like objects of any type with methods "size()" and "data()" (returning a pointer).

Parameters
[in]outerPtr- Outer index pointers.
[in]innerIdx- Inner indices.

◆ CCompressedSparsePattern() [5/5]

template<typename Index_t >
template<class T >
CCompressedSparsePattern< Index_t >::CCompressedSparsePattern ( const T &  lil)
inline

Build from a "list of lists" type object.

Parameters
[in]lil- An object with operator [][] and method "size" e.g. vector<vector<?> >.

Member Function Documentation

◆ buildDiagPtr()

template<typename Index_t >
void CCompressedSparsePattern< Index_t >::buildDiagPtr ( )
inline

Build a list of pointers to the diagonal entries of the pattern.

◆ buildTransposePtr()

template<typename Index_t >
void CCompressedSparsePattern< Index_t >::buildTransposePtr ( )
inline

Build a list of pointers to the transpose entries of the pattern, requires symmetry.

◆ diagPtr()

template<typename Index_t >
const Index_t * CCompressedSparsePattern< Index_t >::diagPtr ( ) const
inline
Returns
Raw pointer to the diagonal pointer vector.

◆ empty()

template<typename Index_t >
bool CCompressedSparsePattern< Index_t >::empty ( ) const
inline
Returns
True if the pattern is empty, i.e. has not been built yet.

◆ findInnerIdx()

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::findInnerIdx ( Index_t  iOuterIdx,
Index_t  iInnerIdx 
) const
inline
Parameters
[in]iOuterIdx- Outer index (row/col).
[in]iInnerIdx- Inner index (col/row).
Returns
Absolute position of non zero entry (iOuterIdx,iInnerIdx), or NNZ if position does not belong to the pattern.

◆ getDiagPtr()

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::getDiagPtr ( Index_t  iDiagIdx) const
inline
Parameters
[in]iDiagIdx- Diagonal index (row == col).
Returns
Absolute position of the diagonal entry.

◆ getInnerIdx() [1/2]

template<typename Index_t >
Index_t & CCompressedSparsePattern< Index_t >::getInnerIdx ( Index_t  iOuterIdx,
Index_t  iNonZero 
)
inline
Parameters
[in]iOuterIdx- Outer index.
[in]iNonZero- Relative position of the inner index.
Returns
The index of the i'th inner index associated with the outer index.

◆ getInnerIdx() [2/2]

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::getInnerIdx ( Index_t  iOuterIdx,
Index_t  iNonZero 
) const
inline
Parameters
[in]iOuterIdx- Outer index.
[in]iNonZero- Relative position of the inner index.
Returns
The index of the i'th inner index associated with the outer index.

◆ getInnerIter()

template<typename Index_t >
CInnerIter CCompressedSparsePattern< Index_t >::getInnerIter ( Index_t  iOuterIdx) const
inline
Parameters
[in]iOuterIdx- Outer index.
Returns
Iterator to inner dimension to use in range for loops.

◆ getMaxInnerIdx()

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::getMaxInnerIdx ( ) const
inline
Returns
The maximum inner index.

◆ getMinInnerIdx()

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::getMinInnerIdx ( ) const
inline
Returns
The minimum inner index.

◆ getNumNonZeros() [1/2]

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::getNumNonZeros ( ) const
inline
Returns
Number of non zero entries.

◆ getNumNonZeros() [2/2]

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::getNumNonZeros ( Index_t  iOuterIdx) const
inline
Parameters
[in]iOuterIdx- Outer index.
Returns
Number of inner indices associated with the outer index.

◆ getOuterSize()

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::getOuterSize ( ) const
inline
Returns
Number of rows/columns.

◆ innerIdx() [1/2]

template<typename Index_t >
const Index_t * CCompressedSparsePattern< Index_t >::innerIdx ( ) const
inline
Returns
Raw pointer to the inner index vector.

◆ innerIdx() [2/2]

template<typename Index_t >
const Index_t * CCompressedSparsePattern< Index_t >::innerIdx ( Index_t  iOuterIdx) const
inline
Returns
Raw pointer to the inner index vector, offset for a given outer index.

◆ isNonZero()

template<typename Index_t >
bool CCompressedSparsePattern< Index_t >::isNonZero ( Index_t  iOuterIdx,
Index_t  iInnerIdx 
) const
inline
Parameters
[in]iOuterIdx- Outer index (row/col).
[in]iInnerIdx- Inner index (col/row).
Returns
True if (iOuterIdx,iInnerIdx) exists, i.e. is non zero.

◆ outerPtr()

template<typename Index_t >
const Index_t * CCompressedSparsePattern< Index_t >::outerPtr ( ) const
inline
Returns
Raw pointer to the outer pointer vector.

◆ quickFindInnerIdx()

template<typename Index_t >
Index_t CCompressedSparsePattern< Index_t >::quickFindInnerIdx ( Index_t  iOuterIdx,
Index_t  iInnerIdx 
) const
inline
Parameters
[in]iOuterIdx- Outer index (row/col).
[in]iInnerIdx- Inner index (col/row).
Returns
Absolute position of non zero entry (iOuterIdx,iInnerIdx).
Note
This method is only safe if the entry exists.

◆ transposePtr()

template<typename Index_t >
const su2vector< Index_t > & CCompressedSparsePattern< Index_t >::transposePtr ( ) const
inline
Returns
Raw pointer to the transpose pointer vector.

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