Concept of the column classes used by the Matrix class. The classes the columns inheritates from are either real or dummy classes, see Row_access_option, Column_dimension_option, Chain_column_option. If used with column compression, the column type has to have its std::hash
method.
More...
Public Types | |
using | Master = unspecified |
using | index = unspecified |
using | id_index = unspecified |
using | dimension_type = unspecified |
using | Field_element_type = unspecified |
using | Cell = unspecified |
using | Column_settings = unspecified |
using | iterator = unspecified |
using | const_iterator = unspecified |
using | reverse_iterator = unspecified |
using | const_reverse_iterator = unspecified |
Public Types inherited from Gudhi::persistence_matrix::Row_access< Master_matrix > | |
using | index = typename Master_matrix::index |
using | id_index = typename Master_matrix::id_index |
using | Cell_type = typename Master_matrix::Cell_type |
using | Row_container_type = typename Master_matrix::row_container_type |
Public Types inherited from Gudhi::persistence_matrix::Column_dimension_holder< Master_matrix > | |
using | dimension_type = typename Master_matrix::dimension_type |
Public Types inherited from Gudhi::persistence_matrix::Chain_column_extra_properties< Master_matrix > | |
using | index = typename Master_matrix::index |
using | id_index = typename Master_matrix::id_index |
Public Member Functions | |
PersistenceMatrixColumn (Column_settings *colSettings=nullptr) | |
Constructs an empty column. If cellConstructor is not specified or is set to nullptr , the column can only be used as a dummy, i.e., no modifying method should be used or there will be a segmentation fault. Same goes for operators if PersistenceMatrixOptions::is_z2 is false. More... | |
template<class Container_type = typename Master_matrix::boundary_type> | |
PersistenceMatrixColumn (const Container_type &nonZeroRowIndices, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::cell_rep_type. If the dimension is stored, the face is assumed to be simplicial and its dimension to be nonZeroRowIndices length - 1 or 0 . Otherwise, the dimension should be specified with another constructor. More... | |
template<class Container_type = typename Master_matrix::boundary_type, class Row_container_type > | |
PersistenceMatrixColumn (index columnIndex, const Container_type &nonZeroRowIndices, Row_container_type *rowContainer, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::cell_rep_type such that the rows can be accessed. Each new cell in the column is also inserted in a row using Row_access::insert_cell. If the dimension is stored, the face is assumed to be simplicial and its dimension to be nonZeroRowIndices length - 1 or 0 . Otherwise, the dimension should be specified with another constructor. More... | |
template<class Container_type = typename Master_matrix::boundary_type> | |
PersistenceMatrixColumn (const Container_type &nonZeroChainRowIndices, dimension_type dimension, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::cell_rep_type and stores the given dimension if Column_dimension_option is not a dummy. More... | |
template<class Container_type = typename Master_matrix::boundary_type, class Row_container_type > | |
PersistenceMatrixColumn (index columnIndex, const Container_type &nonZeroChainRowIndices, dimension_type dimension, Row_container_type *rowContainer, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::cell_rep_type such that the rows can be accessed. Each new cell in the column is also inserted in a row using Row_access::insert_cell. Stores the given dimension if Column_dimension_option is not a dummy. More... | |
PersistenceMatrixColumn (const PersistenceMatrixColumn &column, Column_settings *colSettings=nullptr) | |
Copy constructor. If operators or cellConstructor is not a null pointer, its value is kept instead of the one in the copied column. More... | |
template<class Row_container_type > | |
PersistenceMatrixColumn (const PersistenceMatrixColumn &column, index columnIndex, Row_container_type *rowContainer, Column_settings *colSettings=nullptr) | |
Copy constructor with row access. If operators or cellConstructor is not a null pointer, its value is kept instead of the one in the copied column. More... | |
PersistenceMatrixColumn (PersistenceMatrixColumn &&column) noexcept | |
Move constructor. More... | |
~PersistenceMatrixColumn () | |
Destructor. | |
std::vector< Field_element_type > | get_content (int columnLength=-1) const |
Returns the values of the column, zero values included. More... | |
bool | is_non_zero (id_index rowIndex) const |
Indicates if the cell at given row index has value zero. More... | |
bool | is_empty () |
Indicates if the column is empty or has only zero values. More... | |
std::size_t | size () const |
Returns the size of the underlying container. More... | |
template<class Map_type > | |
void | reorder (const Map_type &valueMap, [[maybe_unused]] index columnIndex=-1) |
Reorders the column with the given map of row indices. Also changes the column index stored in the cells if row access is enabled and columnIndex is not -1. More... | |
void | clear () |
Zeros/empties the column. More... | |
void | clear (id_index rowIndex) |
Zeros the cell at given row index. More... | |
id_index | get_pivot () |
Returns the row index of the pivot. If the column does not have a pivot, returns -1. More... | |
Field_element_type | get_pivot_value () |
Returns the value of the pivot. If the column does not have a pivot, returns 0. More... | |
iterator | begin () noexcept |
Returns a begin Cell iterator to iterate over all cells contained in the underlying container. More... | |
const_iterator | begin () const noexcept |
Returns a begin Cell const iterator to iterate over all cells contained in the underlying container. More... | |
iterator | end () noexcept |
Returns a end Cell iterator, iterating over all cells contained in the underlying container. More... | |
const_iterator | end () const noexcept |
Returns a end Cell const iterator, iterating over all cells contained in the underlying container. More... | |
reverse_iterator | rbegin () noexcept |
Returns a begin Cell reverse iterator to iterate over all cells contained in the underlying container. More... | |
const_reverse_iterator | rbegin () const noexcept |
Returns a begin Cell const reverse iterator to iterate over all cells contained in the underlying container. More... | |
reverse_iterator | rend () noexcept |
Returns a end Cell reverse iterator, iterating over all cells contained in the underlying container. More... | |
const_reverse_iterator | rend () const noexcept |
Returns a end Cell const reverse iterator, iterating over all cells contained in the underlying container. More... | |
template<class Cell_range > | |
PersistenceMatrixColumn & | operator+= (const Cell_range &column) |
Adds the given Cell range onto the column. More... | |
PersistenceMatrixColumn & | operator+= (PersistenceMatrixColumn &column) |
Adds the given column onto this column. More... | |
PersistenceMatrixColumn & | operator*= (const Field_element_type &val) |
Multiplies all values in the column with the given value. More... | |
template<class Cell_range > | |
PersistenceMatrixColumn & | multiply_target_and_add (const Field_element_type &val, const Cell_range &column) |
this = val * this + column More... | |
template<class Cell_range > | |
PersistenceMatrixColumn & | multiply_source_and_add (const Cell_range &column, const Field_element_type &val) |
this = this + column * val More... | |
PersistenceMatrixColumn & | operator= (const PersistenceMatrixColumn &other) |
Assign operator. Should be disabled when row access is enabled. | |
Public Member Functions inherited from Gudhi::persistence_matrix::Row_access< Master_matrix > | |
Row_access () | |
Default constructor. Sets the column index to -1 and the row container to nullptr. Should only be used by dummy columns. | |
Row_access (index columnIndex, Row_container_type *rows) | |
Constructor setting the column index and the row container by the given values. More... | |
Row_access (Row_access &&other) noexcept | |
Move constructor. More... | |
void | insert_cell (id_index rowIndex, Cell_type *cell) |
Inserts the given cell at the given row index. More... | |
void | unlink (Cell_type *cell) |
Removes the given cell from its row. More... | |
void | update_cell (const Cell_type &cell) |
If PersistenceMatrixOptions::has_intrusive_rows is false, updates the copy of the cell in its row. Otherwise does nothing. More... | |
index | get_column_index () const |
Returns the MatIdx column index. More... | |
Public Member Functions inherited from Gudhi::persistence_matrix::Column_dimension_holder< Master_matrix > | |
Column_dimension_holder () | |
Default constructor. Sets the dimension to 0 for boundary matrices and to -1 for chain matrices. | |
Column_dimension_holder (dimension_type dim) | |
Constructor setting the dimension to the given value. More... | |
Column_dimension_holder (const Column_dimension_holder &col) | |
Copy constructor. More... | |
Column_dimension_holder (Column_dimension_holder &&col) | |
Move constructor. More... | |
dimension_type | get_dimension () const |
Returns the dimension of the column. More... | |
Column_dimension_holder & | operator= (const Column_dimension_holder &other) |
Assign operator. | |
Public Member Functions inherited from Gudhi::persistence_matrix::Chain_column_extra_properties< Master_matrix > | |
Chain_column_extra_properties () | |
Default constructor. Sets the pivot and pair to -1, which means "not existing". | |
Chain_column_extra_properties (id_index pivot) | |
Constructor setting the pivot at the given value and the pair to -1 (i.e. not paired). More... | |
Chain_column_extra_properties (id_index pivot, index pair) | |
Constructor setting the pivot and the pair at the given values. More... | |
Chain_column_extra_properties (const Chain_column_extra_properties &col) | |
Copy constructor. More... | |
Chain_column_extra_properties (Chain_column_extra_properties &&col) | |
Move constructor. More... | |
index | get_paired_chain_index () const |
Returns -1 if the column is not paired, the MatIdx of the pair otherwise. More... | |
bool | is_paired () const |
Indicates if the column is paired or not. More... | |
void | assign_paired_chain (index other_col) |
Sets the value of the pair. More... | |
void | unassign_paired_chain () |
Unpairs a column. | |
Chain_column_extra_properties & | operator= (const Chain_column_extra_properties &other) |
Assign operator. | |
Friends | |
bool | operator== (const PersistenceMatrixColumn &c1, const PersistenceMatrixColumn &c2) |
Equality comparator. Equal in the sense that what is "supposed" to be contained in the columns is equal, not what is actually stored in the underlying container. For exemple, the underlying container of Vector_column can contain cells which were erased explicitely by clear(index). Those cells should not be taken into account while comparing. More... | |
bool | operator< (const PersistenceMatrixColumn &c1, const PersistenceMatrixColumn &c2) |
"Strictly smaller than" comparator. Usually a lexicographical order, but what matters is that the order is total. The order should apply on what is "supposed" to be contained in the columns, not what is actually stored in the underlying container. For exemple, the underlying container of Vector_column can contain cells which were erased explicitely by clear(index). Those cells should not be taken into account while comparing. More... | |
void | swap (PersistenceMatrixColumn &col1, PersistenceMatrixColumn &col2) |
Swap operator. | |
Concept of the column classes used by the Matrix class. The classes the columns inheritates from are either real or dummy classes, see Row_access_option, Column_dimension_option, Chain_column_option. If used with column compression, the column type has to have its std::hash
method.
Implementations of this concept are Heap_column, List_column, Vector_column, Naive_vector_column Set_column, Unordered_set_column, Intrusive_list_column and Intrusive_set_column.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::Cell = unspecified |
Cell.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::Column_settings = unspecified |
Structure giving access to external classes eventually necessary, like a cell pool for example.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::const_iterator = unspecified |
Column const_iterator type.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::const_reverse_iterator = unspecified |
Column const_reverse_iterator type.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::dimension_type = unspecified |
Type for dimension value.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::Field_element_type = unspecified |
Type of a field element.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::id_index = unspecified |
Type of IDIdx index.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::index = unspecified |
Type of MatIdx index.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::iterator = unspecified |
Column iterator type.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::Master = unspecified |
Master matrix, that is a templated Matrix.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::reverse_iterator = unspecified |
Column reverse_iterator type.
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | Column_settings * | colSettings = nullptr | ) |
Constructs an empty column. If cellConstructor
is not specified or is set to nullptr
, the column can only be used as a dummy, i.e., no modifying method should be used or there will be a segmentation fault. Same goes for operators
if PersistenceMatrixOptions::is_z2 is false.
colSettings | Pointer to a setting structure or nullptr . The structure should contain all the necessary classes specific to the column type, such as custom allocators. The specificities are this way hidden behind a commun interface for all column types. If colSettings is not specified or is equal to nullptr , the column should still be constructable eventhough not necessarily "usable". |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | const Container_type & | nonZeroRowIndices, |
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::cell_rep_type. If the dimension is stored, the face is assumed to be simplicial and its dimension to be nonZeroRowIndices length - 1
or 0
. Otherwise, the dimension should be specified with another constructor.
Container_type | Range of Matrix::cell_rep_type. Assumed to have a begin(), end() and size() method. |
nonZeroRowIndices | Range of Matrix::cell_rep_type representing all rows with non zero values. |
colSettings | Pointer to an existing setting structure. The structure should contain all the necessary classes specific to the column type, such as custom allocators. The specificities are this way hidden behind a commun interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | index | columnIndex, |
const Container_type & | nonZeroRowIndices, | ||
Row_container_type * | rowContainer, | ||
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::cell_rep_type such that the rows can be accessed. Each new cell in the column is also inserted in a row using Row_access::insert_cell. If the dimension is stored, the face is assumed to be simplicial and its dimension to be nonZeroRowIndices length - 1
or 0
. Otherwise, the dimension should be specified with another constructor.
Container_type | Range of Matrix::cell_rep_type. Assumed to have a begin(), end() and size() method. |
Row_container_type | Either std::map if PersistenceMatrixOptions::has_removable_rows is true or std::vector<Row_type>. |
columnIndex | MatIdx column index that should be specified to the cells. |
nonZeroRowIndices | Range of Matrix::cell_rep_type representing all rows with non zero values. |
rowContainer | Pointer to the row container that will be forwarded to Row_access at construction. |
colSettings | Pointer to an existing setting structure. The structure should contain all the necessary classes specific to the column type, such as custom allocators. The specificities are this way hidden behind a commun interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | const Container_type & | nonZeroChainRowIndices, |
dimension_type | dimension, | ||
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::cell_rep_type and stores the given dimension if Column_dimension_option is not a dummy.
Container_type | Range of Matrix::cell_rep_type. Assumed to have a begin(), end() and size() method. |
nonZeroChainRowIndices | Range of Matrix::cell_rep_type representing all rows with non zero values. |
dimension | Dimension of the column. Is ignored if the dimension is not stored. |
colSettings | Pointer to an existing setting structure. The structure should contain all the necessary classes specific to the column type, such as custom allocators. The specificities are this way hidden behind a commun interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | index | columnIndex, |
const Container_type & | nonZeroChainRowIndices, | ||
dimension_type | dimension, | ||
Row_container_type * | rowContainer, | ||
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::cell_rep_type such that the rows can be accessed. Each new cell in the column is also inserted in a row using Row_access::insert_cell. Stores the given dimension if Column_dimension_option is not a dummy.
Container_type | Range of Matrix::cell_rep_type. Assumed to have a begin(), end() and size() method. |
Row_container_type | Either std::map if PersistenceMatrixOptions::has_removable_rows is true or std::vector<Row_type>. |
columnIndex | MatIdx column index that should be specified to the cells. |
nonZeroRowIndices | Range of Matrix::cell_rep_type representing all rows with non zero values. |
dimension | Dimension of the column. Is ignored if the dimension is not stored. |
rowContainer | Pointer to the row container that will be forwarded to Row_access at construction. |
colSettings | Pointer to an existing setting structure. The structure should contain all the necessary classes specific to the column type, such as custom allocators. The specificities are this way hidden behind a commun interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | const PersistenceMatrixColumn & | column, |
Column_settings * | colSettings = nullptr |
||
) |
Copy constructor. If operators
or cellConstructor
is not a null pointer, its value is kept instead of the one in the copied column.
column | Column to copy. |
colSettings | Pointer to a setting structure or nullptr . The structure should contain all the necessary classes specific to the column type, such as custom allocators. The specificities are this way hidden behind a commun interface for all column types. If colSettings is not specified or is equal to nullptr , the structure stored in column is used instead. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | const PersistenceMatrixColumn & | column, |
index | columnIndex, | ||
Row_container_type * | rowContainer, | ||
Column_settings * | colSettings = nullptr |
||
) |
Copy constructor with row access. If operators
or cellConstructor
is not a null pointer, its value is kept instead of the one in the copied column.
Row_container_type | Either std::map if PersistenceMatrixOptions::has_removable_rows is true or std::vector<Row_type>. |
column | Column to copy. |
columnIndex | MatIdx column index of the new column once copied. |
rowContainer | Pointer to the row container that will be forwarded to Row_access. |
colSettings | Pointer to a setting structure or nullptr . The structure should contain all the necessary classes specific to the column type, such as custom allocators. The specificities are this way hidden behind a commun interface for all column types. If colSettings is not specified or is equal to nullptr , the structure stored in column is used instead. |
|
noexcept |
Move constructor.
column | Column to move. |
|
noexcept |
Returns a begin Cell const iterator to iterate over all cells contained in the underlying container.
|
noexcept |
Returns a begin Cell iterator to iterate over all cells contained in the underlying container.
void Gudhi::persistence_matrix::PersistenceMatrixColumn::clear | ( | ) |
Zeros/empties the column.
Only useful for base and boundary matrices. Used in Matrix::zero_column and in the reduction algorithm for the persistence barcode.
void Gudhi::persistence_matrix::PersistenceMatrixColumn::clear | ( | id_index | rowIndex | ) |
Zeros the cell at given row index.
Only useful for base and boundary matrices. Used in Matrix::zero_cell and during vine swaps.
rowIndex | Row index of the cell to zero. |
|
noexcept |
Returns a end Cell const iterator, iterating over all cells contained in the underlying container.
|
noexcept |
Returns a end Cell iterator, iterating over all cells contained in the underlying container.
std::vector<Field_element_type> Gudhi::persistence_matrix::PersistenceMatrixColumn::get_content | ( | int | columnLength = -1 | ) | const |
Returns the values of the column, zero values included.
columnLength | Number of rows to be returned. If -1, the number of rows is fixed at the biggest row index with non zero value. Default value: -1. |
id_index Gudhi::persistence_matrix::PersistenceMatrixColumn::get_pivot | ( | ) |
Returns the row index of the pivot. If the column does not have a pivot, returns -1.
Only useful for boundary and chain matrices.
Field_element_type Gudhi::persistence_matrix::PersistenceMatrixColumn::get_pivot_value | ( | ) |
Returns the value of the pivot. If the column does not have a pivot, returns 0.
Has to have value 1 if \( Z_2 \) coefficients are used.
Only useful for boundary and chain matrices.
bool Gudhi::persistence_matrix::PersistenceMatrixColumn::is_empty | ( | ) |
Indicates if the column is empty or has only zero values.
bool Gudhi::persistence_matrix::PersistenceMatrixColumn::is_non_zero | ( | id_index | rowIndex | ) | const |
Indicates if the cell at given row index has value zero.
rowIndex | Row index to look at. |
PersistenceMatrixColumn& Gudhi::persistence_matrix::PersistenceMatrixColumn::multiply_source_and_add | ( | const Cell_range & | column, |
const Field_element_type & | val | ||
) |
this = this + column * val
Cell_range | Cell range with begin() and end() method. Has to be ordered by row index if not specified otherwise. |
column | Cell range. Only the stored row index and the stored element value (if PersistenceMatrixOptions::is_z2 is false) are token into account for this method. Even if PersistenceMatrixOptions::has_row_access is true, the column index does not need to be correct. |
val | Value to multiply. |
PersistenceMatrixColumn& Gudhi::persistence_matrix::PersistenceMatrixColumn::multiply_target_and_add | ( | const Field_element_type & | val, |
const Cell_range & | column | ||
) |
this = val * this + column
Cell_range | Cell range with begin() and end() method. Has to be ordered by row index if not specified otherwise. |
val | Value to multiply. |
column | Cell range. Only the stored row index and the stored element value (if PersistenceMatrixOptions::is_z2 is false) are token into account for this method. Even if PersistenceMatrixOptions::has_row_access is true, the column index does not need to be correct. |
PersistenceMatrixColumn& Gudhi::persistence_matrix::PersistenceMatrixColumn::operator*= | ( | const Field_element_type & | val | ) |
Multiplies all values in the column with the given value.
val | Value to multiply. |
PersistenceMatrixColumn& Gudhi::persistence_matrix::PersistenceMatrixColumn::operator+= | ( | const Cell_range & | column | ) |
Adds the given Cell range onto the column.
Cell_range | Cell range with begin() and end() method. Has to be ordered by row index if not specified otherwise. |
column | Cell range. Only the stored row index and the stored element value (if PersistenceMatrixOptions::is_z2 is false) are token into account for this method. Even if PersistenceMatrixOptions::has_row_access is true, the column index does not need to be correct. |
PersistenceMatrixColumn& Gudhi::persistence_matrix::PersistenceMatrixColumn::operator+= | ( | PersistenceMatrixColumn & | column | ) |
Adds the given column onto this column.
column | Column to add. |
|
noexcept |
Returns a begin Cell const reverse iterator to iterate over all cells contained in the underlying container.
|
noexcept |
Returns a begin Cell reverse iterator to iterate over all cells contained in the underlying container.
|
noexcept |
Returns a end Cell const reverse iterator, iterating over all cells contained in the underlying container.
|
noexcept |
Returns a end Cell reverse iterator, iterating over all cells contained in the underlying container.
void Gudhi::persistence_matrix::PersistenceMatrixColumn::reorder | ( | const Map_type & | valueMap, |
[[maybe_unused] ] index | columnIndex = -1 |
||
) |
Reorders the column with the given map of row indices. Also changes the column index stored in the cells if row access is enabled and columnIndex
is not -1.
Only useful for base and boundary matrices using lazy swaps.
Map_type | Map with an at() method. |
valueMap | Map such that valueMap.at(i) indicates the new row index of the cell at current row index i . |
columnIndex | New MatIdx column index of the column. If -1, the index does not change. Ignored if the row access is not enabled. Default value: -1. |
std::size_t Gudhi::persistence_matrix::PersistenceMatrixColumn::size | ( | ) | const |
Returns the size of the underlying container.
|
friend |
"Strictly smaller than" comparator. Usually a lexicographical order, but what matters is that the order is total. The order should apply on what is "supposed" to be contained in the columns, not what is actually stored in the underlying container. For exemple, the underlying container of Vector_column can contain cells which were erased explicitely by clear(index). Those cells should not be taken into account while comparing.
c1 | First column to compare. |
c2 | Second column to compare. |
|
friend |
Equality comparator. Equal in the sense that what is "supposed" to be contained in the columns is equal, not what is actually stored in the underlying container. For exemple, the underlying container of Vector_column can contain cells which were erased explicitely by clear(index). Those cells should not be taken into account while comparing.
c1 | First column to compare. |
c2 | Second column to compare. |