Gudhi::persistence_matrix::Chain_matrix< Master_matrix > Class Template Reference

Matrix structure storing a compatible base of a filtered chain complex. See [41]. The base is constructed from the boundaries of the faces in the complex. Allows the persistent homology to be computed, as well as representative cycles. Supports vineyards (see [21]) and the removal of maximal faces while maintaining a valid barcode. Provides an access to its columns and rows. More...

Public Types

using Field_operators = typename Master_matrix::Field_operators
 Field operators class. Necessary only if PersistenceMatrixOptions::is_z2 is false.
 
using Field_element_type = typename Master_matrix::element_type
 
using Column_type = typename Master_matrix::Column_type
 
using Row_type = typename Master_matrix::Row_type
 
using Cell = typename Master_matrix::Cell_type
 
using Cell_constructor = typename Master_matrix::Cell_constructor
 
using Column_settings = typename Master_matrix::Column_settings
 
using boundary_type = typename Master_matrix::boundary_type
 
using cell_rep_type = typename Master_matrix::cell_rep_type
 
using index = typename Master_matrix::index
 
using id_index = typename Master_matrix::id_index
 
using pos_index = typename Master_matrix::pos_index
 
using dimension_type = typename Master_matrix::dimension_type
 

Public Member Functions

 Chain_matrix (Column_settings *colSettings)
 Constructs an empty matrix. Only available if PersistenceMatrixOptions::has_column_pairings is true or PersistenceMatrixOptions::has_vine_update is false. Otherwise, birth and death comparators have to be provided. More...
 
