CGAL 6.3-dev - Homological Discrete Vector Fields
Loading...
Searching...
No Matches
CGAL::OSM::Sub_sparse_matrix< CoefficientRing, StorageFormat, SparseChainType > Class Template Reference

#include <CGAL/HDVF/Sub_sparse_matrix.h>

Inherits from

CGAL::OSM::Sparse_matrix< CoefficientRing, StorageFormat, OSM::Sparse_chain >.

Definition

template<typename CoefficientRing, int StorageFormat, template< typename, int > typename SparseChainType = OSM::Sparse_chain>
class CGAL::OSM::Sub_sparse_matrix< CoefficientRing, StorageFormat, SparseChainType >

The class Sub_sparse_matrix is a technical class, deriving from Sparse_matrix together with a system of masks to partially screen matrices (and restrict computations to a subset of indices along their major direction).

This class is used to compute relative homology (and thus to compute persistent homology and Alexander duality).

Sub_sparse_matrix basically adds to Sparse_matrix two bitboards:

  • one describing indices of cells belonging to the subset of indices considered (let us denote it by \(A\))
  • the second providing corresponding indices of non-empty chains in \(A\)
Warning
The class does not modify linear algebra operators, but focuses on adapted iterators, output operators and methods to adjust the "mask".
Is model of
SparseMatrix
Template Parameters
CoefficientRinga model of the IntegralDomainWithoutDivision concept, providing the ring used to compute homology.
StorageFormatan integer constant encoding the storage format of matrices (OSM::COLUMN or OSM::ROW).
SparseChainTypea model of SparseChain used to store chains of the sparse matrix (default: OSM::Sparse_chain).

Public Member Functions

 Sub_sparse_matrix (size_t rowCount=0, size_t columnCount=0)
 Constructor with given rows/columns sizes and mask set to full.
 Sub_sparse_matrix (size_t rowCount, size_t columnCount, const Bitboard &subChain)
 Constructor with given rows/columns sizes and a mask.
Bitboard::iterator begin () const noexcept
 Iterator to the beginning of the indices of non empty chains inside the mask.
Bitboard::iterator end () const noexcept
 Iterator past-the-end of the indices of non empty chains inside the mask.
void set_sub (const Bitboard &new_subChains)
 Changes the indices subset mask.
void set_bit_on (size_t index)
 Adds an index to the mask.
void set_bit_off (size_t index)
 Removes an index from the mask.
void complement ()
 Changes the mask to its complement.

Additional Inherited Members

Public Types inherited from CGAL::OSM::Sparse_matrix< CoefficientRing, StorageFormat, OSM::Sparse_chain >
typedef CoefficientRing Coefficient_ring
 Type of coefficient ring.
using Sparse_chain_type
 Type of sparse chains used in the matrix.
typedef Sparse_chain_type< CoefficientRing, StorageFormat > Matrix_chain
 Type of chains associated to the matrix.
Public Attributes inherited from CGAL::OSM::Sparse_matrix< CoefficientRing, StorageFormat, OSM::Sparse_chain >
int Storage_format
 Storage format of the matrix.

Constructor & Destructor Documentation

◆ Sub_sparse_matrix() [1/2]

template<typename CoefficientRing, int StorageFormat, template< typename, int > typename SparseChainType = OSM::Sparse_chain>
CGAL::OSM::Sub_sparse_matrix< CoefficientRing, StorageFormat, SparseChainType >::Sub_sparse_matrix ( size_t rowCount = 0,
size_t columnCount = 0 )

Constructor with given rows/columns sizes and mask set to full.

Constructor with sizes, initializes an empty Sub_sparse_matrix of a given size along rows/columns. The constructor sets the mask to full.

Parameters
rowCountThe number of rows to preallocate (default 0).
columnCountThe number of columns to preallocate (default 0).

◆ Sub_sparse_matrix() [2/2]

template<typename CoefficientRing, int StorageFormat, template< typename, int > typename SparseChainType = OSM::Sparse_chain>
CGAL::OSM::Sub_sparse_matrix< CoefficientRing, StorageFormat, SparseChainType >::Sub_sparse_matrix ( size_t rowCount,
size_t columnCount,
const Bitboard & subChain )

Constructor with given rows/columns sizes and a mask.

Create a new empty Sub_sparse_matrix of given size along rows/columns and a given mask.

Parameters
rowCountThe number of rows to preallocate.
columnCountThe number of columns to preallocate.
subChainBitboard describing the subset of indices considered as a mask.

Member Function Documentation

◆ set_bit_off()

template<typename CoefficientRing, int StorageFormat, template< typename, int > typename SparseChainType = OSM::Sparse_chain>
void CGAL::OSM::Sub_sparse_matrix< CoefficientRing, StorageFormat, SparseChainType >::set_bit_off ( size_t index)

Removes an index from the mask.

Set the bit encoding a given index to 0 (ie. remove the index from the mask).

Parameters
indexIndex to turn off in the mask.

◆ set_bit_on()

template<typename CoefficientRing, int StorageFormat, template< typename, int > typename SparseChainType = OSM::Sparse_chain>
void CGAL::OSM::Sub_sparse_matrix< CoefficientRing, StorageFormat, SparseChainType >::set_bit_on ( size_t index)

Adds an index to the mask.

Set the bit encoding a given index to 1 (ie. add the index in the mask).

Parameters
indexIndex to turn on in the mask.

◆ set_sub()

template<typename CoefficientRing, int StorageFormat, template< typename, int > typename SparseChainType = OSM::Sparse_chain>
void CGAL::OSM::Sub_sparse_matrix< CoefficientRing, StorageFormat, SparseChainType >::set_sub ( const Bitboard & new_subChains)

Changes the indices subset mask.

Set a new mask encoding a new subset of indices along the major dimension.