16#ifndef MASTER_MATRIX_H
17#define MASTER_MATRIX_H
21#include <unordered_map>
23#include <initializer_list>
25#include <boost/intrusive/list.hpp>
27#include <gudhi/Debug_utils.h>
71namespace persistence_matrix {
142template <
class PersistenceMatrixOptions = Default_options<> >
163 using characteristic_type =
typename Field_operators::characteristic_type;
178 inline friend std::ostream &operator<<(std::ostream &stream,
const Bar& bar) {
179 stream <<
"[" << bar.
dim <<
"] ";
187 struct matrix_row_tag;
188 struct matrix_column_tag;
190 using base_hook_matrix_row =
191 boost::intrusive::list_base_hook<boost::intrusive::tag<matrix_row_tag>,
192 boost::intrusive::link_mode<boost::intrusive::auto_unlink> >;
193 using base_hook_matrix_list_column =
194 boost::intrusive::list_base_hook<boost::intrusive::tag<matrix_column_tag>,
195 boost::intrusive::link_mode<boost::intrusive::safe_link> >;
196 using base_hook_matrix_set_column =
197 boost::intrusive::set_base_hook<boost::intrusive::tag<matrix_column_tag>,
198 boost::intrusive::link_mode<boost::intrusive::safe_link> >;
201 struct Dummy_row_hook {};
202 struct Dummy_column_hook {};
206 base_hook_matrix_row,
209 using column_hook_type =
typename std::conditional<
211 base_hook_matrix_list_column,
213 base_hook_matrix_set_column,
219 using Cell_column_index_option =
221 Cell_column_index<index>,
222 Dummy_cell_column_index_mixin
226 using Cell_field_element_option =
228 Dummy_cell_field_element_mixin,
229 Cell_field_element<element_type>
257 std::pair<id_index, element_type>
265 return c1.get_column_index() < c2.get_column_index();
277 boost::intrusive::constant_time_size<false>,
278 boost::intrusive::base_hook<base_hook_matrix_row>
280 std::set<Cell_type, RowCellComp>
283 using row_container_type =
285 std::map<id_index, Row_type>,
286 std::vector<Row_type>
290 using Row_access_option =
296 using Matrix_row_access_option =
305 template <
typename value_type>
306 using dictionnary_type =
308 std::unordered_map<unsigned int, value_type>,
309 std::vector<value_type>
316 using Column_dimension_option =
317 typename std::conditional<isNonBasic,
322 using Chain_column_option =
345 typename std::conditional<
348 typename std::conditional<
351 typename std::conditional<
354 typename std::conditional<
357 typename std::conditional<
360 typename std::conditional<
372 struct Column_z2_settings{
373 Column_z2_settings() : cellConstructor() {}
374 Column_z2_settings([[maybe_unused]] characteristic_type characteristic) : cellConstructor() {}
375 Column_z2_settings(
const Column_z2_settings& toCopy) : cellConstructor() {}
380 struct Column_zp_settings {
381 Column_zp_settings() : operators(), cellConstructor() {}
384 Column_zp_settings(characteristic_type characteristic) : operators(), cellConstructor() {
385 if (characteristic !=
static_cast<characteristic_type
>(-1)) operators.set_characteristic(characteristic);
387 Column_zp_settings(
const Column_zp_settings& toCopy)
388 : operators(toCopy.operators.get_characteristic()), cellConstructor() {}
414 using Column_settings =
typename std::conditional<
432 using column_container_type =
434 std::unordered_map<index, Column_type>,
435 std::vector<Column_type>
444 typename std::conditional<hasFixedBarcode,
451 using bar_dictionnary_type =
452 typename std::conditional<hasFixedBarcode,
455 std::unordered_map<pos_index, index>
458 std::unordered_map<pos_index, typename barcode_type::iterator>,
465 std::initializer_list<id_index>,
466 std::initializer_list<std::pair<id_index, element_type> >
471 static const bool maxDimensionIsNeeded =
475 using Matrix_dimension_option =
typename std::conditional<
484 using Base_matrix_type =
493 template <
class Base>
494 using Base_swap_option =
500 using Base_pairing_option =
508 using RU_pairing_option =
514 using RU_vine_swap_option =
519 using RU_representative_cycles_option =
525 using Chain_pairing_option =
535 using Chain_representative_cycles_option =
549 using returned_column_type =
555 using returned_row_type =
562 using insertion_return_type =
567 std::vector<cell_rep_type>
600 template <
class Container_type = boundary_type>
601 Matrix(
const std::vector<Container_type>& columns, characteristic_type characteristic = 11);
611 Matrix(
int numberOfColumns, characteristic_type characteristic =
static_cast<characteristic_type
>(-1));
658 template <
class Boundary_type = boundary_type>
659 Matrix(
const std::vector<Boundary_type>& orderedBoundaries,
662 characteristic_type characteristic = 11);
686 Matrix(
unsigned int numberOfColumns,
689 characteristic_type characteristic =
static_cast<characteristic_type
>(-1));
734 template <
class Container_type>
747 template <
class Container_type>
782 template <
class Boundary_type = boundary_type>
804 template <
class Boundary_type>
1007 template <
typename Index_type>
1008 std::enable_if_t<std::is_integral_v<Index_type> >
add_to(Index_type sourceColumnIndex, Index_type targetColumnIndex);
1021 template <
class Cell_range>
1022 std::enable_if_t<!std::is_integral_v<Cell_range> >
add_to(
const Cell_range& sourceColumn,
index targetColumnIndex);
1040 template <
typename Index_type>
1043 Index_type targetColumnIndex);
1058 template <
class Cell_range>
1061 index targetColumnIndex);
1079 template <
typename Index_type>
1081 Index_type sourceColumnIndex,
1082 Index_type targetColumnIndex);
1097 template <
class Cell_range>
1099 const Cell_range& sourceColumn,
1100 index targetColumnIndex);
1233 swap(matrix1.matrix_, matrix2.matrix_);
1234 std::swap(matrix1.colSettings_, matrix2.colSettings_);
1379 typename std::conditional<
1381 typename std::conditional<
1383 typename std::conditional<
1386 typename std::conditional<
1391 typename std::conditional<
1394 Boundary_matrix_type,
1398 typename std::conditional<
1401 typename std::conditional<
1413 Column_settings* colSettings_;
1414 Matrix_type matrix_;
1416 static constexpr void _assert_options();
1419template <
class PersistenceMatrixOptions>
1421 : colSettings_(new Column_settings()), matrix_(colSettings_)
1426 "When no barcode is recorded with vine swaps, comparaison functions for the columns have to be provided.");
1430template <
class PersistenceMatrixOptions>
1431template <
class Container_type>
1433 characteristic_type characteristic)
1434 : colSettings_(new Column_settings(characteristic)),
1435 matrix_(columns, colSettings_)
1439 "When no barcode is recorded with vine swaps for chain matrices, comparaison functions for the columns "
1440 "have to be provided.");
1444template <
class PersistenceMatrixOptions>
1446 : colSettings_(new Column_settings(characteristic)),
1447 matrix_(numberOfColumns, colSettings_)
1451 "When no barcode is recorded with vine swaps for chain matrices, comparaison functions for the columns "
1452 "have to be provided.");
1456template <
class PersistenceMatrixOptions>
1459 : colSettings_(new Column_settings()),
1460 matrix_(colSettings_, birthComparator, deathComparator)
1465 "Constructor only available for chain matrices when vine swaps are enabled, but barcodes are not recorded.");
1469template <
class PersistenceMatrixOptions>
1470template <
class Boundary_type>
1474 characteristic_type characteristic)
1475 : colSettings_(new Column_settings(characteristic)),
1476 matrix_(orderedBoundaries, colSettings_, birthComparator, deathComparator)
1481 "Constructor only available for chain matrices when vine swaps are enabled, but barcodes are not recorded.");
1485template <
class PersistenceMatrixOptions>
1489 characteristic_type characteristic)
1490 : colSettings_(new Column_settings(characteristic)),
1491 matrix_(numberOfColumns, colSettings_, birthComparator, deathComparator)
1496 "Constructor only available for chain matrices when vine swaps are enabled, but barcodes are not recorded.");
1500template <
class PersistenceMatrixOptions>
1502 : colSettings_(new Column_settings(*matrixToCopy.colSettings_)),
1503 matrix_(matrixToCopy.matrix_, colSettings_)
1508template <
class PersistenceMatrixOptions>
1510 : colSettings_(std::exchange(other.colSettings_,
nullptr)),
1511 matrix_(std::move(other.matrix_))
1516template <
class PersistenceMatrixOptions>
1519 matrix_.reset(colSettings_);
1520 delete colSettings_;
1523template <
class PersistenceMatrixOptions>
1527 if (colSettings_->operators.get_characteristic() !=
static_cast<characteristic_type
>(-1)) {
1528 std::cerr <<
"Warning: Characteristic already initialised. Changing it could lead to incoherences in the matrice "
1529 "as the modulo was already applied to values in existing columns.";
1536template <
class PersistenceMatrixOptions>
1537template <
class Container_type>
1541 GUDHI_CHECK(colSettings_->operators.get_characteristic() !=
static_cast<characteristic_type
>(-1),
1542 std::logic_error(
"Matrix::insert_column - Columns cannot be initialized if the coefficient field "
1543 "characteristic is not specified."));
1548 "'insert_column' not available for the chosen options. The input has to be in the form of a face boundary.");
1549 matrix_.insert_column(column);
1552template <
class PersistenceMatrixOptions>
1553template <
class Container_type>
1557 GUDHI_CHECK(colSettings_->operators.get_characteristic() !=
static_cast<characteristic_type
>(-1),
1558 std::logic_error(
"Matrix::insert_column - Columns cannot be initialized if the coefficient field "
1559 "characteristic is not specified."));
1563 "'insert_column' with those parameters is not available for the chosen options.");
1565 "Columns have to be inserted at the end of the matrix when row access is enabled.");
1566 matrix_.insert_column(column, columnIndex);
1569template <
class PersistenceMatrixOptions>
1570template <
class Boundary_type>
1571inline typename Matrix<PersistenceMatrixOptions>::insertion_return_type
1575 GUDHI_CHECK(colSettings_->operators.get_characteristic() !=
static_cast<characteristic_type
>(-1),
1576 std::logic_error(
"Matrix::insert_boundary - Columns cannot be initialized if the coefficient field "
1577 "characteristic is not specified."));
1582 return matrix_.insert_boundary(boundary, dim);
1584 matrix_.insert_boundary(boundary, dim);
1587template <
class PersistenceMatrixOptions>
1588template <
class Boundary_type>
1589inline typename Matrix<PersistenceMatrixOptions>::insertion_return_type
1591 const Boundary_type& boundary,
1595 GUDHI_CHECK(colSettings_->operators.get_characteristic() !=
static_cast<characteristic_type
>(-1),
1596 std::logic_error(
"Matrix::insert_boundary - Columns cannot be initialized if the coefficient field "
1597 "characteristic is not specified."));
1600 static_assert(isNonBasic,
"Only enabled for non-basic matrices.");
1603 return matrix_.insert_boundary(faceIndex, boundary, dim);
1605 matrix_.insert_boundary(faceIndex, boundary, dim);
1608template <
class PersistenceMatrixOptions>
1612 return matrix_.get_column(columnIndex);
1615template <
class PersistenceMatrixOptions>
1617 index columnIndex)
const
1619 return matrix_.get_column(columnIndex);
1622template <
class PersistenceMatrixOptions>
1624 index columnIndex,
bool inR)
1631 "Only enabled for position indexed RU matrices.");
1633 return matrix_.get_column(columnIndex, inR);
1636template <
class PersistenceMatrixOptions>
1642 return matrix_.get_row(rowIndex);
1645template <
class PersistenceMatrixOptions>
1651 return matrix_.get_row(rowIndex);
1654template <
class PersistenceMatrixOptions>
1664 "Only enabled for position indexed RU matrices.");
1666 return matrix_.get_row(rowIndex, inR);
1669template <
class PersistenceMatrixOptions>
1674 "'remove_column' is not available for the chosen options.");
1676 matrix_.remove_column(columnIndex);
1679template <
class PersistenceMatrixOptions>
1684 "'erase_empty_row' is not available for the chosen options.");
1686 matrix_.erase_empty_row(rowIndex);
1689template <
class PersistenceMatrixOptions>
1693 "'remove_maximal_face(id_index)' is not available for the chosen options.");
1695 "'remove_maximal_face(id_index)' is not available for the chosen options.");
1698 "'remove_maximal_face(id_index)' is not available for the chosen options.");
1700 matrix_.remove_maximal_face(columnIndex);
1703template <
class PersistenceMatrixOptions>
1705 const std::vector<id_index>& columnsToSwap)
1708 "'remove_maximal_face(id_index,const std::vector<index>&)' is not available for the chosen options.");
1710 "'remove_maximal_face(id_index,const std::vector<index>&)' is not available for the chosen options.");
1712 "'remove_maximal_face(id_index,const std::vector<index>&)' is not available for the chosen options.");
1714 matrix_.remove_maximal_face(faceIndex, columnsToSwap);
1717template <
class PersistenceMatrixOptions>
1721 "'remove_last' is not available for the chosen options.");
1723 "'remove_last' is not available for the chosen options.");
1726 "'remove_last' is not available for the chosen options.");
1728 matrix_.remove_last();
1731template <
class PersistenceMatrixOptions>
1735 static_assert(isNonBasic,
"'get_max_dimension' is not available for the chosen options.");
1737 return matrix_.get_max_dimension();
1740template <
class PersistenceMatrixOptions>
1743 return matrix_.get_number_of_columns();
1746template <
class PersistenceMatrixOptions>
1748 index columnIndex)
const
1750 static_assert(isNonBasic,
"'get_column_dimension' is not available for the chosen options.");
1752 return matrix_.get_column_dimension(columnIndex);
1755template <
class PersistenceMatrixOptions>
1756template <
typename Index_type>
1758 Index_type sourceColumnIndex, Index_type targetColumnIndex)
1760 matrix_.add_to(sourceColumnIndex, targetColumnIndex);
1763template <
class PersistenceMatrixOptions>
1764template <
class Cell_range>
1766 const Cell_range& sourceColumn,
index targetColumnIndex)
1768 static_assert(!isNonBasic,
1769 "For boundary or chain matrices, only additions with columns inside the matrix is allowed to maintain "
1770 "algebraic consistency.");
1772 matrix_.add_to(sourceColumn, targetColumnIndex);
1775template <
class PersistenceMatrixOptions>
1776template <
typename Index_type>
1778 Index_type sourceColumnIndex,
int coefficient, Index_type targetColumnIndex)
1782 matrix_.multiply_target_and_add_to(sourceColumnIndex, coefficient % 2, targetColumnIndex);
1784 matrix_.multiply_target_and_add_to(sourceColumnIndex, colSettings_->operators.get_value(coefficient), targetColumnIndex);
1788template <
class PersistenceMatrixOptions>
1789template <
class Cell_range>
1791 const Cell_range& sourceColumn,
int coefficient,
index targetColumnIndex)
1793 static_assert(!isNonBasic,
1794 "For boundary or chain matrices, only additions with columns inside the matrix is allowed to maintain "
1795 "algebraic consistency.");
1799 matrix_.multiply_target_and_add_to(sourceColumn, coefficient % 2, targetColumnIndex);
1801 matrix_.multiply_target_and_add_to(sourceColumn, colSettings_->operators.get_value(coefficient), targetColumnIndex);
1805template <
class PersistenceMatrixOptions>
1806template <
typename Index_type>
1808 int coefficient, Index_type sourceColumnIndex, Index_type targetColumnIndex)
1812 matrix_.multiply_source_and_add_to(coefficient % 2, sourceColumnIndex, targetColumnIndex);
1814 matrix_.multiply_source_and_add_to(colSettings_->operators.get_value(coefficient), sourceColumnIndex, targetColumnIndex);
1818template <
class PersistenceMatrixOptions>
1819template <
class Cell_range>
1821 int coefficient,
const Cell_range& sourceColumn,
index targetColumnIndex)
1823 static_assert(!isNonBasic,
1824 "For boundary or chain matrices, only additions with columns inside the matrix is allowed to maintain "
1825 "algebraic consistency.");
1829 matrix_.multiply_source_and_add_to(coefficient % 2, sourceColumn, targetColumnIndex);
1831 matrix_.multiply_source_and_add_to(colSettings_->operators.get_value(coefficient), sourceColumn, targetColumnIndex);
1835template <
class PersistenceMatrixOptions>
1839 "'zero_cell' is not available for the chosen options.");
1841 return matrix_.zero_cell(columnIndex, rowIndex);
1844template <
class PersistenceMatrixOptions>
1852 "Only enabled for RU matrices.");
1854 return matrix_.zero_cell(columnIndex, rowIndex, inR);
1857template <
class PersistenceMatrixOptions>
1861 "'zero_column' is not available for the chosen options.");
1863 return matrix_.zero_column(columnIndex);
1866template <
class PersistenceMatrixOptions>
1874 "Only enabled for RU matrices.");
1876 return matrix_.zero_column(columnIndex, inR);
1879template <
class PersistenceMatrixOptions>
1882 return matrix_.is_zero_cell(columnIndex, rowIndex);
1885template <
class PersistenceMatrixOptions>
1893 "Only enabled for RU matrices.");
1895 return matrix_.is_zero_cell(columnIndex, rowIndex, inR);
1898template <
class PersistenceMatrixOptions>
1901 return matrix_.is_zero_column(columnIndex);
1904template <
class PersistenceMatrixOptions>
1912 "Only enabled for RU matrices.");
1914 return matrix_.is_zero_column(columnIndex, inR);
1917template <
class PersistenceMatrixOptions>
1924 "'get_column_with_pivot' is not available for the chosen options.");
1926 return matrix_.get_column_with_pivot(faceIndex);
1929template <
class PersistenceMatrixOptions>
1933 static_assert(isNonBasic,
"'get_pivot' is not available for the chosen options.");
1935 return matrix_.get_pivot(columnIndex);
1938template <
class PersistenceMatrixOptions>
1941 swap(matrix_, other.matrix_);
1942 std::swap(colSettings_, other.colSettings_);
1947template <
class PersistenceMatrixOptions>
1950 return matrix_.print();
1953template <
class PersistenceMatrixOptions>
1959 return matrix_.get_current_barcode();
1962template <
class PersistenceMatrixOptions>
1970 "'get_current_barcode' is not const for boundary matrices as the barcode is only computed when explicitely "
1973 return matrix_.get_current_barcode();
1976template <
class PersistenceMatrixOptions>
1983 "This method was not enabled.");
1984 return matrix_.swap_columns(columnIndex1, columnIndex2);
1987template <
class PersistenceMatrixOptions>
1994 "This method was not enabled.");
1995 return matrix_.swap_rows(rowIndex1, rowIndex2);
1998template <
class PersistenceMatrixOptions>
2005 "This method was not enabled.");
2006 return matrix_.vine_swap_with_z_eq_1_case(
index);
2009template <
class PersistenceMatrixOptions>
2017 "This method was not enabled.");
2019 return matrix_.vine_swap_with_z_eq_1_case(columnIndex1, columnIndex2);
2022template <
class PersistenceMatrixOptions>
2029 "This method was not enabled.");
2030 return matrix_.vine_swap(
index);
2033template <
class PersistenceMatrixOptions>
2041 "This method was not enabled.");
2042 return matrix_.vine_swap(columnIndex1, columnIndex2);
2045template <
class PersistenceMatrixOptions>
2049 matrix_.update_representative_cycles();
2052template <
class PersistenceMatrixOptions>
2053inline const std::vector<typename Matrix<PersistenceMatrixOptions>::cycle_type>&
2057 return matrix_.get_representative_cycles();
2060template <
class PersistenceMatrixOptions>
2065 return matrix_.get_representative_cycle(bar);
2068template <
class PersistenceMatrixOptions>
2073 "Row access is not possible for heap columns.");
2075 "Vine update currently works only for Z_2 coefficients.");
2080 "Column compression not compatible with heap columns.");
Contains the Z2_field_operators class.
Contains the Base_matrix class.
Contains the Base_matrix_with_column_compression class.
Contains the Base_pairing class and Dummy_base_pairing structure.
Contains the Base_swap class and Dummy_base_swap structure.
Contains the Boundary_matrix class.
Contains the New_cell_constructor and Pool_cell_constructor structures.
Contains the Cell, Cell_column_index and Cell_field_element classes, as well as the Dummy_cell_column...
Contains the Chain_column_extra_properties class and Dummy_chain_properties structure.
Contains the Chain_matrix class.
Contains the Chain_pairing class and Dummy_chain_pairing structure.
Contains the Chain_representative_cycles class and Dummy_chain_representative_cycles structure.
Contains the Chain_barcode_swap and Chain_vine_swap classes, as well as the Dummy_chain_vine_swap and...
Class defining operators for the field.
Definition Z2_field_operators.h:32
A base matrix (also see Base_matrix), but with column compression. That is, all identical columns in ...
Definition base_matrix_with_column_compression.h:46
A basic matrix structure allowing to easily manipulate and access entire columns and rows,...
Definition base_matrix.h:39
Class managing the barcode for Boundary_matrix if the option was enabled.
Definition base_pairing.h:49
Class managing the column and row swaps in Base_matrix and Boundary_matrix.
Definition base_swap.h:48
Matrix structure to store the ordered boundary matrix of a filtered complex in order to compute its ...
Definition boundary_matrix.h:44
Matrix cell class. Stores by default only the row index it belongs to, but can also store its column ...
Definition cell_types.h:193
Class managing the pivot and partitioning of columns in Chain_matrix.
Definition chain_column_extra_properties.h:56
Matrix structure storing a compatible base of a filtered chain complex. See . The base is constructed...
Definition chain_matrix.h:50
Class managing the barcode for Chain_matrix if the option was enabled.
Definition chain_pairing.h:46
Class managing the representative cycles for Chain_matrix if the option was enabled.
Definition chain_rep_cycles.h:50
Class managing the vine swaps for Chain_matrix.
Definition chain_vine_swap.h:235
Column class following the PersistenceMatrixColumn concept. Not compatible with row access.
Definition heap_column.h:50
Overlay for non-basic matrices replacing all input and output MatIdx indices of the original methods ...
Definition overlay_ididx_to_matidx.h:42
Column class following the PersistenceMatrixColumn concept.
Definition intrusive_list_column.h:50
Column class following the PersistenceMatrixColumn concept.
Definition intrusive_set_column.h:51
Column class following the PersistenceMatrixColumn concept.
Definition list_column.h:51
Class managing the maximal dimension of a face represented in the inheritating matrix,...
Definition matrix_dimension_holders.h:115
Class managing the maximal dimension of a face represented in the inheritating matrix,...
Definition matrix_dimension_holders.h:53
Class managing the row access for the inheritating matrix.
Definition matrix_row_access.h:52
Data structure for matrices, and in particular thought for matrices representing filtered complexes i...
Definition matrix.h:143
bool is_zero_cell(index columnIndex, id_index rowIndex)
Indicates if the cell at given coordinates has value zero.
Definition matrix.h:1880
const cycle_type & get_representative_cycle(const Bar &bar)
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition matrix.h:2062
void zero_cell(index columnIndex, id_index rowIndex)
Zeroes the cell at the given coordinates. Not available for chain matrices and for base matrices with...
Definition matrix.h:1836
bool is_zero_column(index columnIndex)
Indicates if the column at given index has value zero.
Definition matrix.h:1899
bool vine_swap(pos_index index)
Only available if PersistenceMatrixOptions::has_vine_update is true and if it is either a boundary ma...
Definition matrix.h:2023
returned_column_type & get_column(index columnIndex)
Returns the column at the given MatIdx index. For RU matrices, is equivalent to get_column(columnInde...
Definition matrix.h:1609
void erase_empty_row(id_index rowIndex)
The effect varies depending on the matrices and the options:
Definition matrix.h:1680
const std::vector< cycle_type > & get_representative_cycles()
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition matrix.h:2054
std::vector< id_index > cycle_type
Type of a representative cycle. Vector of row indices.
Definition matrix.h:544
void swap_rows(index rowIndex1, index rowIndex2)
Only available for base matrices without column compression and simple boundary matrices (only storin...
Definition matrix.h:1988
id_index get_pivot(index columnIndex)
Returns the row index of the pivot of the given column. Only available for non-basic matrices.
Definition matrix.h:1930
void remove_maximal_face(index columnIndex)
Only available for RU and chain matrices and if PersistenceMatrixOptions::has_removable_columns and P...
Definition matrix.h:1690
typename PersistenceMatrixOptions::index_type pos_index
Definition matrix.h:148
dimension_type get_max_dimension() const
Returns the maximal dimension of a face stored in the matrix. Only available for non-basic matrices a...
Definition matrix.h:1732
typename std::conditional< PersistenceMatrixOptions::has_intrusive_rows, boost::intrusive::list< Cell_type, boost::intrusive::constant_time_size< false >, boost::intrusive::base_hook< base_hook_matrix_row > >, std::set< Cell_type, RowCellComp > >::type Row_type
Type of the rows stored in the matrix. Is either an intrusive list of Cell_type (not ordered) if Pers...
Definition matrix.h:281
typename std::conditional< hasFixedBarcode, std::vector< Bar >, typename std::conditional< PersistenceMatrixOptions::has_removable_columns, std::list< Bar >, std::vector< Bar > >::type >::type barcode_type
Type of the computed barcode. It is either a list of Matrix::Bar or a vector of Matrix::Bar,...
Definition matrix.h:450
returned_row_type & get_row(id_index rowIndex)
Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row ...
Definition matrix.h:1637
dimension_type get_column_dimension(index columnIndex) const
Returns the dimension of the given face. Only available for non-basic matrices.
Definition matrix.h:1747
typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::HEAP, Heap_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::LIST, List_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::SET, Set_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::UNORDERED_SET, Unordered_set_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::VECTOR, Vector_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::INTRUSIVE_LIST, Intrusive_list_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::NAIVE_VECTOR, Naive_vector_column_type, Intrusive_set_column_type >::type >::type >::type >::type >::type >::type >::type Column_type
Type of the columns stored in the matrix. The type depends on the value of PersistenceMatrixOptions::...
Definition matrix.h:370
typename PersistenceMatrixOptions::index_type index
Definition matrix.h:146
std::enable_if_t< std::is_integral_v< Index_type > > add_to(Index_type sourceColumnIndex, Index_type targetColumnIndex)
Adds column at sourceColumnIndex onto the column at targetColumnIndex in the matrix....
Definition matrix.h:1757
insertion_return_type 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....
Definition matrix.h:1572
std::enable_if_t< std::is_integral_v< Index_type > > multiply_target_and_add_to(Index_type sourceColumnIndex, int coefficient, Index_type targetColumnIndex)
Multiplies the target column with the coefficient and then adds the source column to it....
Definition matrix.h:1777
bool vine_swap_with_z_eq_1_case(pos_index index)
Only available if PersistenceMatrixOptions::has_vine_update is true and if it is either a bounary mat...
Definition matrix.h:1999
void insert_column(const Container_type &column)
Inserts a new ordered column at the end of the matrix by copying the given range of cell_rep_type....
Definition matrix.h:1538
const barcode_type & get_current_barcode()
Returns the current barcode of the matrix. Available only if PersistenceMatrixOptions::has_column_pai...
Definition matrix.h:1955
void set_characteristic(characteristic_type characteristic)
Sets the characteristic of the coefficient field if PersistenceMatrixOptions::is_z2 is false,...
Definition matrix.h:1524
void remove_last()
Removes the last inserted column/face from the matrix. If the matrix is non basic,...
Definition matrix.h:1718
static New_cell_constructor< Cell_type > defaultCellConstructor
Default cell constructor/destructor, using classic new and delete. For now, only used as default valu...
Definition matrix.h:241
Pool_cell_constructor< Cell_type > Cell_constructor
Cell constructor/destructor used by the matrix. Uses a pool of cells to accelerate memory management,...
Definition matrix.h:246
Matrix()
Default constructor. Initializes an empty matrix.
Definition matrix.h:1420
void zero_column(index columnIndex)
Zeroes the column at the given index. Not available for chain matrices and for base matrices with col...
Definition matrix.h:1858
index get_column_with_pivot(id_index faceIndex) const
Returns the MatIdx index of the column which has the given row index as pivot. Only available for RU ...
Definition matrix.h:1918
typename PersistenceMatrixOptions::index_type id_index
Definition matrix.h:147
void remove_column(index columnIndex)
Only available for base matrices without column compression and if PersistenceMatrixOptions::has_map_...
Definition matrix.h:1670
Matrix & operator=(Matrix other)
Assign operator.
Definition matrix.h:1939
std::enable_if_t< std::is_integral_v< Index_type > > multiply_source_and_add_to(int coefficient, Index_type sourceColumnIndex, Index_type targetColumnIndex)
Multiplies the source column with the coefficient before adding it to the target column....
Definition matrix.h:1807
friend void swap(Matrix &matrix1, Matrix &matrix2)
Swap operator for two matrices.
Definition matrix.h:1232
index get_number_of_columns() const
Returns the current number of columns in the matrix.
Definition matrix.h:1741
Cell< Matrix< PersistenceMatrixOptions > > Cell_type
Type of a matrix cell. See Cell for a more detailed description.
Definition matrix.h:234
typename std::conditional< PersistenceMatrixOptions::is_z2, Gudhi::persistence_fields::Z2_field_operators, typename PersistenceMatrixOptions::Field_coeff_operators >::type Field_operators
Coefficiants field type.
Definition matrix.h:158
typename PersistenceMatrixOptions::dimension_type dimension_type
Definition matrix.h:149
typename Field_operators::element_type element_type
Type of a field element.
Definition matrix.h:162
void update_representative_cycles()
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition matrix.h:2046
typename std::conditional< PersistenceMatrixOptions::is_z2, id_index, std::pair< id_index, element_type > >::type cell_rep_type
Type used to identify a cell, for exemple when inserting a boundary. If PersistenceMatrixOptions::is_...
Definition matrix.h:258
void swap_columns(index columnIndex1, index columnIndex2)
Only available for base matrices without column compression and simple boundary matrices (only storin...
Definition matrix.h:1977
Column class following the PersistenceMatrixColumn concept.
Definition naive_vector_column.h:51
Overlay for chain matrices replacing all input and output MatIdx indices of the original methods with...
Definition overlay_posidx_to_matidx.h:40
Matrix structure to store the ordered boundary matrix of a filtered complex in order to compute its ...
Definition ru_matrix.h:42
Class managing the barcode for RU_matrix if the option was enabled.
Definition ru_pairing.h:46
Class managing the representative cycles for RU_matrix if the option was enabled.
Definition ru_rep_cycles.h:50
Class managing the vine swaps for RU_matrix.
Definition ru_vine_swap.h:65
Class managing the row access for the columns.
Definition row_access.h:50
Column class following the PersistenceMatrixColumn concept.
Definition set_column.h:51
Column class following the PersistenceMatrixColumn concept.
Definition unordered_set_column.h:67
Column class following the PersistenceMatrixColumn concept.
Definition vector_column.h:53
Contains the Column_dimension_holder class and Dummy_dimension_holder structure.
@ POSITION
Definition persistence_matrix_options.h:51
@ CONTAINER
Definition persistence_matrix_options.h:50
@ IDENTIFIER
Definition persistence_matrix_options.h:52
@ INTRUSIVE_LIST
Definition persistence_matrix_options.h:39
@ INTRUSIVE_SET
Definition persistence_matrix_options.h:40
@ UNORDERED_SET
Definition persistence_matrix_options.h:38
@ LIST
Definition persistence_matrix_options.h:31
@ SET
Definition persistence_matrix_options.h:32
@ NAIVE_VECTOR
Definition persistence_matrix_options.h:37
@ VECTOR
Definition persistence_matrix_options.h:35
@ HEAP
Definition persistence_matrix_options.h:33
Contains the Heap_column class. Also defines the std::hash method for Heap_column.
Contains the Intrusive_list_column class. Also defines the std::hash method for Intrusive_list_column...
Contains the Intrusive_set_column class. Also defines the std::hash method for Intrusive_set_column.
Contains the List_column class. Also defines the std::hash method for List_column.
Contains the Matrix_max_dimension_holder Matrix_all_dimension_holder classes and the Dummy_matrix_dim...
Contains the Matrix_row_access class and Dummy_matrix_row_access structure.
Contains the Naive_vector_column class. Also defines the std::hash method for Naive_vector_column.
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
Contains the Id_to_index_overlay class.
Contains the Position_to_index_overlay class.
Contains the options for the matrix template.
Contains the Row_access class and Dummy_row_access structure.
Contains the RU_matrix class.
Contains the RU_pairing class and Dummy_ru_pairing structure.
Contains the RU_representative_cycles class and Dummy_ru_representative_cycles structure.
Contains the RU_vine_swap class, as well as the Dummy_ru_vine_swap and Dummy_ru_vine_pairing structur...
Contains the Set_column class. Also defines the std::hash method for Set_column.
Class managing the dimension access of a column.
Definition column_dimension_holder.h:50
Empty structure. Inheritated instead of Base_pairing, when the computation of the barcode was not ena...
Definition base_pairing.h:35
Empty structure. Inheritated instead of Base_swap, when the column and row swaps are not enabled.
Definition base_swap.h:32
Empty structure. Inheritated instead of Chain_pairing, when the computation of the barcode was not en...
Definition chain_pairing.h:32
Empty structure. Inheritated instead of Chain_column_extra_properties, when the columns are not meant...
Definition chain_column_extra_properties.h:33
Empty structure. Inheritated instead of Chain_representative_cycles, when the computation of the repr...
Definition chain_rep_cycles.h:34
Empty structure. Inheritated instead of Chain_vine_swap, when vine swappes are not enabled.
Definition chain_vine_swap.h:53
Empty structure. Inheritated instead of Column_dimension_holder, when the columns are not storing a d...
Definition column_dimension_holder.h:32
Empty structure. Inheritated instead of Matrix_max_dimension_holder or Matrix_all_dimension_holder,...
Definition matrix_dimension_holders.h:34
Empty structure. Inheritated instead of Matrix_row_access, when the the row access is not enabled.
Definition matrix_row_access.h:31
Empty structure. Inheritated instead of Row_access, if the row access is not enabled.
Definition row_access.h:32
Empty structure. Inheritated instead of RU_pairing, when the computation of the barcode was not enabl...
Definition ru_pairing.h:32
Empty structure. Inheritated instead of RU_representative_cycles, when the computation of the represe...
Definition ru_rep_cycles.h:34
Empty structure. Inheritated instead of RU_vine_swap, when vine swappes are not enabled.
Definition ru_vine_swap.h:38
Type for a bar in the computed barcode. Stores the birth, death and dimension of the bar.
Definition matrix.h:169
dimension_type dim
Definition matrix.h:174
pos_index birth
Definition matrix.h:175
pos_index death
Definition matrix.h:176
Compaires two cells by their position in the row. They are assume to be in the same row.
Definition matrix.h:263
Cell factory. Constructs and destroyes cell pointers with new and delete.
Definition cell_constructors.h:36
Concept of the template parameter for the class Matrix.
Definition PersistenceMatrixOptions.h:32
unspecified dimension_type
Type for the dimension. Has to be an integer type. If unsigned, the maximal value of the type should ...
Definition PersistenceMatrixOptions.h:42
static const Column_indexation_types column_indexation_type
Specifies the desired indexation scheme to access the methods of the matrix. See matrix description a...
Definition PersistenceMatrixOptions.h:66
static const Column_types column_type
Specifies the desired column type. All possible column types are described in Column_types.
Definition PersistenceMatrixOptions.h:60
unspecified index_type
Type for the different indexation types and should be able to contain the maximal number of columns o...
Definition PersistenceMatrixOptions.h:48
static const bool has_matrix_maximal_dimension_access
Only enabled for boundary and chain matrices, i.e., when at least one of the following is true: has_c...
Definition PersistenceMatrixOptions.h:142
static const bool has_map_column_container
If set to true, the underlying container containing the matrix columns is an std::unordered_map....
Definition PersistenceMatrixOptions.h:101
static const bool has_column_compression
Only enabled for base matrices (i.e., none of the following is true: has_column_pairings,...
Definition PersistenceMatrixOptions.h:83
static const bool has_row_access
If set to true, enables the method Matrix::get_row.
Definition PersistenceMatrixOptions.h:111
static const bool can_retrieve_representative_cycles
If set to true, enables the methods Matrix::update_representative_cycles and Matrix::get_representati...
Definition PersistenceMatrixOptions.h:161
static const bool has_removable_rows
Only enabled if has_row_access is true, ignored otherwise. If set to true, the underlying container c...
Definition PersistenceMatrixOptions.h:124
static const bool has_column_and_row_swaps
Only enabled for base matrices or simple boundary matrices, i.e., when both has_vine_update and can_r...
Definition PersistenceMatrixOptions.h:89
static const bool is_z2
If true, indicates that the values contained in the matrix are in and can therefore be treated like ...
Definition PersistenceMatrixOptions.h:56
static const bool has_column_pairings
If set to true, enables the method Matrix::get_current_barcode. The matrix will then either be a boun...
Definition PersistenceMatrixOptions.h:148
unspecified Field_coeff_operators
Field operators. Has to follow the FieldOperators concept. The type will not be used if is_z2 is set ...
Definition PersistenceMatrixOptions.h:37
static const bool has_vine_update
If set to true, enables the methods Matrix::vine_swap and Matrix::vine_swap_with_z_eq_1_case....
Definition PersistenceMatrixOptions.h:154
static const bool is_of_boundary_type
Only used, when at least one of the following is true: has_column_pairings, has_vine_update or can_re...
Definition PersistenceMatrixOptions.h:132
static const bool has_removable_columns
If set to true, enables the methods Matrix::remove_maximal_face and Matrix::remove_last,...
Definition PersistenceMatrixOptions.h:106
static const bool has_intrusive_rows
Only enabled if has_row_access is true, ignored otherwise. If set to true, the underlying container r...
Definition PersistenceMatrixOptions.h:117
Contains the Unordered_set_column class. Also defines the std::hash method for Unordered_set_column.
Contains the Vector_column class. Also defines the std::hash method for Vector_column.