|
CGAL 6.2 - Homological Discrete Vector Fields
|
The concept SparseChain describes the requirements for sparse vectors (called sparse chains in homology) optimized for topological computations. More precisely, SparseChain provides all the operations on chains required by the SparseMatrix concept.
SparseChain encodes non zero coefficients of a sparse vector.
SparseChain can be either row or column vectors. The following constants, called StorageFormat, encode the direction of sparse chains (and sparse matrices).
CGAL::OSM::COLUMN for column-major chains and matrices (which is the default),CGAL::OSM::ROW for row-major chains and matrices.CGAL::OSM::Sparse_chain<CoefficientRing, StorageFormat> Types | |
| typedef unspecified_type | Coefficient_ring |
Type of coefficients stored in the matrix (a model of IntegralDomainWithoutDivision). | |
| typedef int | Storage_format |
| Matrix and chain storage format (either CGAL::OSM::ROW or CGAL::OSM::COLUMN). | |
| typedef unspecified_type | iterator |
| Sparse chain iterator type. | |
| typedef unspecified_type | const_iterator |
| Sparse chain constant iterator type. | |
Creation, filling | |
| SparseChain () | |
| Creates new empty sparse chain. | |
| SparseChain (size_t chainSize) | |
| Creates new empty sparse chain (ie. zero-chain) of given size. | |
| SparseChain (const SparseChain &other) | |
| Creates new sparse chain by copy. | |
| SparseChain & | operator= (const SparseChain &other) |
| Assigns to other chain. | |
Matrix informations and iterators | |
| size_t | dimension () const |
| Returns the dimension of the basis (that is, size of the chain). | |
| iterator | begin () noexcept |
| Iterator to the beginning of the chain. | |
| const_iterator | begin () const noexcept |
| Constant iterator to the beginning of the chain. | |
| const_iterator | cbegin () const noexcept |
| Constant iterator to the beginning of the chain. | |
| iterator | end () noexcept |
| Past-the-end iterator of the chain. | |
| const_iterator | end () const noexcept |
| Constant past-the-end iterator of the chain. | |
| const_iterator | cend () const noexcept |
| Constant past-the-end iterator of the chain. | |
Linear algebra operators | |
| SparseChain & | operator+= (const SparseChain &_other) |
Adds a chain to this. | |
| SparseChain & | operator-= (const SparseChain &_other) |
Subtracts a chain from this. | |
| SparseChain & | operator*= (const Coefficient_ring &lambda) |
Applies multiplication on each coefficient of this. | |
| SparseChain | transpose () |
| Transposes a sparse chain. | |
| SparseChain | operator+ (const SparseChain &first, const SparseChain &second) |
| Adds two chains together. | |
| SparseChain | operator- (const SparseChain &first, const SparseChain &second) |
| Subtracts a chain from another chain. | |
| SparseChain | operator* (const Coefficient_ring &lambda, const SparseChain &chain) |
| Applies multiplication on each coefficient. | |
| SparseChain | operator* (const SparseChain &_chain, const Coefficient_ring &lambda) |
| Applies multiplication on each coefficient. | |
| SparseMatrix | operator* (const SparseChain &column, const SparseChain &row) |
| Performs matrix multiplication between a column chain and a row chain and returns a column-based matrix. | |
| SparseMatrix | operator% (const Sparse_chain &column, const Sparse_chain &row) |
| Performs matrix multiplication between a column chain and a row chain and returns a row-based matrix. | |
| Coefficient_ring | operator* (const Sparse_chain &row, const Sparse_chain &column) |
| Performs dot product between a row chain and a column chain. | |
Access and modifications | |
| bool | operator== (const SparseChain &other_chain) |
| Compares two chains. | |
| Coefficient_ring | operator[] (size_t index) |
| Gets the value of a coefficient of the chain. | |
| Coefficient_ring | get_coefficient (size_t index) const |
| Gets the value of a coefficient of the chain. | |
| void | set_coefficient (size_t index, Coefficient_ring d) |
| Sets a given coefficient of the chain. | |
| bool | is_null (size_t index) const |
| Checks if a coefficient of the chain is null. | |
| bool | is_null () const |
| Checks if the chain is null. | |
| SparseChain & | operator/= (const std::vector< size_t > &indices) |
| Restricts the chain to a sub-chain by removing indices. | |
| SparseChain & | operator/= (size_t index) |
| Restricts the chain to a sub-chain by removing a given index. | |
| void | nullify () |
| Removes all coefficients from the chain. | |
| bool | is_column () const |
| Checks if chain is a column. | |
| bool | is_row () const |
| Checks if chain is a row. | |
| SparseChain | operator/ (const SparseChain &chain, const std::vector< size_t > &indices) |
| Gets a sub-chain from the chain. | |
| SparseChain | operator/ (const SparseChain &chain, size_t indices) |
| Gets a sub-chain from the chain. | |
Output | |
| std::ostream & | operator<< (std::ostream &stream, const SparseChain &chain) |
Inserts chain in the output stream. | |
| SparseChain::SparseChain | ( | ) |
Creates new empty sparse chain.
Creates a sparse chain encoding an empty linear combination of cells.
| SparseChain::SparseChain | ( | size_t | chainSize | ) |
Creates new empty sparse chain (ie. zero-chain) of given size.
Constructor with size, initializes an empty sparse chain encoding a linear combination of cells with all coefficients null.
| SparseChain::SparseChain | ( | const SparseChain & | other | ) |
Creates new sparse chain by copy.
Copy constructor, initialize a sparse chain from an existing sparse chain of same storage format.
|
noexcept |
Constant iterator to the beginning of the chain.
The function returns a constant iterator to the first non zero index.
|
noexcept |
Iterator to the beginning of the chain.
The function returns an iterator to the first non zero index.
|
noexcept |
Constant iterator to the beginning of the chain.
The function returns a constant iterator to the first non zero index.
|
noexcept |
Constant past-the-end iterator of the chain.
The function returns a constant iterator past the endi of the chain.
|
noexcept |
Constant past-the-end iterator of the chain.
The function returns a constant iterator past the end of the chain.
|
noexcept |
Past-the-end iterator of the chain.
The function returns an iterator past the end of the chain.
| void SparseChain::nullify | ( | ) |
Removes all coefficients from the chain.
The function comes to set all coefficients to zero.
| SparseChain & SparseChain::operator+= | ( | const SparseChain & | _other | ) |
Adds a chain to this.
Add a chain to this. Chains must have the same Coefficient_ring and the same storage format.
| SparseChain & SparseChain::operator-= | ( | const SparseChain & | _other | ) |
Subtracts a chain from this.
Subtract a chain from this. Chains must have the same Coefficient_ring and the same storage format.
| SparseChain & SparseChain::operator/= | ( | const std::vector< size_t > & | indices | ) |
Restricts the chain to a sub-chain by removing indices.
Removes all indices provided in the vector from the chain. Return a reference to the modified chain.
| SparseChain & SparseChain::operator/= | ( | size_t | index | ) |
Restricts the chain to a sub-chain by removing a given index.
Removes the index provided from the chain. Return a reference to the modified chain.
| SparseChain & SparseChain::operator= | ( | const SparseChain & | other | ) |
Assigns to other chain.
Assign to other chain coefficient-wise, equivalent to copying it.
SparseChain must have the same Coefficient_ring.
| SparseChain SparseChain::transpose | ( | ) |
Transposes a sparse chain.
The result is a chain with storage format switched between column and row.
|
friend |
Performs matrix multiplication between a column chain and a row chain and returns a row-based matrix.
Generate a row-based matrix from the matrix multiplication and return it.
Coefficient_ring. column.is_column() and row.is_row() must be true
|
friend |
Performs dot product between a row chain and a column chain.
Coefficient_ring. row.is_row() and column.is_column() must be true
|
friend |
Performs matrix multiplication between a column chain and a row chain and returns a column-based matrix.
Generate a column-based matrix from the matrix multiplication and return it.
Coefficient_ring. column.is_column() and row.is_row() must be true
|
friend |
Adds two chains together.
Add two chains and return the result in a new matrix. Chains must have the same Coefficient_ring and the same storage format.
|
friend |
Subtracts a chain from another chain.
Subtract two chains and return the result in a new matrix. Chains must have the same Coefficient_ring and the same storage format.
|
friend |
Gets a sub-chain from the chain.
Return a new chain where all coefficients of indices provided in the vector are removed.
|
friend |
Gets a sub-chain from the chain.
Return a new chain where the coefficients at a given index is removed.