Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type > Class Template Reference

Overlay for non-basic matrices replacing all input and output MatIdx indices of the original methods with IDIdx indices. More...

Public Types

using index = typename Master_matrix_type::index
 
using id_index = typename Master_matrix_type::id_index
 
using dimension_type = typename Master_matrix_type::dimension_type
 
using Field_operators = typename Master_matrix_type::Field_operators
 Field operators class. Necessary only if PersistenceMatrixOptions::is_z2 is false.
 
using Field_element_type = typename Master_matrix_type::element_type
 
using boundary_type = typename Master_matrix_type::boundary_type
 
using Column_type = typename Master_matrix_type::Column_type
 
using Row_type = typename Master_matrix_type::Row_type
 
using bar_type = typename Master_matrix_type::Bar
 
using barcode_type = typename Master_matrix_type::barcode_type
 
using cycle_type = typename Master_matrix_type::cycle_type
 
using Cell_constructor = typename Master_matrix_type::Cell_constructor
 
using Column_settings = typename Master_matrix_type::Column_settings
 

Public Member Functions

 Id_to_index_overlay (Column_settings *colSettings)
 Constructs an empty matrix. More...
 
template<class Boundary_type = boundary_type>
 Id_to_index_overlay (const std::vector< Boundary_type > &orderedBoundaries, Column_settings *colSettings)
 Constructs a new matrix from the given ranges of Matrix::cell_rep_type. Each range corresponds to a column (the order of the ranges are preserved). The content of the ranges is assumed to be sorted by increasing IDs. The IDs of the simplices are also assumed to be consecutifs, ordered by filtration value, starting with 0. More...
 
 Id_to_index_overlay (unsigned int numberOfColumns, Column_settings *colSettings)
 Constructs a new empty matrix and reserves space for the given number of columns. More...
 
template<typename BirthComparatorFunction , typename DeathComparatorFunction >
 Id_to_index_overlay (Column_settings *colSettings, const BirthComparatorFunction &birthComparator, const DeathComparatorFunction &deathComparator)
 Only available for chain matrices. Constructs an empty matrix and stores the given comparators. More...
 
template<typename BirthComparatorFunction , typename DeathComparatorFunction , class Boundary_type >
 Id_to_index_overlay (const std::vector< Boundary_type > &orderedBoundaries, Column_settings *colSettings, const BirthComparatorFunction &birthComparator, const DeathComparatorFunction &deathComparator)
 Only available for chain matrices. Constructs a new matrix from the given ranges of Matrix::cell_rep_type. Each range corresponds to a column (the order of the ranges are preserved). The content of the ranges is assumed to be sorted by increasing IDs. The IDs of the simplices are also assumed to be consecutifs, ordered by filtration value, starting with 0. More...
 