template<class Boundary_type = boundary_type>
 Chain_matrix (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. Only available if PersistenceMatrixOptions::has_column_pairings is true or PersistenceMatrixOptions::has_vine_update is false. Otherwise, birth and death comparators have to be provided. More...
 
 Chain_matrix (unsigned int numberOfColumns, Column_settings *colSettings)
 Constructs a new empty matrix and reserves space for the given number of columns. Only available if PersistenceMatrixOptions::has_column_pairings is true or PersistenceMatrixOptions::has_vine_update is false. Otherwise, birth and death comparators have to be provided. More...
 
template<typename BirthComparatorFunction , typename DeathComparatorFunction >
 Chain_matrix (Column_settings *colSettings, const BirthComparatorFunction &birthComparator, const DeathComparatorFunction &deathComparator)
 Constructs an empty matrix and stores the given comparators. More...
 
template<typename BirthComparatorFunction , typename DeathComparatorFunction , class Boundary_type = boundary_type>
 Chain_matrix (const std::vector< Boundary_type > &orderedBoundaries, Column_settings *colSettings, const BirthComparatorFunction &birthComparator, const DeathComparatorFunction &deathComparator)
 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 >
 Chain_matrix (unsigned int numberOfColumns, Column_settings *colSettings, const BirthComparatorFunction &birthComparator, const DeathComparatorFunction &deathComparator)
 Constructs a new empty matrix and reserves space for the given number of columns. More...
 
 Chain_matrix (const Chain_matrix &matrixToCopy, Column_settings *colSettings=nullptr)
 Copy constructor. If colSettings is not a null pointer, its value is kept instead of the one in the copied matrix. More...
 
 Chain_matrix (Chain_matrix &&other) noexcept
 Move constructor. More...
 
template<class Boundary_type = boundary_type>
std::vector< cell_rep_typeinsert_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>
std::vector< cell_rep_typeinsert_boundary (id_index faceID, 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 (index columnIndex)
 Returns the column at the given MatIdx index. The type of the column depends on the choosen options, see PersistenceMatrixOptions::column_type. More...
 
const Column_typeget_column (index columnIndex) const
 Returns the column at the given MatIdx index. The type of the column depends on the choosen options, see PersistenceMatrixOptions::column_type. More...
 
void remove_maximal_face (id_index faceID)
 Only available if PersistenceMatrixOptions::has_removable_columns and PersistenceMatrixOptions::has_vine_update are true, as well as, PersistenceMatrixOptions::has_map_column_container and PersistenceMatrixOptions::has_column_pairings. Assumes that the face is maximal in the current complex and removes it such that the matrix remains consistent (i.e., the matrix 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 is stored. More...
 
void remove_maximal_face (id_index faceID, const std::vector< id_index > &columnsToSwap)
 Only available 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 is stored. More...
 
void remove_last ()
 Only available if PersistenceMatrixOptions::has_removable_columns is true and, if PersistenceMatrixOptions::has_map_column_container is true or PersistenceMatrixOptions::has_vine_update is false. Removes the last face in the filtration from the matrix and updates the barcode if it is stored. More...
 
index get_number_of_columns () const
 Returns the current number of columns in the matrix. More...
 
dimension_type get_column_dimension (index columnIndex) const
 Returns the dimension of the given column. More...
 
void add_to (index sourceColumnIndex, index targetColumnIndex)
 Adds column at sourceColumnIndex onto the column at targetColumnIndex in the matrix. More...
 
void multiply_target_and_add_to (index sourceColumnIndex, const Field_element_type &coefficient, index targetColumnIndex)
 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, index sourceColumnIndex, index targetColumnIndex)
 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...
 
bool is_zero_cell (index columnIndex, id_index rowIndex) const
 Indicates if the cell at given coordinates has value zero. More...
 
bool is_zero_column (index columnIndex)
 Indicates if the column at given index has value zero. Note that if the matrix is valid, this method should always return false. More...
 
index get_column_with_pivot (id_index faceID) const
 Returns the column with given row index as pivot. Assumes that the pivot exists. More...
 
id_index get_pivot (index columnIndex)
 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...
 
Chain_matrixoperator= (const Chain_matrix &other)
 Assign operator.
 

Friends

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

Detailed Description

template<class Master_matrix>
class Gudhi::persistence_matrix::Chain_matrix< Master_matrix >

Matrix structure storing a compatible base of a filtered chain complex. See [41]. The base is constructed from the boundaries of the faces in the complex. Allows the persistent homology to be computed, as well as representative cycles. Supports vineyards (see [21]) and the removal of maximal faces while maintaining a valid barcode. Provides an access to its columns and rows.

Template Parameters
Master_matrixAn instanciation of Matrix from which all types and options are deduced.

Member Typedef Documentation

◆ boundary_type

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::boundary_type = typename Master_matrix::boundary_type

Type of an input column.

◆ Cell

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Cell = typename Master_matrix::Cell_type

Matrix cell type.

◆ Cell_constructor

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Cell_constructor = typename Master_matrix::Cell_constructor

Factory of Cell classes.

◆ cell_rep_type

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::cell_rep_type = typename Master_matrix::cell_rep_type

Cell content representative.

◆ Column_settings

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Column_settings = typename Master_matrix::Column_settings

Structure giving access to the columns to necessary external classes.

◆ Column_type

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Column_type = typename Master_matrix::Column_type

Column type.

◆ dimension_type

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::dimension_type = typename Master_matrix::dimension_type

Dimension value type.

◆ Field_element_type

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Field_element_type = typename Master_matrix::element_type

Type of an field element.

◆ id_index

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::id_index = typename Master_matrix::id_index

IDIdx index type.

◆ index

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::index = typename Master_matrix::index

MatIdx index type.

◆ pos_index

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::pos_index = typename Master_matrix::pos_index

PosIdx index type.

◆ Row_type

template<class Master_matrix >
using Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Row_type = typename Master_matrix::Row_type

Row type, only necessary with row access option.

Constructor & Destructor Documentation

◆ Chain_matrix() [1/8]

template<class Master_matrix >
Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Chain_matrix ( Column_settings colSettings)
inline

Constructs an empty matrix. Only available if PersistenceMatrixOptions::has_column_pairings is true or PersistenceMatrixOptions::has_vine_update is false. Otherwise, birth and death comparators have to be provided.

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.

◆ Chain_matrix() [2/8]

template<class Master_matrix >
template<class Boundary_type >
Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Chain_matrix ( 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. Only available if PersistenceMatrixOptions::has_column_pairings is true or PersistenceMatrixOptions::has_vine_update is false. Otherwise, birth and death comparators have to be provided.

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 Chain_matrix(unsigned int numberOfColumns, Column_settings* colSettings) 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.

◆ Chain_matrix() [3/8]

template<class Master_matrix >
Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Chain_matrix ( unsigned int  numberOfColumns,
Column_settings colSettings 
)
inline

Constructs a new empty matrix and reserves space for the given number of columns. Only available if PersistenceMatrixOptions::has_column_pairings is true or PersistenceMatrixOptions::has_vine_update is false. Otherwise, birth and death comparators have to be provided.

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.

◆ Chain_matrix() [4/8]

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

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.

◆ Chain_matrix() [5/8]

template<class Master_matrix >
template<typename BirthComparatorFunction , typename DeathComparatorFunction , class Boundary_type >
Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Chain_matrix ( const std::vector< Boundary_type > &  orderedBoundaries,
Column_settings colSettings,
const BirthComparatorFunction &  birthComparator,
const DeathComparatorFunction &  deathComparator 
)
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.

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 Chain_matrix(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.

◆ Chain_matrix() [6/8]

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

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.

◆ Chain_matrix() [7/8]

template<class Master_matrix >
Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Chain_matrix ( const Chain_matrix< Master_matrix > &  matrixToCopy,
Column_settings colSettings = nullptr 
)
inline

Copy constructor. If colSettings 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.

◆ Chain_matrix() [8/8]

template<class Master_matrix >
Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::Chain_matrix ( Chain_matrix< Master_matrix > &&  other)
inlinenoexcept

Move constructor.

Parameters
otherMatrix to move.

Member Function Documentation

◆ add_to()

template<class Master_matrix >
void Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::add_to ( index  sourceColumnIndex,
index  targetColumnIndex 
)
inline

Adds column at sourceColumnIndex onto the column at targetColumnIndex in the matrix.

Warning
They will be no verification to ensure that the addition makes sense for the validity of a chain 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
sourceColumnIndexMatIdx index of the source column.
targetColumnIndexMatIdx index of the target column.

◆ get_column() [1/2]

template<class Master_matrix >
Chain_matrix< Master_matrix >::Column_type & Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::get_column ( index  columnIndex)
inline

Returns the column at the given MatIdx index. The type of the column depends on the choosen options, see PersistenceMatrixOptions::column_type.

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

◆ get_column() [2/2]

template<class Master_matrix >
const Chain_matrix< Master_matrix >::Column_type & Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::get_column ( index  columnIndex) const
inline

Returns the column at the given MatIdx index. The type of the column depends on the choosen options, see PersistenceMatrixOptions::column_type.

Parameters
columnIndexMatIdx index of the column to return.
Returns
Const reference to the column.

◆ get_column_dimension()

template<class Master_matrix >
Chain_matrix< Master_matrix >::dimension_type Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::get_column_dimension ( index  columnIndex) const
inline

Returns the dimension of the given column.

Parameters
columnIndexMatIdx index of the column representing the face.
Returns
Dimension of the face.

◆ get_column_with_pivot()

template<class Master_matrix >
Chain_matrix< Master_matrix >::index Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::get_column_with_pivot ( id_index  faceID) const
inline

Returns the column with given row index as pivot. Assumes that the pivot exists.

Parameters
faceIDRow index of the pivot.
Returns
MatIdx index of the column with the given pivot.

◆ get_number_of_columns()

template<class Master_matrix >
Chain_matrix< Master_matrix >::index Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::get_number_of_columns
inline

Returns the current number of columns in the matrix.

Returns
The number of columns.

◆ get_pivot()

template<class Master_matrix >
Chain_matrix< Master_matrix >::id_index Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::get_pivot ( index  columnIndex)
inline

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

Parameters
columnIndexMatIdx index of the column
Returns
The row index of the pivot.

◆ insert_boundary() [1/2]

template<class Master_matrix >
template<class Boundary_type = boundary_type>
std::vector<cell_rep_type> Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::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.

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.

When inserted, the given boundary is reduced and from the reduction process, the column is deduced in the form of: IDIdx + linear combination of older column IDIdxs. If the barcode is stored, it will 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.
Returns
The MatIdx indices of the unpaired chains used to reduce the boundary.

◆ insert_boundary() [2/2]

template<class Master_matrix >
template<class Boundary_type = boundary_type>
std::vector<cell_rep_type> Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::insert_boundary ( id_index  faceID,
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.

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
faceIDIDIdx index to use to indentify the new face.
boundaryBoundary generating the new column. The indices of the boundary have to correspond to the faceID 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.
Returns
The MatIdx index of the inserted boundary.

◆ is_zero_cell()

template<class Master_matrix >
bool Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::is_zero_cell ( index  columnIndex,
id_index  rowIndex 
) const
inline

Indicates if the cell at given coordinates has value zero.

Parameters
columnIndexMatIdx index of 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 Master_matrix >
bool Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::is_zero_column ( index  columnIndex)
inline

Indicates if the column at given index has value zero. Note that if the matrix is valid, this method should always return false.

Parameters
columnIndexMatIdx index of the column.
Returns
true If the column has value zero.
false Otherwise.

◆ multiply_source_and_add_to()

template<class Master_matrix >
void Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::multiply_source_and_add_to ( const Field_element_type coefficient,
index  sourceColumnIndex,
index  targetColumnIndex 
)
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 a chain 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.
sourceColumnIndexMatIdx index of the source column.
targetColumnIndexMatIdx index of the target column.

◆ multiply_target_and_add_to()

template<class Master_matrix >
void Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::multiply_target_and_add_to ( index  sourceColumnIndex,
const Field_element_type coefficient,
index  targetColumnIndex 
)
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 a chain 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
sourceColumnIndexMatIdx index of the source column.
coefficientValue to multiply.
targetColumnIndexMatIdx index of the target column.

◆ remove_last()

template<class Master_matrix >
void Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::remove_last
inline

Only available if PersistenceMatrixOptions::has_removable_columns is true and, if PersistenceMatrixOptions::has_map_column_container is true or PersistenceMatrixOptions::has_vine_update is false. Removes the last face in the filtration from the matrix and updates the barcode if it is stored.

See also remove_maximal_face.

Warning
If PersistenceMatrixOptions::has_vine_update is true, the last face does not have to be at the end of the matrix container 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 Master_matrix >
void Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::remove_maximal_face ( id_index  faceID)
inline

Only available if PersistenceMatrixOptions::has_removable_columns and PersistenceMatrixOptions::has_vine_update are true, as well as, PersistenceMatrixOptions::has_map_column_container and PersistenceMatrixOptions::has_column_pairings. Assumes that the face is maximal in the current complex and removes it such that the matrix remains consistent (i.e., the matrix 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 is stored.

Note that using the other version of the method could perform better depending on how the data is maintained on the side of the user, that is, if providing the second parameter is easy.

See also remove_last.

Parameters
faceIDIDIdx index of the face to remove

◆ remove_maximal_face() [2/2]

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

Only available 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 is stored.

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 faceID 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 Master_matrix >
void Gudhi::persistence_matrix::Chain_matrix< Master_matrix >::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.

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