|
CGAL 6.1 - Homological Discrete Vector Fields
|
#include <CGAL/HDVF/Sub_sparse_matrix.h>
CGAL::OSM::Sparse_matrix< CoefficientType, ChainTypeFlag >.
The class Sub_sparse_matrix is a technical class implementing the concept SparseMatrix 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 reduced homology (and thus to compute persistent homology and Alexander duality).
Sub_sparse_matrix inherits Sparse_matrix structure and basically adds two bitboards:
The class does not modify linear algebra operators, but focuses on adapted iterators, output operators and methods to adjust the "mask".
SparseMatrix | CoefficientType | a model of the Ring concept, providing the ring used to compute homology. |
| ChainTypeFlag | an integer constant encoding the type of matrices (OSM::COLUMN or OSM::ROW). |
Public Member Functions | |
| Sub_sparse_matrix (size_t rowCount=0, size_t columnCount=0) | |
Default constructor of a new Sub_sparse_matrix (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. | |
| Sub_sparse_matrix (const Sub_sparse_matrix &otherToCopy) | |
Copy constructor from another Sub_sparse_matrix. | |
| Sub_sparse_matrix (const Sparse_matrix< CoefficientType, ChainTypeFlag > &otherToCopy) | |
Copy constructor from Sparse_matrix. | |
| 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 to the end of the 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. | |
| Sub_sparse_matrix & | operator= (const Sub_sparse_matrix &otherToCopy) |
Assigns to other Sub_sparse_matrix. | |
Public Member Functions inherited from CGAL::OSM::Sparse_matrix< CoefficientType, ChainTypeFlag > | |
| Sparse_matrix () | |
Default constructor (empty new Sparse_matrix object). | |
| Sparse_matrix (const size_t rowCount, const size_t columnCount) | |
| Constructor with given rows/columns sizes. | |
| template<int CTF> | |
| Sparse_matrix (const Sparse_matrix< CoefficientType, CTF > &otherToCopy) | |
| Copy constructor. | |
| Sparse_matrix & | operator= (const Sparse_matrix &otherToCopy) |
| Assigns to other matrix. | |
| void | nullify () |
| Cleans a SparseMatrix (set all coefficients to zero). | |
| bool | is_null () |
| Tests if a SparseMatrix is null. | |
| Sparse_matrix & | operator+= (const Sparse_matrix &other) |
| Matrices sum and assign: COLUMN += COLUMN or ROW += ROW. | |
| Sparse_matrix & | operator-= (const Sparse_matrix &other) |
| Matrices subtraction and assign: COLUMN -= COLUMN or ROW -= ROW. | |
| Sparse_matrix & | operator*= (const CoefficientType &lambda) |
| Applies factor on each coefficients and assign. | |
| MatrixChain | operator[] (size_t index) const |
| Gets the value of a chain from a const matrix. | |
| Sparse_matrix & | operator/= (const std::vector< size_t > &indexes) |
| Removes a set of chains from a matrix. | |
| Sparse_matrix & | operator/= (const size_t index) |
Removes the chain at a given index from a matrix. | |
| Bitboard::iterator | begin () const noexcept |
| Iterator to the index of the first non null chain. | |
| Bitboard::iterator | end () const noexcept |
| Iterator to the ending of chains indices. | |
| Bitboard::reverse_iterator | reverse_begin () noexcept |
| Reverse iterator to the index of the last non null chain. | |
| Bitboard::reverse_iterator | reverse_begin (size_t index) noexcept |
| Bitboard::reverse_iterator | reverse_end () noexcept |
| Reverse iterator to the ending of chains indices. | |
| Sparse_matrix< CoefficientType, COLUMN+ROW - ChainTypeFlag > | transpose () |
| Transposes a matrix. | |
| std::pair< size_t, size_t > | dimensions () const |
| Gets the matrix sizes. | |
Protected Attributes | |
| Bitboard | _subChains |
| A bitboard describing subchains restriction. | |
| Bitboard | _subChainsStates |
| A bitboard containing state of each chain (restricted to subchains). | |
Protected Attributes inherited from CGAL::OSM::Sparse_matrix< CoefficientType, ChainTypeFlag > | |
| std::vector< Sparse_chain< CoefficientType, ChainTypeFlag > > | _chains |
| Bitboard | _chainsStates |
| std::pair< size_t, size_t > | _size |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, const Sub_sparse_matrix &matrix) |
Displays a Sub_sparse_matrix in the output stream. | |
Additional Inherited Members | |
Public Types inherited from CGAL::OSM::Sparse_matrix< CoefficientType, ChainTypeFlag > | |
| typedef Sparse_chain< CoefficientType, ChainTypeFlag > | MatrixChain |
| Type of chains associated to the matrix. | |
Protected Member Functions inherited from CGAL::OSM::Sparse_matrix< CoefficientType, ChainTypeFlag > | |
| MatrixChain & | operator[] (const size_t _index) |
| void | set_coef (const size_t i, const size_t j, const CoefficientType d) |
| CoefficientType | get_coef (const size_t i, const size_t j) const |
| Sparse_matrix & | del_column (size_t index) |
| Sparse_matrix & | del_row (size_t index) |
| Sparse_matrix & | del_coef (size_t i, size_t j) |
| CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::Sub_sparse_matrix | ( | size_t | rowCount = 0, |
| size_t | columnCount = 0 |
||
| ) |
Default constructor of a new Sub_sparse_matrix (with given rows/columns sizes and mask set to full).
Default constructor. Constructor with sizes, initialize an empty Sub_sparse_matrix of type ChainTypeFlag with coefficients of type CoefficientType, a given size along rows/columns. The constructor sets the mask to full.
| [in] | rowCount | The number of rows to preallocate (default 0). |
| [in] | columnCount | The number of columns to preallocate (default 0). |
| CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::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 type ChainTypeFlag with coefficients of type CoefficientType, a given size along rows/columns and a given mask.
| [in] | rowCount | The number of rows to preallocate. |
| [in] | columnCount | The number of columns to preallocate. |
| [in] | subChain | Bitboard describing the subset of indices considered as a mask. |
| CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::Sub_sparse_matrix | ( | const Sub_sparse_matrix< CoefficientType, ChainTypeFlag > & | otherToCopy | ) |
Copy constructor from another Sub_sparse_matrix.
Create a new empty Sub_sparse_matrix from another of type ChainTypeFlag with coefficients of type CoefficientType, a given size along rows/columns and a given mask.
| [in] | otherToCopy | Sub_sparse_matrix copied into this. |
| CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::Sub_sparse_matrix | ( | const Sparse_matrix< CoefficientType, ChainTypeFlag > & | otherToCopy | ) |
Copy constructor from Sparse_matrix.
Create a new Sub_sparse_matrix from a Sparse_matrix object (with the same ChainTypeFlag). Create a "full" mask.
| [in] | otherToCopy | The matrix copied. |
| Sub_sparse_matrix & CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::operator= | ( | const Sub_sparse_matrix< CoefficientType, ChainTypeFlag > & | otherToCopy | ) |
Assigns to other Sub_sparse_matrix.
Assign to other matrix coefficient-wise, and copy the bitboard.
| [in] | otherToCopy | The matrix we want to copy. |
| void CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::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).
| [in] | index | Index to turn off in the mask. |
| void CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::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).
| [in] | index | Index to turn on in the mask. |
| void CGAL::OSM::Sub_sparse_matrix< CoefficientType, ChainTypeFlag >::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.
|
friend |
Displays a Sub_sparse_matrix in the output stream.
Displays the sparse matrix as well as its mask.
| [in] | stream | The output stream. |
| [in] | matrix | The matrix to display. |