|
CGAL 6.1 - 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.
SparseChains encode non zero coefficients of (sparse) chains.
SparseChain can be either row or column vectors. The following constants, called ChainTypeFlag, encode the direction of sparse chains (and sparse matrices).
OSM::COLUMN for column-major chains and matrices (which is the default),OSM::ROW for row-major chains and matrices.CGAL::OSM::Sparse_chain<Ring, ChainTypeFlag> Ring SparseMatrix Types | |
| typedef Ring | CoefficientType |
Type of coefficients stored in the matrix (a model of Ring). | |
| typedef int | ChainTypeFlag |
| Matrix and chain type (either OSM::ROW or OSM::COLUMN). | |
| typedef unspecified_type | iterator |
| SparseChain iterator type. | |
| typedef unspecified_type | const_iterator |
| SparseChain constant iterator type. | |
Creation, filling | |
| SparseChain () | |
| Creates new empty sparse chain. | |
| SparseChain (size_t chainSize) | |
| Creates new empty sparse chain of given size. | |
| SparseChain (const Sparse_chain &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 |
| Iterator to the end of the chain. | |
| const_iterator | end () const noexcept |
| Constant iterator to the end of the chain. | |
| const_iterator | cend () const noexcept |
| Constant iterator to the end of the chain. | |
Linear algebra operators | |
| Sparse_chain & | operator+= (const Sparse_chain &_other) |
Adds a chain to this. | |
| Sparse_chain & | operator-= (const Sparse_chain &_other) |
Subtracts a chain from this. | |
| Sparse_chain & | operator*= (const CoefficientType &lambda) |
Applies factor on each coefficients of this. | |
| Sparse_chain | transpose () |
| Transposes a SparseChain. | |
| Sparse_chain | operator+ (const Sparse_chain &first, const Sparse_chain &second) |
| Adds two chains together. | |
| Sparse_chain | operator- (const Sparse_chain &first, const Sparse_chain &second) |
| Subtracts two chains together. | |
| Sparse_chain | operator* (const CoefficientType &lambda, const Sparse_chain &chain) |
| Applies factor on each coefficients. | |
| Sparse_chain | operator* (const Sparse_chain &_chain, const CoefficientType &lambda) |
| Applies factor on each coefficients. | |
| Sparse_matrix< CoefficientType, COLUMN > | operator* (const Sparse_chain< CoefficientType, COLUMN > &column, const Sparse_chain< CoefficientType, ROW > &row) |
| Performs matrix multiplication between two chains (COLUMN x ROW) and return a COLUMN matrix. | |
| Sparse_matrix< CoefficientType, ROW > | operator% (const Sparse_chain< CoefficientType, COLUMN > &column, const Sparse_chain< CoefficientType, ROW > &row) |
| Performs matrix multiplication between two chains (COLUMN x ROW) and return a ROW matrix. | |
| CoefficientType | operator* (const Sparse_chain< CoefficientType, ROW > &row, const Sparse_chain< CoefficientType, COLUMN > &column) |
| Performs dot product between two chains (ROW x COLUMN). | |
Access and modifications | |
| bool | operator== (const Sparse_chain &other_chain) |
| Compares two chains. | |
| CoefficientType | operator[] (size_t index) |
| Gets the value of a coefficient of the chain. | |
| CoefficientType | get_coef (size_t index) const |
| Gets the value of a coefficient of the chain. | |
| void | set_coef (size_t index, CoefficientType 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. | |
| Sparse_chain & | operator/= (const std::vector< size_t > &indexes) |
| Restricts the chain to a sub-chain by removing indices. | |
| Sparse_chain & | 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. | |
| Sparse_chain | operator/ (const Sparse_chain &chain, const std::vector< size_t > &indices) |
| Gets a subchain from the chain. | |
| Sparse_chain | operator/ (const Sparse_chain &chain, size_t indices) |
| Gets a subchain from the chain. | |
Output | |
| std::ostream & | operator<< (std::ostream &stream, const Sparse_chain &chain) |
Inserts chain in the output stream. | |
| SparseChain::SparseChain | ( | size_t | chainSize | ) |
Creates new empty sparse chain of given size.
Constructor with size, initializes an empty sparse chain.
| SparseChain::SparseChain | ( | const Sparse_chain & | other | ) |
Creates new sparse chain by copy.
Copy constructor, initialize a sparse chain from an existing sparse chain of same ChaintypeFlag.
|
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 iterator to the end of the chain.
The function returns a constant iterator to the ending of the chain.
|
noexcept |
Constant iterator to the end of the chain.
The function returns a constant iterator to the ending of the chain.
|
noexcept |
Iterator to the end of the chain.
The function returns an iterator to the ending of the chain.
| void SparseChain::nullify | ( | ) |
Removes all coefficients from the chain.
The function comes to set all coefficients to zero.
| Sparse_chain & SparseChain::operator+= | ( | const Sparse_chain & | _other | ) |
Adds a chain to this.
Add a chain to this. Chains must have the same CoefficientType and the same ChainTypeFlag.
| Sparse_chain & SparseChain::operator-= | ( | const Sparse_chain & | _other | ) |
Subtracts a chain from this.
Subtract a chain from this. Chains must have the same CoefficientType and the same ChainTypeFlag.
| Sparse_chain & SparseChain::operator/= | ( | const std::vector< size_t > & | indexes | ) |
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.
| Sparse_chain & 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 CoefficientType.
| Sparse_chain SparseChain::transpose | ( | ) |
Transposes a SparseChain.
The result is a chain with ChainTypeFlag switched between COLUMN and ROW.
|
friend |
Performs matrix multiplication between two chains (COLUMN x ROW) and return a ROW matrix.
Generate a row-based matrix from the matrix multiplication and return it. Chains must have the same CoefficientType.
|
friend |
Performs matrix multiplication between two chains (COLUMN x ROW) and return a COLUMN matrix.
Generate a column-based matrix from the matrix multiplication and return it. Chains must have the same CoefficientType.
|
friend |
Performs dot product between two chains (ROW x COLUMN).
Chains must have the same CoefficientType.
|
friend |
Adds two chains together.
Add two chains and return the result in a new matrix. Chains must have the same CoefficientType and the same ChainTypeFlag.
|
friend |
Subtracts two chains together.
Subtract two chains and return the result in a new matrix. Chains must have the same CoefficientType and the same ChainTypeFlag.
|
friend |
Gets a subchain from the chain.
Return a new chain where all coefficients of indices provided in the vector are removed.
|
friend |
Gets a subchain from the chain.
Return a new chain where the coefficients at a given index is removed.