Concept of the column classes used by the Matrix class. The classes the columns inherit 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...
#include <concept/Persistence_matrix/PersistenceMatrixColumn.h>
Public Types | |
using | Master = unspecified |
using | Index = unspecified |
using | ID_index = unspecified |
using | Dimension = unspecified |
using | Field_element = unspecified |
using | Entry = unspecified |
using | Column_settings = unspecified |
using | iterator = unspecified |
using | const_iterator = unspecified |
using | reverse_iterator = unspecified |
using | const_reverse_iterator = unspecified |
![]() | |
using | Index = typename Master_matrix::Index |
using | ID_index = typename Master_matrix::ID_index |
using | Matrix_entry = typename Master_matrix::Matrix_entry |
using | Row_container = typename Master_matrix::Row_container |
![]() | |
using | Dimension = typename Master_matrix::Dimension |
![]() | |
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 entryConstructor 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 = typename Master_matrix::Boundary> | |
PersistenceMatrixColumn (const Container &nonZeroRowIndices, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::Entry_representative. If the dimension is stored, the cell 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 = typename Master_matrix::Boundary, class Row_container > | |
PersistenceMatrixColumn (Index columnIndex, const Container &nonZeroRowIndices, Row_container *rowContainer, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::Entry_representative such that the rows can be accessed. Each new entry in the column is also inserted in a row using Row_access::insert_entry. If the dimension is stored, the cell 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 = typename Master_matrix::Boundary> | |
PersistenceMatrixColumn (const Container &nonZeroChainRowIndices, Dimension dimension, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::Entry_representative and stores the given dimension if Column_dimension_option is not a dummy. More... | |
template<class Container = typename Master_matrix::Boundary, class Row_container > | |
PersistenceMatrixColumn (Index columnIndex, const Container &nonZeroChainRowIndices, Dimension dimension, Row_container *rowContainer, Column_settings *colSettings) | |
Constructs a column from the given range of Matrix::Entry_representative such that the rows can be accessed. Each new entry in the column is also inserted in a row using Row_access::insert_entry. 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 entryConstructor is not a null pointer, its value is kept instead of the one in the copied column. More... | |
template<class Row_container > | |
PersistenceMatrixColumn (const PersistenceMatrixColumn &column, Index columnIndex, Row_container *rowContainer, Column_settings *colSettings=nullptr) | |
Copy constructor with row access. If operators or entryConstructor stored in colSettings 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 > | 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 entry 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 Row_index_map > | |
void | reorder (const Row_index_map &valueMap, Index columnIndex=Matrix::get_null_value< Index >()) |
Reorders the column with the given map of row indices. Also changes the column index stored in the entries if row access is enabled and columnIndex is not the null index. More... | |
void | clear () |
Zeros/empties the column. More... | |
void | clear (ID_index rowIndex) |
Zeros the entry 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 null index. More... | |
Field_element | 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 Entry iterator to iterate over all entries contained in the underlying container. More... | |
const_iterator | begin () const noexcept |
Returns a begin Entry const iterator to iterate over all entries contained in the underlying container. More... | |
iterator | end () noexcept |
Returns an end Entry iterator, iterating over all entries contained in the underlying container. More... | |
const_iterator | end () const noexcept |
Returns an end Entry const iterator, iterating over all entries contained in the underlying container. More... | |
reverse_iterator | rbegin () noexcept |
Returns a begin Entry reverse iterator to iterate over all entries contained in the underlying container. More... | |
const_reverse_iterator | rbegin () const noexcept |
Returns a begin Entry const reverse iterator to iterate over all entries contained in the underlying container. More... | |
reverse_iterator | rend () noexcept |
Returns an end Entry reverse iterator, iterating over all entries contained in the underlying container. More... | |
const_reverse_iterator | rend () const noexcept |
Returns an end Entry const reverse iterator, iterating over all entries contained in the underlying container. More... | |
template<class Entry_range > | |
PersistenceMatrixColumn & | operator+= (const Entry_range &column) |
Adds the given Entry range onto the column. More... | |
PersistenceMatrixColumn & | operator+= (PersistenceMatrixColumn &column) |
Adds the given column onto this column. More... | |
PersistenceMatrixColumn & | operator*= (const Field_element &val) |
Multiplies all values in the column with the given value. More... | |
template<class Entry_range > | |
PersistenceMatrixColumn & | multiply_target_and_add (const Field_element &val, const Entry_range &column) |
this = val * this + column More... | |
template<class Entry_range > | |
PersistenceMatrixColumn & | multiply_source_and_add (const Entry_range &column, const Field_element &val) |
this = this + column * val More... | |
void | push_back (const Entry &entry) |
Adds a copy of the given entry at the end of the column. It is therefore assumed that the row index of the entry is higher than the current pivot of the column. Not available for chain matrices and is only needed for RU matrices. More... | |
PersistenceMatrixColumn & | operator= (const PersistenceMatrixColumn &other) |
Assign operator. Should be disabled when row access is enabled. | |
![]() | |
Row_access () | |
Default constructor. Sets the column index to null index and the row container to nullptr. Should only be used by dummy columns. | |
Row_access (Index columnIndex, Row_container *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_entry (ID_index rowIndex, Matrix_entry *entry) |
Inserts the given entry at the given row index. More... | |
void | unlink (Matrix_entry *entry) |
Removes the given entry from its row. More... | |
void | update_entry (const Matrix_entry &entry) |
If PersistenceMatrixOptions::has_intrusive_rows is false, updates the copy of the entry in its row. Otherwise does nothing. More... | |
Index | get_column_index () const |
Returns the MatIdx column index. More... | |
![]() | |
Column_dimension_holder () | |
Default constructor. Sets the dimension to 0 for boundary matrices and to null index for chain matrices. | |
Column_dimension_holder (Dimension 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 | get_dimension () const |
Returns the dimension of the column. More... | |
Column_dimension_holder & | operator= (const Column_dimension_holder &other) |
Assign operator. | |
![]() | |
Chain_column_extra_properties () | |
Default constructor. Sets the pivot and pair to null index, which means "not existing". | |
Chain_column_extra_properties (ID_index pivot) | |
Constructor setting the pivot at the given value and the pair to null index (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 null index 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 () |
Un-pairs 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 example, the underlying container of Vector_column can contain entries which were erased explicitly by clear(Index). Those entries 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 example, the underlying container of Vector_column can contain entries which were erased explicitly by clear(Index). Those entries 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 inherit 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::Column_settings = unspecified |
Structure giving access to external classes eventually necessary, like an entry 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 = unspecified |
Type for dimension value.
using Gudhi::persistence_matrix::PersistenceMatrixColumn::Entry = unspecified |
using Gudhi::persistence_matrix::PersistenceMatrixColumn::Field_element = 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 entryConstructor
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 common interface for all column types. If colSettings is not specified or is equal to nullptr , the column should still be constructable even though not necessarily "usable". |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | const Container & | nonZeroRowIndices, |
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::Entry_representative. If the dimension is stored, the cell 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 | Range of Matrix::Entry_representative. Assumed to have a begin(), end() and size() method. |
nonZeroRowIndices | Range of Matrix::Entry_representative 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 common interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | Index | columnIndex, |
const Container & | nonZeroRowIndices, | ||
Row_container * | rowContainer, | ||
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::Entry_representative such that the rows can be accessed. Each new entry in the column is also inserted in a row using Row_access::insert_entry. If the dimension is stored, the cell 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 | Range of Matrix::Entry_representative. Assumed to have a begin(), end() and size() method. |
Row_container | Either std::map if PersistenceMatrixOptions::has_removable_rows is true or std::vector<Row>. |
columnIndex | MatIdx column index that should be specified to the entries. |
nonZeroRowIndices | Range of Matrix::Entry_representative 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 common interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | const Container & | nonZeroChainRowIndices, |
Dimension | dimension, | ||
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::Entry_representative and stores the given dimension if Column_dimension_option is not a dummy.
Container | Range of Matrix::Entry_representative. Assumed to have a begin(), end() and size() method. |
nonZeroChainRowIndices | Range of Matrix::Entry_representative 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 common interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | Index | columnIndex, |
const Container & | nonZeroChainRowIndices, | ||
Dimension | dimension, | ||
Row_container * | rowContainer, | ||
Column_settings * | colSettings | ||
) |
Constructs a column from the given range of Matrix::Entry_representative such that the rows can be accessed. Each new entry in the column is also inserted in a row using Row_access::insert_entry. Stores the given dimension if Column_dimension_option is not a dummy.
Container | Range of Matrix::Entry_representative. Assumed to have a begin(), end() and size() method. |
Row_container | Either std::map if PersistenceMatrixOptions::has_removable_rows is true or std::vector<Row>. |
columnIndex | MatIdx column index that should be specified to the entries. |
nonZeroChainRowIndices | Range of Matrix::Entry_representative 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 common interface for all column types. |
Gudhi::persistence_matrix::PersistenceMatrixColumn::PersistenceMatrixColumn | ( | const PersistenceMatrixColumn & | column, |
Column_settings * | colSettings = nullptr |
||
) |
Copy constructor. If operators
or entryConstructor
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 common 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 * | rowContainer, | ||
Column_settings * | colSettings = nullptr |
||
) |
Copy constructor with row access. If operators
or entryConstructor
stored in colSettings
is not a null pointer, its value is kept instead of the one in the copied column.
Row_container | Either std::map if PersistenceMatrixOptions::has_removable_rows is true or std::vector<Row>. |
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 common 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 Entry const iterator to iterate over all entries contained in the underlying container.
|
noexcept |
Returns a begin Entry iterator to iterate over all entries 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 entry at given row index.
Only useful for base and boundary matrices. Used in Matrix::zero_entry and during vine swaps.
rowIndex | Row index of the entry to zero. |
|
noexcept |
Returns an end Entry const iterator, iterating over all entries contained in the underlying container.
|
noexcept |
Returns an end Entry iterator, iterating over all entries contained in the underlying container.
std::vector< Field_element > 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 null index.
Only useful for boundary and chain matrices.
Field_element 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 entry at given row index has value zero.
rowIndex | Row index to look at. |
PersistenceMatrixColumn & Gudhi::persistence_matrix::PersistenceMatrixColumn::multiply_source_and_add | ( | const Entry_range & | column, |
const Field_element & | val | ||
) |
this = this + column * val
Entry_range | Entry range with begin() and end() method. Has to be ordered by row index if not specified otherwise. |
column | Entry 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 & | val, |
const Entry_range & | column | ||
) |
this = val * this + column
Entry_range | Entry range with begin() and end() method. Has to be ordered by row index if not specified otherwise. |
val | Value to multiply. |
column | Entry 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 & | val | ) |
Multiplies all values in the column with the given value.
val | Value to multiply. |
PersistenceMatrixColumn & Gudhi::persistence_matrix::PersistenceMatrixColumn::operator+= | ( | const Entry_range & | column | ) |
Adds the given Entry range onto the column.
Entry_range | Entry range with begin() and end() method. Has to be ordered by row index if not specified otherwise. |
column | Entry 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. |
void Gudhi::persistence_matrix::PersistenceMatrixColumn::push_back | ( | const Entry & | entry | ) |
Adds a copy of the given entry at the end of the column. It is therefore assumed that the row index of the entry is higher than the current pivot of the column. Not available for chain matrices and is only needed for RU matrices.
entry | Entry to push back. |
|
noexcept |
Returns a begin Entry const reverse iterator to iterate over all entries contained in the underlying container.
|
noexcept |
Returns a begin Entry reverse iterator to iterate over all entries contained in the underlying container.
|
noexcept |
Returns an end Entry const reverse iterator, iterating over all entries contained in the underlying container.
|
noexcept |
Returns an end Entry reverse iterator, iterating over all entries contained in the underlying container.
void Gudhi::persistence_matrix::PersistenceMatrixColumn::reorder | ( | const Row_index_map & | valueMap, |
Index | columnIndex = Matrix::get_null_value< Index >() |
||
) |
Reorders the column with the given map of row indices. Also changes the column index stored in the entries if row access is enabled and columnIndex
is not the null index.
Only useful for base and boundary matrices using lazy swaps.
Row_index_map | Map with an at() method. |
valueMap | Map such that valueMap.at(i) indicates the new row index of the entry at current row index i . |
columnIndex | New MatIdx column index of the column. If null index, the index does not change. Ignored if the row access is not enabled. Default value: null index. |
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 example, the underlying container of Vector_column can contain entries which were erased explicitly by clear(Index). Those entries 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 example, the underlying container of Vector_column can contain entries which were erased explicitly by clear(Index). Those entries should not be taken into account while comparing.
c1 | First column to compare. |
c2 | Second column to compare. |