|
CGAL 6.3-dev - Homological Discrete Vector Fields
|
#include <CGAL/OSM/Sparse_chain.h>
The class Sparse_chain implements the concept SparseChain, that is, sparse vectors (encoding homological chains) optimized for topological computations.
Given a complex (for instance a simplicial, cubical or cellular complex) which cells in a given dimension \(q\) are numbered \(\{\sigma_i\,;\, i=1\ldots n_q\}\), homology with coefficients in a given ring \(\mathbb K\) defines \(q\)-chains as formal linear combinations:
\[\gamma = \sum_{i=1}^{n_q}\lambda_i\cdot \sigma_i\]
with coefficients \(\lambda_i\in\mathbb K\). In the basis \(\{\sigma_i\,;\, i=1\ldots n_q\}\), the coordinates of \(\gamma\) are given by the vector: \([\lambda_1,\ldots \lambda_{n_q}]\).
Now, as chains considered in homology are boundaries of cells, most \(\lambda_i\) coefficients are null. Hence Sparse_chain encodes such vectors in a "sparse" way, that is, storing only non zero coefficients through a map:
\[i\mapsto \lambda_i\ \ \ \forall i=1\ldots n_q\text{ such that }\lambda_i\neq 0\]
Moreover, as per any linear algebra vector, a Sparse_chain is either a column or row vector (the StorageFormat parameter determines this storage format).
The class Sparse_chain provides standard linear algebra operators and fast iterators and block operations (set, get and nullify) which are required to implement efficiently HDVFs.
SparseChain | CoefficientRing | a model of the IntegralDomainWithoutDivision concept, providing the ring used to compute homology. |
| StorageFormat | an integer constant encoding the storage format of matrices (CGAL::OSM::COLUMN or CGAL::OSM::ROW). |
Public Types | |
| typedef CoefficientRing | Coefficient_ring |
| Type of the coefficient ring. | |
| template<typename CT, int SF> | |
| using | Sparse_matrix_derived = OSM::Sparse_matrix_structure<OSM::Sparse_chain>::Sparse_matrix_type<CT, SF> |
| Type of derived sparse matrices. | |
| typedef std::unordered_map< size_t, CoefficientRing >::iterator | iterator |
| Type of chains iterators. | |
| typedef std::unordered_map< size_t, CoefficientRing >::const_iterator | const_iterator |
| Type of chains constant iterators. | |
Public Member Functions | |
| Sparse_chain () | |
| Creates new empty sparse chain. | |
| Sparse_chain (const size_t chain_size) | |
| Creates new empty sparse chain (i.e. | |
| Sparse_chain (const Sparse_chain &otherToCopy) | |
| Copy constructor. | |
| CGAL::OSM::Sparse_chain< CoefficientRing, StorageFormat >::Sparse_chain | ( | ) |
Creates new empty sparse chain.
Creates a sparse chain encoding an empty linear combination of cells.
| CGAL::OSM::Sparse_chain< CoefficientRing, StorageFormat >::Sparse_chain | ( | const size_t | chain_size | ) |
Creates new empty sparse chain (i.e.
zero-chain) of given size.
Constructor with size, initializes an empty sparse chain encoding a linear combination of cells with all coefficients null.
| chain_size | The size of the sparse chain. |
| CGAL::OSM::Sparse_chain< CoefficientRing, StorageFormat >::Sparse_chain | ( | const Sparse_chain< CoefficientRing, StorageFormat > & | otherToCopy | ) |
Copy constructor.