template<typename BirthComparatorFunction , typename DeathComparatorFunction >
 Id_to_index_overlay (unsigned int numberOfColumns, Column_settings *colSettings, const BirthComparatorFunction &birthComparator, const DeathComparatorFunction &deathComparator)
 Only available for chain matrices. Constructs a new empty matrix and reserves space for the given number of columns. More...
 
 Id_to_index_overlay (const Id_to_index_overlay &matrixToCopy, 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 matrix. More...
 
 Id_to_index_overlay (Id_to_index_overlay &&other) noexcept
 Move constructor. More...
 
 ~Id_to_index_overlay ()
 Destructor.
 
template<class Boundary_type = boundary_type>
void insert_boundary (const Boundary_type &boundary, dimension_type dim=-1)
 Inserts at the end of the matrix a new ordered column corresponding to the given boundary. This means that it is assumed that this method is called on boundaries in the order of the filtration. It also assumes that the faces in the given boundary are identified by their relative position in the filtration, starting at 0. If it is not the case, use the other insert_boundary instead by indicating the face ID used in the boundaries when the face is inserted. More...
 
template<class Boundary_type = boundary_type>
void insert_boundary (id_index faceIndex, const Boundary_type &boundary, dimension_type dim=-1)
 It does the same as the other version, but allows the boundary faces to be identified without restrictions except that all IDs have to be strictly increasing in the order of filtration. Note that you should avoid then to use the other insertion method to avoid overwriting IDs. More...
 
Column_typeget_column (id_index faceID)
 Returns the column at the given IDIdx index. For RU matrices, the returned column is from \( R \). The type of the column depends on the choosen options, see PersistenceMatrixOptions::column_type. More...
 
Row_typeget_row (id_index rowIndex)
 Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row index. For RU matrices, the returned row is from \( R \). The type of the row depends on the choosen options, see PersistenceMatrixOptions::has_intrusive_rows. More...
 
void erase_empty_row (id_index rowIndex)
 The effect varies depending on the matrices and the options: More...
 
void remove_maximal_face (id_index faceID)
 Only available for RU and chain matrices and if PersistenceMatrixOptions::has_removable_columns and PersistenceMatrixOptions::has_vine_update are true. For chain matrices, PersistenceMatrixOptions::has_map_column_container and PersistenceMatrixOptions::has_column_pairings also need to be true. Assumes that the face is maximal in the current complex and removes it such that the matrix remains consistent (i.e., RU is still an upper triangular decomposition of the boundary matrix and chain is still a compatible bases of the chain complex in the sense of [41]). The maximality of the face is not verified. Also updates the barcode if it was computed. More...
 
void remove_maximal_face (id_index faceID, const std::vector< id_index > &columnsToSwap)
 Only available for chain matrices and if PersistenceMatrixOptions::has_removable_columns, PersistenceMatrixOptions::has_vine_update and PersistenceMatrixOptions::has_map_column_container are true. Assumes that the face is maximal in the current complex and removes it such that the matrix remains consistent (i.e., it is still a compatible bases of the chain complex in the sense of [41]). The maximality of the face is not verified. Also updates the barcode if it was computed. More...
 
void remove_last ()
 Only available if PersistenceMatrixOptions::has_removable_columns is true. Additionnaly, if the matrix is a chain matrix, either PersistenceMatrixOptions::has_map_column_container has to be true or PersistenceMatrixOptions::has_vine_update has to be false. Removes the last face in the filtration from the matrix and updates the barcode if it is stored. More...
 
dimension_type get_max_dimension () const
 Returns the maximal dimension of a face stored in the matrix. Only available if PersistenceMatrixOptions::has_matrix_maximal_dimension_access is true. More...
 
index get_number_of_columns () const
 Returns the current number of columns in the matrix. More...
 
dimension_type get_column_dimension (id_index faceID) const
 Returns the dimension of the given face. Only available for non-basic matrices. More...
 
void add_to (id_index sourceFaceID, id_index targetFaceID)
 Adds column corresponding to sourceFaceID onto the column corresponding to targetFaceID. More...
 
void multiply_target_and_add_to (id_index sourceFaceID, const Field_element_type &coefficient, id_index targetFaceID)
 Multiplies the target column with the coefficiant and then adds the source column to it. That is: targetColumn = (targetColumn * coefficient) + sourceColumn. More...
 
void multiply_source_and_add_to (const Field_element_type &coefficient, id_index sourceFaceID, id_index targetFaceID)
 Multiplies the source column with the coefficiant before adding it to the target column. That is: targetColumn += (coefficient * sourceColumn). The source column will not be modified. More...
 
void zero_cell (id_index faceID, id_index rowIndex)
 Zeroes the cell at the given coordinates. Not available for chain matrices. In general, should be used with care to not destroy the validity of the persistence related properties of the matrix. More...
 
void zero_column (id_index faceID)
 Zeroes the column at the given index. Not available for chain matrices. In general, should be used with care to not destroy the validity of the persistence related properties of the matrix. More...
 
bool is_zero_cell (id_index faceID, id_index rowIndex) const
 Indicates if the cell at given coordinates has value zero. More...
 
bool is_zero_column (id_index faceID)
 Indicates if the column at given index has value zero. More...
 
id_index get_column_with_pivot (id_index faceIndex) const
 Returns the IDIdx index of the column which has the given row index as pivot. Assumes that the pivot exists. For RU matrices, the column is returned from \( R \). More...
 
id_index get_pivot (id_index faceID)
 Returns the row index of the pivot of the given column. More...
 
void reset (Column_settings *colSettings)
 Resets the matrix to an empty matrix. More...
 
Id_to_index_overlayoperator= (const Id_to_index_overlay &other)
 Assign operator.
 
const barcode_typeget_current_barcode ()
 Returns the current barcode of the matrix. Available only if PersistenceMatrixOptions::has_column_pairings is true. More...
 
void swap_columns (id_index faceID1, id_index faceID2)
 Only available for simple boundary matrices (only storing \( R \)) and if PersistenceMatrixOptions::has_column_and_row_swaps is true. Swaps the two given columns. Note that it really just swaps two columns and do not updates anything else, nor performs additions to maintain some properties on the matrix. More...
 
void swap_rows (index rowIndex1, index rowIndex2)
 Only available for simple boundary matrices (only storing R) and if PersistenceMatrixOptions::has_column_and_row_swaps is true. Swaps the two given rows. Note that it really just swaps two rows and do not updates anything else, nor performs additions to maintain some properties on the matrix. More...
 
id_index vine_swap_with_z_eq_1_case (id_index faceID1, id_index faceID2)
 Only available if PersistenceMatrixOptions::has_vine_update is true. Does the same than vine_swap, but assumes that the swap is non trivial and therefore skips a part of the case study. More...
 
id_index vine_swap (id_index faceID1, id_index faceID2)
 Only available if PersistenceMatrixOptions::has_vine_update is true. Does a vine swap between two faces which are consecutives in the filtration. Roughly, if \( F \) is the current filtration represented by the matrix, the method modifies the matrix such that the new state corresponds to a valid state for the filtration \( F' \) equal to \( F \) but with the two given faces at swapped positions. Of course, the two faces should not have a face/coface relation which each other ; \( F' \) has to be a valid filtration. See [21] for more information about vine and vineyards. More...
 
void update_representative_cycles ()
 Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true. Precomputes the representative cycles of the current state of the filtration represented by the matrix. It does not need to be called before get_representative_cycles is called for the first time, but needs to be called before calling get_representative_cycles again if the matrix was modified in between. Otherwise the old cycles will be returned.
 
const std::vector< cycle_type > & get_representative_cycles ()
 Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true. Returns all representative cycles of the current filtration. More...
 
const cycle_typeget_representative_cycle (const bar_type &bar)
 Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true. Returns the cycle representing the given bar. More...
 

Friends

void swap (Id_to_index_overlay &matrix1, Id_to_index_overlay &matrix2)
 Swap operator.
 

Detailed Description

template<class Matrix_type, class Master_matrix_type>
class Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >

Overlay for non-basic matrices replacing all input and output MatIdx indices of the original methods with IDIdx indices.

Template Parameters
Matrix_typeMatrix type taking the overlay.
Master_matrix_typeAn instanciation of Matrix from which all types and options are deduced.

Member Typedef Documentation

◆ bar_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::bar_type = typename Master_matrix_type::Bar

Bar type.

◆ barcode_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::barcode_type = typename Master_matrix_type::barcode_type

Barcode type.

◆ boundary_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::boundary_type = typename Master_matrix_type::boundary_type

Type of an input column.

◆ Cell_constructor

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Cell_constructor = typename Master_matrix_type::Cell_constructor

Factory of Cell classes.

◆ Column_settings

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Column_settings = typename Master_matrix_type::Column_settings

Structure giving access to the columns to necessary external classes.

◆ Column_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Column_type = typename Master_matrix_type::Column_type

Column type.

◆ cycle_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::cycle_type = typename Master_matrix_type::cycle_type

Cycle type.

◆ dimension_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::dimension_type = typename Master_matrix_type::dimension_type

Dimension value type.

◆ Field_element_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Field_element_type = typename Master_matrix_type::element_type

Type of an field element.

◆ id_index

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::id_index = typename Master_matrix_type::id_index

IDIdx index type.

◆ index

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::index = typename Master_matrix_type::index

MatIdx index type.

◆ Row_type

template<class Matrix_type , class Master_matrix_type >
using Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Row_type = typename Master_matrix_type::Row_type

Row type, only necessary with row access option.

Constructor & Destructor Documentation

◆ Id_to_index_overlay() [1/8]

template<class Matrix_type , class Master_matrix_type >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( Column_settings colSettings)
inline

Constructs an empty matrix.

Parameters
colSettingsPointer to an existing setting structure for the columns. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators.

◆ Id_to_index_overlay() [2/8]

template<class Matrix_type , class Master_matrix_type >
template<class Boundary_type >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( const std::vector< Boundary_type > &  orderedBoundaries,
Column_settings colSettings 
)
inline

Constructs a new matrix from the given ranges of Matrix::cell_rep_type. Each range corresponds to a column (the order of the ranges are preserved). The content of the ranges is assumed to be sorted by increasing IDs. The IDs of the simplices are also assumed to be consecutifs, ordered by filtration value, starting with 0.

Template Parameters
Boundary_typeRange type for Matrix::cell_rep_type ranges. Assumed to have a begin(), end() and size() method.
Parameters
orderedBoundariesRange of boundaries: orderedBoundaries is interpreted as a boundary matrix of a filtered simplicial complex, whose boundaries are ordered by filtration order. Therefore, orderedBoundaries[i] should store the boundary of the \( i^{th} \) simplex in the filtration, as an ordered list of indices of its facets (again those indices correspond to their respective position in the matrix). That is why the indices of the simplices are assumed to be consecutifs and starting with 0 (an empty boundary is interpreted as a vertex boundary and not as a non existing simplex). All dimensions up to the maximal dimension of interest have to be present. If only a higher dimension is of interest and not everything should be stored, then use the insert_boundary method instead (after creating the matrix with the Id_to_index_overlay(unsigned int, Column_settings*) constructor preferably).
colSettingsPointer to an existing setting structure for the columns. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators.

◆ Id_to_index_overlay() [3/8]

template<class Matrix_type , class Master_matrix_type >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( unsigned int  numberOfColumns,
Column_settings colSettings 
)
inline

Constructs a new empty matrix and reserves space for the given number of columns.

Parameters
numberOfColumnsNumber of columns to reserve space for.
colSettingsPointer to an existing setting structure for the columns. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators.

◆ Id_to_index_overlay() [4/8]

template<class Matrix_type , class Master_matrix_type >
template<typename BirthComparatorFunction , typename DeathComparatorFunction >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( Column_settings colSettings,
const BirthComparatorFunction &  birthComparator,
const DeathComparatorFunction &  deathComparator 
)
inline

Only available for chain matrices. Constructs an empty matrix and stores the given comparators.

Warning
If PersistenceMatrixOptions::has_vine_update is false, the comparators are not used. And if PersistenceMatrixOptions::has_vine_update is true, but PersistenceMatrixOptions::has_column_pairings is also true, the comparators are ignored and the current barcode is used to compare birth and deaths. Therefore it is useless to provide them in those cases.
Template Parameters
BirthComparatorFunctionType of the birth comparator: (pos_index, pos_index) -> bool
DeathComparatorFunctionType of the death comparator: (pos_index, pos_index) -> bool
Parameters
colSettingsPointer to an existing setting structure for the columns. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators.
birthComparatorMethod taking two PosIdx indices as input and returning true if and only if the birth associated to the first position is strictly less than birth associated to the second one with respect to some self defined order. It is used while swapping two unpaired or two negative columns.
deathComparatorMethod taking two PosIdx indices as input and returning true if and only if the death associated to the first position is strictly less than death associated to the second one with respect to some self defined order. It is used while swapping two positive but paired columns.

◆ Id_to_index_overlay() [5/8]

template<class Matrix_type , class Master_matrix_type >
template<typename BirthComparatorFunction , typename DeathComparatorFunction , class Boundary_type >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( const std::vector< Boundary_type > &  orderedBoundaries,
Column_settings colSettings,
const BirthComparatorFunction &  birthComparator,
const DeathComparatorFunction &  deathComparator 
)
inline

Only available for chain matrices. Constructs a new matrix from the given ranges of Matrix::cell_rep_type. Each range corresponds to a column (the order of the ranges are preserved). The content of the ranges is assumed to be sorted by increasing IDs. The IDs of the simplices are also assumed to be consecutifs, ordered by filtration value, starting with 0.

Warning
If PersistenceMatrixOptions::has_vine_update is false, the comparators are not used. And if PersistenceMatrixOptions::has_vine_update is true, but PersistenceMatrixOptions::has_column_pairings is also true, the comparators are ignored and the current barcode is used to compare birth and deaths. Therefore it is useless to provide them in those cases.
Template Parameters
BirthComparatorFunctionType of the birth comparator: (pos_index, pos_index) -> bool
DeathComparatorFunctionType of the death comparator: (pos_index, pos_index) -> bool
Boundary_typeRange type for Matrix::cell_rep_type ranges. Assumed to have a begin(), end() and size() method.
Parameters
orderedBoundariesRange of boundaries: orderedBoundaries is interpreted as a boundary matrix of a filtered simplicial complex, whose boundaries are ordered by filtration order. Therefore, orderedBoundaries[i] should store the boundary of the \( i^{th} \) simplex in the filtration, as an ordered list of indices of its facets (again those indices correspond to their respective position in the matrix). That is why the indices of the simplices are assumed to be consecutifs and starting with 0 (an empty boundary is interpreted as a vertex boundary and not as a non existing simplex). All dimensions up to the maximal dimension of interest have to be present. If only a higher dimension is of interest and not everything should be stored, then use the insert_boundary method instead (after creating the matrix with the Id_to_index_overlay(unsigned int, Column_settings*, const BirthComparatorFunction&, const DeathComparatorFunction&) constructor preferably).
colSettingsPointer to an existing setting structure for the columns. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators.
birthComparatorMethod taking two PosIdx indices as input and returning true if and only if the birth associated to the first position is strictly less than birth associated to the second one with respect to some self defined order. It is used while swapping two unpaired or two negative columns.
deathComparatorMethod taking two PosIdx indices as input and returning true if and only if the death associated to the first position is strictly less than death associated to the second one with respect to some self defined order. It is used while swapping two positive but paired columns.

◆ Id_to_index_overlay() [6/8]

template<class Matrix_type , class Master_matrix_type >
template<typename BirthComparatorFunction , typename DeathComparatorFunction >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( unsigned int  numberOfColumns,
Column_settings colSettings,
const BirthComparatorFunction &  birthComparator,
const DeathComparatorFunction &  deathComparator 
)
inline

Only available for chain matrices. Constructs a new empty matrix and reserves space for the given number of columns.

Warning
If PersistenceMatrixOptions::has_vine_update is false, the comparators are not used. And if PersistenceMatrixOptions::has_vine_update is true, but PersistenceMatrixOptions::has_column_pairings is also true, the comparators are ignored and the current barcode is used to compare birth and deaths. Therefore it is useless to provide them in those cases.
Template Parameters
BirthComparatorFunctionType of the birth comparator: (pos_index, pos_index) -> bool
DeathComparatorFunctionType of the death comparator: (pos_index, pos_index) -> bool
Parameters
numberOfColumnsNumber of columns to reserve space for.
colSettingsPointer to an existing setting structure for the columns. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators.
birthComparatorMethod taking two PosIdx indices as input and returning true if and only if the birth associated to the first position is strictly less than birth associated to the second one with respect to some self defined order. It is used while swapping two unpaired or two negative columns.
deathComparatorMethod taking two PosIdx indices as input and returning true if and only if the death associated to the first position is strictly less than death associated to the second one with respect to some self defined order. It is used while swapping two positive but paired columns.

◆ Id_to_index_overlay() [7/8]

template<class Matrix_type , class Master_matrix_type >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( const Id_to_index_overlay< Matrix_type, Master_matrix_type > &  matrixToCopy,
Column_settings colSettings = nullptr 
)
inline

Copy constructor. If operators or cellConstructor is not a null pointer, its value is kept instead of the one in the copied matrix.

Parameters
matrixToCopyMatrix to copy.
colSettingsEither a pointer to an existing setting structure for the columns or a null pointer. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators. If null pointer, the pointer stored in matrixToCopy is used instead.

◆ Id_to_index_overlay() [8/8]

template<class Matrix_type , class Master_matrix_type >
Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::Id_to_index_overlay ( Id_to_index_overlay< Matrix_type, Master_matrix_type > &&  other)
inlinenoexcept

Move constructor.

Parameters
otherMatrix to move.

Member Function Documentation

◆ add_to()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::add_to ( id_index  sourceFaceID,
id_index  targetFaceID 
)
inline

Adds column corresponding to sourceFaceID onto the column corresponding to targetFaceID.

Warning
They will be no verification to ensure that the addition makes sense for the validity of the matrix. For example, a right-to-left addition could corrupt the computation of the barcode if done blindly. So should be used with care.
Parameters
sourceFaceIDIDIdx index of the source column.
targetFaceIDIDIdx index of the target column.

◆ erase_empty_row()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::erase_empty_row ( id_index  rowIndex)
inline

The effect varies depending on the matrices and the options:

Warning
The removed rows are always assumed to be empty. If it is not the case, the deleted row cells are not removed from their columns. And in the case of intrusive rows, this will generate a segmentation fault when the column cells are destroyed later. The row access is just meant as a "read only" access to the rows and the erase_empty_row method just as a way to specify that a row is empty and can therefore be removed from dictionnaries. This allows to avoid testing the emptiness of a row at each column cell removal, what can be quite frequent.
Parameters
rowIndexRow index of the empty row to remove.

◆ get_column()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::Column_type & Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_column ( id_index  faceID)
inline

Returns the column at the given IDIdx index. For RU matrices, the returned column is from \( R \). The type of the column depends on the choosen options, see PersistenceMatrixOptions::column_type.

Parameters
faceIDIDIdx index of the column to return.
Returns
Reference to the column.

◆ get_column_dimension()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::dimension_type Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_column_dimension ( id_index  faceID) const
inline

Returns the dimension of the given face. Only available for non-basic matrices.

Parameters
faceIDIDIdx index of the face.
Returns
Dimension of the face.

◆ get_column_with_pivot()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::id_index Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_column_with_pivot ( id_index  faceIndex) const
inline

Returns the IDIdx index of the column which has the given row index as pivot. Assumes that the pivot exists. For RU matrices, the column is returned from \( R \).

Recall that the row indices for chain matrices correspond to the IDIdx indices and that the row indices for a RU matrix correspond to the updated IDIdx indices which got potentially swapped by a vine swap.

Parameters
faceIndexRow index of the pivot.
Returns
IDIdx index of the column with the given pivot.

◆ get_current_barcode()

template<class Matrix_type , class Master_matrix_type >
const Id_to_index_overlay< Matrix_type, Master_matrix_type >::barcode_type & Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_current_barcode
inline

Returns the current barcode of the matrix. Available only if PersistenceMatrixOptions::has_column_pairings is true.

Recall that we assume that the boundaries were inserted in the order of filtration for the barcode to be valid.

Warning
For simple boundary matrices (only storing \( R \)), we assume that get_current_barcode is only called once, when the matrix is completed.
Returns
A reference to the barcode. The barcode is a vector of Matrix::Bar. A bar stores three informations: the PosIdx birth index, the PosIdx death index and the dimension of the bar.

◆ get_max_dimension()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::dimension_type Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_max_dimension
inline

Returns the maximal dimension of a face stored in the matrix. Only available if PersistenceMatrixOptions::has_matrix_maximal_dimension_access is true.

Returns
The maximal dimension.

◆ get_number_of_columns()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::index Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_number_of_columns
inline

Returns the current number of columns in the matrix.

Returns
The number of columns.

◆ get_pivot()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::id_index Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_pivot ( id_index  faceID)
inline

Returns the row index of the pivot of the given column.

Parameters
faceIDIDIdx index of the face corresponding to the column.
Returns
The row index of the pivot.

◆ get_representative_cycle()

template<class Matrix_type , class Master_matrix_type >
const Id_to_index_overlay< Matrix_type, Master_matrix_type >::cycle_type & Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_representative_cycle ( const bar_type bar)
inline

Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true. Returns the cycle representing the given bar.

Parameters
barA bar from the current barcode.
Returns
A const reference to the cycle representing bar.

◆ get_representative_cycles()

template<class Matrix_type , class Master_matrix_type >
const std::vector< typename Id_to_index_overlay< Matrix_type, Master_matrix_type >::cycle_type > & Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_representative_cycles
inline

Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true. Returns all representative cycles of the current filtration.

Returns
A const reference to the vector of representative cycles.

◆ get_row()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::Row_type & Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::get_row ( id_index  rowIndex)
inline

Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row index. For RU matrices, the returned row is from \( R \). The type of the row depends on the choosen options, see PersistenceMatrixOptions::has_intrusive_rows.

Warning
The get_column_index method of the row cells returns the original PosIdx indices (before any swaps) for boundary matrices and MatIdx indices for chain matrices.
Parameters
rowIndexRow index of the row to return: IDIdx for chain matrices or updated IDIdx for boundary matrices if swaps occured.
Returns
Reference to the row.

◆ insert_boundary() [1/2]

template<class Matrix_type , class Master_matrix_type >
template<class Boundary_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::insert_boundary ( const Boundary_type &  boundary,
dimension_type  dim = -1 
)
inline

Inserts at the end of the matrix a new ordered column corresponding to the given boundary. This means that it is assumed that this method is called on boundaries in the order of the filtration. It also assumes that the faces in the given boundary are identified by their relative position in the filtration, starting at 0. If it is not the case, use the other insert_boundary instead by indicating the face ID used in the boundaries when the face is inserted.

Different to the constructor, the boundaries do not have to come from a simplicial complex, but also from a more general cell complex. This includes cubical complexes or Morse complexes for example.

The content of the new column will vary depending on the underlying type of the matrix:

  • If it is a boundary type matrix and only \( R \) is stored, the boundary is just copied. The column will only be reduced later when the barcode is requested in order to apply some optimisations with the additional knowledge. Hence, the barcode will also not be updated.
  • If it is a boundary type matrix and both \( R \) and \( U \) are stored, the new boundary is stored in its reduced form and the barcode, if active, is also updated.
  • If it is a chain type matrix, the new column is of the form IDIdx + linear combination of older column IDIdxs, where the combination is deduced while reducing the given boundary. If the barcode is stored, it will also be updated.
Template Parameters
Boundary_typeRange of Matrix::cell_rep_type. Assumed to have a begin(), end() and size() method.
Parameters
boundaryBoundary generating the new column. The content should be ordered by ID.
dimDimension of the face whose boundary is given. If the complex is simplicial, this parameter can be omitted as it can be deduced from the size of the boundary.

◆ insert_boundary() [2/2]

template<class Matrix_type , class Master_matrix_type >
template<class Boundary_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::insert_boundary ( id_index  faceIndex,
const Boundary_type &  boundary,
dimension_type  dim = -1 
)
inline

It does the same as the other version, but allows the boundary faces to be identified without restrictions except that all IDs have to be strictly increasing in the order of filtration. Note that you should avoid then to use the other insertion method to avoid overwriting IDs.

As a face has to be inserted before one of its cofaces in a valid filtration (recall that it is assumed that the faces are inserted by order of filtration), it is sufficient to indicate the ID of the face being inserted.

Template Parameters
Boundary_typeRange of Matrix::cell_rep_type. Assumed to have a begin(), end() and size() method.
Parameters
faceIndexIDIdx index to use to indentify the new face.
boundaryBoundary generating the new column. The indices of the boundary have to correspond to the faceIndex values of precedent calls of the method for the corresponding faces and should be ordered in increasing order.
dimDimension of the face whose boundary is given. If the complex is simplicial, this parameter can be omitted as it can be deduced from the size of the boundary.

◆ is_zero_cell()

template<class Matrix_type , class Master_matrix_type >
bool Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::is_zero_cell ( id_index  faceID,
id_index  rowIndex 
) const
inline

Indicates if the cell at given coordinates has value zero.

For RU matrices, looks into \( R \).

Parameters
faceIDIDIdx index of the face corresponding to the column of the cell.
rowIndexRow index of the row of the cell.
Returns
true If the cell has value zero.
false Otherwise.

◆ is_zero_column()

template<class Matrix_type , class Master_matrix_type >
bool Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::is_zero_column ( id_index  faceID)
inline

Indicates if the column at given index has value zero.

For RU matrices, looks into \( R \).

Note that for chain matrices, this method should always return false, as a valid chain matrix never has empty columns.

Parameters
faceIDIDIdx index of the face corresponding to the column.
Returns
true If the column has value zero.
false Otherwise.

◆ multiply_source_and_add_to()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::multiply_source_and_add_to ( const Field_element_type coefficient,
id_index  sourceFaceID,
id_index  targetFaceID 
)
inline

Multiplies the source column with the coefficiant before adding it to the target column. That is: targetColumn += (coefficient * sourceColumn). The source column will not be modified.

Warning
They will be no verification to ensure that the addition makes sense for the validity of the matrix. For example, a right-to-left addition could corrupt the computation of the barcode if done blindly. So should be used with care.
Parameters
coefficientValue to multiply.
sourceFaceIDIDIdx index of the source column.
targetFaceIDIDIdx index of the target column.

◆ multiply_target_and_add_to()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::multiply_target_and_add_to ( id_index  sourceFaceID,
const Field_element_type coefficient,
id_index  targetFaceID 
)
inline

Multiplies the target column with the coefficiant and then adds the source column to it. That is: targetColumn = (targetColumn * coefficient) + sourceColumn.

Warning
They will be no verification to ensure that the addition makes sense for the validity of the matrix. For example, a right-to-left addition could corrupt the computation of the barcode if done blindly. So should be used with care.
Parameters
sourceFaceIDIDIdx index of the source column.
coefficientValue to multiply.
targetFaceIDIDIdx index of the target column.

◆ remove_last()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::remove_last
inline

Only available if PersistenceMatrixOptions::has_removable_columns is true. Additionnaly, if the matrix is a chain matrix, either PersistenceMatrixOptions::has_map_column_container has to be true or PersistenceMatrixOptions::has_vine_update has to be false. Removes the last face in the filtration from the matrix and updates the barcode if it is stored.

See also remove_maximal_face.

For chain matrices, if PersistenceMatrixOptions::has_vine_update is true, the last face does not have to be at the end of the matrix and therefore has to be searched first. In this case, if the user already knows the IDIdx of the last face, calling remove_maximal_face(faceID, {}) instead allows to skip the search.

◆ remove_maximal_face() [1/2]

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::remove_maximal_face ( id_index  faceID)
inline

Only available for RU and chain matrices and if PersistenceMatrixOptions::has_removable_columns and PersistenceMatrixOptions::has_vine_update are true. For chain matrices, PersistenceMatrixOptions::has_map_column_container and PersistenceMatrixOptions::has_column_pairings also need to be true. Assumes that the face is maximal in the current complex and removes it such that the matrix remains consistent (i.e., RU is still an upper triangular decomposition of the boundary matrix and chain is still a compatible bases of the chain complex in the sense of [41]). The maximality of the face is not verified. Also updates the barcode if it was computed.

For chain matrices, using the other version of the method could perform better depending on how the data is maintained on the side of the user. Then, has_column_pairings also do not need to be true.

See also remove_last.

Parameters
faceIDIDIdx index of the face to remove.

◆ remove_maximal_face() [2/2]

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::remove_maximal_face ( id_index  faceID,
const std::vector< id_index > &  columnsToSwap 
)
inline

Only available for chain matrices and if PersistenceMatrixOptions::has_removable_columns, PersistenceMatrixOptions::has_vine_update and PersistenceMatrixOptions::has_map_column_container are true. Assumes that the face is maximal in the current complex and removes it such that the matrix remains consistent (i.e., it is still a compatible bases of the chain complex in the sense of [41]). The maximality of the face is not verified. Also updates the barcode if it was computed.

To maintain the compatibility, vine swaps are done to move the face up to the end of the filtration. Once at the end, the removal is trivial. But for chain matrices, swaps do not actually swap the position of the column every time, so the faces appearing after faceIndex in the filtration have to be searched first within the matrix. If the user has an easy access to the IDIdx of the faces in the order of filtration, passing them by argument with columnsToSwap allows to skip a linear search process. Typically, if the user knows that the face he wants to remove is already the last face of the filtration, calling remove_maximal_face(faceID, {}) will be faster than remove_last().

See also remove_last.

Parameters
faceIDIDIdx index of the face to remove.
columnsToSwapVector of IDIdx indices of the faces coming after faceID in the filtration.

◆ reset()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::reset ( Column_settings colSettings)
inline

Resets the matrix to an empty matrix.

Parameters
colSettingsPointer to an existing setting structure for the columns. The structure should contain all the necessary external classes specifically necessary for the choosen column type, such as custom allocators.

◆ swap_columns()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::swap_columns ( id_index  faceID1,
id_index  faceID2 
)
inline

Only available for simple boundary matrices (only storing \( R \)) and if PersistenceMatrixOptions::has_column_and_row_swaps is true. Swaps the two given columns. Note that it really just swaps two columns and do not updates anything else, nor performs additions to maintain some properties on the matrix.

Parameters
faceID1First column IDIdx index to swap.
faceID2Second column IDIdx index to swap.

◆ swap_rows()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::swap_rows ( index  rowIndex1,
index  rowIndex2 
)
inline

Only available for simple boundary matrices (only storing R) and if PersistenceMatrixOptions::has_column_and_row_swaps is true. Swaps the two given rows. Note that it really just swaps two rows and do not updates anything else, nor performs additions to maintain some properties on the matrix.

Parameters
rowIndex1First row index to swap.
rowIndex2Second row index to swap.

◆ vine_swap()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::id_index Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::vine_swap ( id_index  faceID1,
id_index  faceID2 
)
inline

Only available if PersistenceMatrixOptions::has_vine_update is true. Does a vine swap between two faces which are consecutives in the filtration. Roughly, if \( F \) is the current filtration represented by the matrix, the method modifies the matrix such that the new state corresponds to a valid state for the filtration \( F' \) equal to \( F \) but with the two given faces at swapped positions. Of course, the two faces should not have a face/coface relation which each other ; \( F' \) has to be a valid filtration. See [21] for more information about vine and vineyards.

Parameters
faceID1IDIdx index of the first face.
faceID2IDIdx index of the second face. It is assumed that the PosIdx of both only differs by one.
Returns
Let \( pos1 \) be the PosIdx index of columnIndex1 and \( pos2 \) be the PosIdx index of columnIndex2. The method returns the MatIdx of the column which has now, after the swap, the PosIdx \( max(pos1, pos2) \).

◆ vine_swap_with_z_eq_1_case()

template<class Matrix_type , class Master_matrix_type >
Id_to_index_overlay< Matrix_type, Master_matrix_type >::id_index Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::vine_swap_with_z_eq_1_case ( id_index  faceID1,
id_index  faceID2 
)
inline

Only available if PersistenceMatrixOptions::has_vine_update is true. Does the same than vine_swap, but assumes that the swap is non trivial and therefore skips a part of the case study.

Parameters
faceID1IDIdx index of the first face.
faceID2IDIdx index of the second face. It is assumed that the PosIdx of both only differs by one.
Returns
Let \( pos1 \) be the PosIdx index of columnIndex1 and \( pos2 \) be the PosIdx index of columnIndex2. The method returns the MatIdx of the column which has now, after the swap, the PosIdx \( max(pos1, pos2) \).

◆ zero_cell()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::zero_cell ( id_index  faceID,
id_index  rowIndex 
)
inline

Zeroes the cell at the given coordinates. Not available for chain matrices. In general, should be used with care to not destroy the validity of the persistence related properties of the matrix.

For RU matrices, zeros only the cell in \( R \).

Parameters
faceIDIDIdx index of the face corresponding to the column of the cell.
rowIndexRow index of the row of the cell.

◆ zero_column()

template<class Matrix_type , class Master_matrix_type >
void Gudhi::persistence_matrix::Id_to_index_overlay< Matrix_type, Master_matrix_type >::zero_column ( id_index  faceID)
inline

Zeroes the column at the given index. Not available for chain matrices. In general, should be used with care to not destroy the validity of the persistence related properties of the matrix.

For RU matrices, zeros only the column in \( R \).

Parameters
faceIDIDIdx index of the face corresponding to the column.

The documentation for this class was generated from the following file: