Id_to_index_overlay.h
Go to the documentation of this file.
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Hannah Schreiber
4 *
5 * Copyright (C) 2022-24 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
17#ifndef PM_ID_TO_POS_TRANSLATION_H
18#define PM_ID_TO_POS_TRANSLATION_H
19
20#include <cmath>
21#include <vector>
22#include <cassert>
23#include <utility> //std::swap, std::move & std::exchange
24#include <algorithm> //std::transform
25#include <stdexcept> //std::invalid_argument
26
27namespace Gudhi {
28namespace persistence_matrix {
29
40template <class Underlying_matrix, class Master_matrix>
42{
43 public:
44 using Index = typename Master_matrix::Index;
45 using ID_index = typename Master_matrix::ID_index;
46 using Pos_index = typename Master_matrix::Pos_index;
47 using Dimension = typename Master_matrix::Dimension;
51 using Field_operators = typename Master_matrix::Field_operators;
52 using Field_element = typename Master_matrix::Element;
53 using Boundary = typename Master_matrix::Boundary;
54 using Column = typename Master_matrix::Column;
55 using Row = typename Master_matrix::Row;
57 using Bar = typename Master_matrix::Bar;
58 using Barcode = typename Master_matrix::Barcode;
59 using Cycle = typename Master_matrix::Cycle;
60 using Entry_constructor = typename Master_matrix::Entry_constructor;
61 using Column_settings = typename Master_matrix::Column_settings;
92 template <class Boundary_range = Boundary>
93 Id_to_index_overlay(const std::vector<Boundary_range>& orderedBoundaries,
94 Column_settings* colSettings);
102 Id_to_index_overlay(unsigned int numberOfColumns, Column_settings* colSettings);
125 template <typename BirthComparatorFunction, typename DeathComparatorFunction>
127 const BirthComparatorFunction& birthComparator,
128 const DeathComparatorFunction& deathComparator);
165 template <typename BirthComparatorFunction, typename DeathComparatorFunction, class Boundary_range>
166 Id_to_index_overlay(const std::vector<Boundary_range>& orderedBoundaries,
167 Column_settings* colSettings,
168 const BirthComparatorFunction& birthComparator,
169 const DeathComparatorFunction& deathComparator);
193 template <typename BirthComparatorFunction, typename DeathComparatorFunction>
194 Id_to_index_overlay(unsigned int numberOfColumns,
195 Column_settings* colSettings,
196 const BirthComparatorFunction& birthComparator,
197 const DeathComparatorFunction& deathComparator);
207 Id_to_index_overlay(const Id_to_index_overlay& matrixToCopy,
208 Column_settings* colSettings = nullptr);
219
247 template <class Boundary_range = Boundary>
248 void insert_boundary(const Boundary_range& boundary,
249 Dimension dim = Master_matrix::template get_null_value<Dimension>());
267 template <class Boundary_range = Boundary>
268 void insert_boundary(ID_index cellIndex, const Boundary_range& boundary,
269 Dimension dim = Master_matrix::template get_null_value<Dimension>());
278 Column& get_column(ID_index cellID);
293 Row& get_row(ID_index rowIndex);
318 void erase_empty_row(ID_index rowIndex);
338 void remove_maximal_cell(ID_index cellID);
362 void remove_maximal_cell(ID_index cellID, const std::vector<ID_index>& columnsToSwap);
377 void remove_last();
378
399
410 void add_to(ID_index sourceCellID, ID_index targetCellID);
423 void multiply_target_and_add_to(ID_index sourceCellID, const Field_element& coefficient, ID_index targetCellID);
436 void multiply_source_and_add_to(const Field_element& coefficient, ID_index sourceCellID, ID_index targetCellID);
437
448 void zero_entry(ID_index cellID, ID_index rowIndex);
458 void zero_column(ID_index cellID);
469 bool is_zero_entry(ID_index cellID, ID_index rowIndex) const;
482 bool is_zero_column(ID_index cellID);
483
495 ID_index get_column_with_pivot(ID_index cellIndex) const;
503
510 void reset(Column_settings* colSettings) {
511 matrix_.reset(colSettings);
512 nextIndex_ = 0;
513 }
514
515 // void set_operators(Field_operators* operators) { matrix_.set_operators(operators); }
516
524 friend void swap(Id_to_index_overlay& matrix1, Id_to_index_overlay& matrix2) {
525 swap(matrix1.matrix_, matrix2.matrix_);
526 if (Master_matrix::Option_list::is_of_boundary_type) std::swap(matrix1.idToIndex_, matrix2.idToIndex_);
527 std::swap(matrix1.nextIndex_, matrix2.nextIndex_);
528 }
529
530 void print(); // for debug
531
532 // access to optional methods
533
547
557 void swap_columns(ID_index cellID1, ID_index cellID2);
567 void swap_rows(Index rowIndex1, Index rowIndex2);
595 ID_index vine_swap(ID_index cellID1, ID_index cellID2);
596
611 const std::vector<Cycle>& get_representative_cycles();
619 const Cycle& get_representative_cycle(const Bar& bar);
620
621 private:
622 using Dictionary = typename Master_matrix::template Dictionary<Index>;
623
624 Underlying_matrix matrix_;
625 Dictionary* idToIndex_;
626 Index nextIndex_;
628 void _initialize_map(unsigned int size);
629 Index _id_to_index(ID_index id) const;
630 Index& _id_to_index(ID_index id);
631};
632
633template <class Underlying_matrix, class Master_matrix>
635 : matrix_(colSettings), idToIndex_(nullptr), nextIndex_(0)
636{
637 _initialize_map(0);
638}
639
640template <class Underlying_matrix, class Master_matrix>
641template <class Boundary_range>
643 const std::vector<Boundary_range>& orderedBoundaries, Column_settings* colSettings)
644 : matrix_(orderedBoundaries, colSettings), idToIndex_(nullptr), nextIndex_(orderedBoundaries.size())
645{
646 _initialize_map(orderedBoundaries.size());
647 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
648 for (unsigned int i = 0; i < orderedBoundaries.size(); i++) {
649 _id_to_index(i) = i;
650 }
651 }
652}
653
654template <class Underlying_matrix, class Master_matrix>
656 Column_settings* colSettings)
657 : matrix_(numberOfColumns, colSettings), idToIndex_(nullptr), nextIndex_(0)
658{
659 _initialize_map(numberOfColumns);
660}
661
662template <class Underlying_matrix, class Master_matrix>
663template <typename BirthComparatorFunction, typename DeathComparatorFunction>
665 Column_settings* colSettings,
666 const BirthComparatorFunction& birthComparator,
667 const DeathComparatorFunction& deathComparator)
668 : matrix_(colSettings, birthComparator, deathComparator), idToIndex_(nullptr), nextIndex_(0)
669{
670 _initialize_map(0);
671}
672
673template <class Underlying_matrix, class Master_matrix>
674template <typename BirthComparatorFunction, typename DeathComparatorFunction, class Boundary_range>
676 const std::vector<Boundary_range>& orderedBoundaries,
677 Column_settings* colSettings,
678 const BirthComparatorFunction& birthComparator,
679 const DeathComparatorFunction& deathComparator)
680 : matrix_(orderedBoundaries, colSettings, birthComparator, deathComparator),
681 idToIndex_(nullptr),
682 nextIndex_(orderedBoundaries.size())
683{
684 _initialize_map(orderedBoundaries.size());
685 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
686 for (unsigned int i = 0; i < orderedBoundaries.size(); i++) {
687 _id_to_index(i) = i;
688 }
689 }
690}
691
692template <class Underlying_matrix, class Master_matrix>
693template <typename BirthComparatorFunction, typename DeathComparatorFunction>
695 unsigned int numberOfColumns,
696 Column_settings* colSettings,
697 const BirthComparatorFunction& birthComparator,
698 const DeathComparatorFunction& deathComparator)
699 : matrix_(numberOfColumns, colSettings, birthComparator, deathComparator),
700 idToIndex_(nullptr),
701 nextIndex_(0)
702{
703 _initialize_map(numberOfColumns);
704}
705
706template <class Underlying_matrix, class Master_matrix>
708 const Id_to_index_overlay& matrixToCopy, Column_settings* colSettings)
709 : matrix_(matrixToCopy.matrix_, colSettings),
710 idToIndex_(nullptr),
711 nextIndex_(matrixToCopy.nextIndex_)
712{
713 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
714 idToIndex_ = new Dictionary(*matrixToCopy.idToIndex_);
715 } else {
716 idToIndex_ = &matrix_.pivotToColumnIndex_;
717 }
718}
719
720template <class Underlying_matrix, class Master_matrix>
722 : matrix_(std::move(other.matrix_)),
723 idToIndex_(std::exchange(other.idToIndex_, nullptr)),
724 nextIndex_(std::exchange(other.nextIndex_, 0))
725{}
726
727template <class Underlying_matrix, class Master_matrix>
729{
730 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
731 if (idToIndex_ != nullptr) delete idToIndex_;
732 }
733}
734
735template <class Underlying_matrix, class Master_matrix>
736template <class Boundary_range>
738 Dimension dim)
739{
740 matrix_.insert_boundary(boundary, dim);
741 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
742 if constexpr (Master_matrix::Option_list::has_map_column_container) {
743 idToIndex_->emplace(nextIndex_, nextIndex_);
744 } else {
745 if (idToIndex_->size() == nextIndex_) {
746 idToIndex_->push_back(nextIndex_);
747 } else {
748 _id_to_index(nextIndex_) = nextIndex_;
749 }
750 }
751 ++nextIndex_;
752 }
753}
754
755template <class Underlying_matrix, class Master_matrix>
756template <class Boundary_range>
758 const Boundary_range& boundary,
759 Dimension dim)
760{
761 if constexpr (Master_matrix::Option_list::has_map_column_container) {
762 GUDHI_CHECK(idToIndex_->find(cellIndex) == idToIndex_->end(),
763 std::invalid_argument("Id_to_index_overlay::insert_boundary - Index for simplex already chosen!"));
764 } else {
765 GUDHI_CHECK(
766 (idToIndex_->size() <= cellIndex || _id_to_index(cellIndex) == Master_matrix::template get_null_value<Index>()),
767 std::invalid_argument("Id_to_index_overlay::insert_boundary - Index for simplex already chosen!"));
768 }
769 matrix_.insert_boundary(cellIndex, boundary, dim);
770 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
771 if constexpr (Master_matrix::Option_list::has_map_column_container) {
772 idToIndex_->emplace(cellIndex, nextIndex_);
773 } else {
774 if (idToIndex_->size() <= cellIndex) {
775 idToIndex_->resize(cellIndex + 1, Master_matrix::template get_null_value<Index>());
776 }
777 _id_to_index(cellIndex) = nextIndex_;
778 }
779 ++nextIndex_;
780 }
781}
782
783template <class Underlying_matrix, class Master_matrix>
786{
787 return matrix_.get_column(_id_to_index(cellID));
788}
789
790template <class Underlying_matrix, class Master_matrix>
793{
794 return matrix_.get_row(rowIndex);
795}
796
797template <class Underlying_matrix, class Master_matrix>
799{
800 return matrix_.erase_empty_row(rowIndex);
801}
802
803template <class Underlying_matrix, class Master_matrix>
805{
806 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
807 std::vector<ID_index> indexToID(nextIndex_);
808 if constexpr (Master_matrix::Option_list::has_map_column_container) {
809 for (auto& p : *idToIndex_) {
810 indexToID[p.second] = p.first;
811 }
812 } else {
813 for (ID_index i = 0; i < idToIndex_->size(); ++i) {
814 if (_id_to_index(i) != Master_matrix::template get_null_value<Index>()) indexToID[_id_to_index(i)] = i;
815 }
816 }
817 --nextIndex_;
818 for (Index curr = _id_to_index(cellID); curr < nextIndex_; ++curr) {
819 matrix_.vine_swap(curr);
820 std::swap(idToIndex_->at(indexToID[curr]), idToIndex_->at(indexToID[curr + 1]));
821 }
822 matrix_.remove_last();
823 GUDHI_CHECK(_id_to_index(cellID) == nextIndex_,
824 std::logic_error("Id_to_index_overlay::remove_maximal_cell - Indexation problem."));
825
826 if constexpr (Master_matrix::Option_list::has_map_column_container) {
827 idToIndex_->erase(cellID);
828 } else {
829 _id_to_index(cellID) = Master_matrix::template get_null_value<Index>();
830 }
831 } else {
832 matrix_.remove_maximal_cell(cellID);
833 }
834}
835
836template <class Underlying_matrix, class Master_matrix>
838 ID_index cellID, const std::vector<ID_index>& columnsToSwap)
839{
840 static_assert(!Master_matrix::Option_list::is_of_boundary_type,
841 "'remove_maximal_cell(ID_index,const std::vector<Index>&)' is not available for the chosen options.");
842 std::vector<Index> translatedIndices;
843 std::transform(columnsToSwap.cbegin(), columnsToSwap.cend(), std::back_inserter(translatedIndices),
844 [&](ID_index id) { return _id_to_index(id); });
845 matrix_.remove_maximal_cell(cellID, translatedIndices);
846}
847
848template <class Underlying_matrix, class Master_matrix>
850{
851 if (idToIndex_->empty()) return; //empty matrix
852
853 matrix_.remove_last();
854
855 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
856 --nextIndex_;
857 if constexpr (Master_matrix::Option_list::has_map_column_container) {
858 auto it = idToIndex_->begin();
859 while (it->second != nextIndex_) ++it; //should never reach idToIndex_->end()
860 idToIndex_->erase(it);
861 } else {
862 Index id = idToIndex_->size() - 1;
863 // should always stop before reaching -1
864 while (_id_to_index(id) == Master_matrix::template get_null_value<Index>()) --id;
865 GUDHI_CHECK(_id_to_index(id) == nextIndex_,
866 std::logic_error("Id_to_index_overlay::remove_last - Indexation problem."));
867 _id_to_index(id) = Master_matrix::template get_null_value<Index>();
868 }
869 }
870}
871
872template <class Underlying_matrix, class Master_matrix>
875{
876 return matrix_.get_max_dimension();
877}
878
879template <class Underlying_matrix, class Master_matrix>
882{
883 return matrix_.get_number_of_columns();
884}
885
886template <class Underlying_matrix, class Master_matrix>
889{
890 return matrix_.get_column_dimension(_id_to_index(cellID));
891}
892
893template <class Underlying_matrix, class Master_matrix>
895{
896 return matrix_.add_to(_id_to_index(sourceCellID), _id_to_index(targetCellID));
897}
898
899template <class Underlying_matrix, class Master_matrix>
901 ID_index sourceCellID, const Field_element& coefficient, ID_index targetCellID)
902{
903 return matrix_.multiply_target_and_add_to(_id_to_index(sourceCellID), coefficient, _id_to_index(targetCellID));
904}
905
906template <class Underlying_matrix, class Master_matrix>
908 const Field_element& coefficient, ID_index sourceCellID, ID_index targetCellID)
909{
910 return matrix_.multiply_source_and_add_to(coefficient, _id_to_index(sourceCellID), _id_to_index(targetCellID));
911}
912
913template <class Underlying_matrix, class Master_matrix>
915{
916 return matrix_.zero_entry(_id_to_index(cellID), rowIndex);
917}
918
919template <class Underlying_matrix, class Master_matrix>
921{
922 return matrix_.zero_column(_id_to_index(cellID));
923}
924
925template <class Underlying_matrix, class Master_matrix>
927 ID_index rowIndex) const
928{
929 return matrix_.is_zero_entry(_id_to_index(cellID), rowIndex);
930}
931
932template <class Underlying_matrix, class Master_matrix>
934{
935 return matrix_.is_zero_column(_id_to_index(cellID));
936}
937
938template <class Underlying_matrix, class Master_matrix>
941{
942 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
943 Index pos = matrix_.get_column_with_pivot(simplexIndex);
944 ID_index i = 0;
945 while (_id_to_index(i) != pos) ++i;
946 return i;
947 } else {
948 return simplexIndex;
949 }
950}
951
952template <class Underlying_matrix, class Master_matrix>
955{
956 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
957 return matrix_.get_pivot(_id_to_index(cellID));
958 } else {
959 return cellID;
960 }
961}
962
963template <class Underlying_matrix, class Master_matrix>
966{
967 matrix_ = other.matrix_;
968 if (Master_matrix::Option_list::is_of_boundary_type)
969 idToIndex_ = other.idToIndex_;
970 else
971 idToIndex_ = &matrix_.pivotToColumnIndex_;
972 nextIndex_ = other.nextIndex_;
973
974 return *this;
975}
976
977template <class Underlying_matrix, class Master_matrix>
979{
980 return matrix_.print();
981}
982
983template <class Underlying_matrix, class Master_matrix>
986{
987 return matrix_.get_current_barcode();
988}
989
990template <class Underlying_matrix, class Master_matrix>
992{
993 matrix_.update_representative_cycles();
994}
995
996template <class Underlying_matrix, class Master_matrix>
997inline const std::vector<typename Id_to_index_overlay<Underlying_matrix, Master_matrix>::Cycle>&
999{
1000 return matrix_.get_representative_cycles();
1001}
1002
1003template <class Underlying_matrix, class Master_matrix>
1006{
1007 return matrix_.get_representative_cycle(bar);
1008}
1009
1010template <class Underlying_matrix, class Master_matrix>
1012{
1013 matrix_.swap_columns(_id_to_index(cellID1), _id_to_index(cellID2));
1014 std::swap(idToIndex_->at(cellID1), idToIndex_->at(cellID2));
1015}
1016
1017template <class Underlying_matrix, class Master_matrix>
1019{
1020 matrix_.swap_rows(rowIndex1, rowIndex2);
1021}
1022
1023template <class Underlying_matrix, class Master_matrix>
1026{
1027 Index first = _id_to_index(cellID1);
1028 Index second = _id_to_index(cellID2);
1029 if (first > second) std::swap(first, second);
1030
1031 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
1032 GUDHI_CHECK(second - first == 1,
1033 std::invalid_argument(
1034 "Id_to_index_overlay::vine_swap_with_z_eq_1_case - The columns to swap are not contiguous."));
1035
1036 bool change = matrix_.vine_swap_with_z_eq_1_case(first);
1037
1038 std::swap(idToIndex_->at(cellID1), idToIndex_->at(cellID2));
1039
1040 if (change) {
1041 return cellID1;
1042 }
1043 return cellID2;
1044 } else {
1045 return matrix_.vine_swap_with_z_eq_1_case(first, second);
1046 }
1047}
1048
1049template <class Underlying_matrix, class Master_matrix>
1052{
1053 Index first = _id_to_index(cellID1);
1054 Index second = _id_to_index(cellID2);
1055 if (first > second) std::swap(first, second);
1056
1057 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
1058 GUDHI_CHECK(second - first == 1,
1059 std::invalid_argument("Id_to_index_overlay::vine_swap - The columns to swap are not contiguous."));
1060
1061 bool change = matrix_.vine_swap(first);
1062
1063 std::swap(idToIndex_->at(cellID1), idToIndex_->at(cellID2));
1064
1065 if (change) {
1066 return cellID1;
1067 }
1068 return cellID2;
1069 } else {
1070 return matrix_.vine_swap(first, second);
1071 }
1072}
1073
1074template <class Underlying_matrix, class Master_matrix>
1075inline void Id_to_index_overlay<Underlying_matrix, Master_matrix>::_initialize_map([[maybe_unused]] unsigned int size)
1076{
1077 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
1078 if constexpr (Master_matrix::Option_list::has_map_column_container) {
1079 idToIndex_ = new Dictionary(size);
1080 } else {
1081 idToIndex_ = new Dictionary(size, Master_matrix::template get_null_value<Index>());
1082 }
1083 } else {
1084 idToIndex_ = &matrix_.pivotToColumnIndex_;
1085 }
1086}
1087
1088template <class Underlying_matrix, class Master_matrix>
1090Id_to_index_overlay<Underlying_matrix, Master_matrix>::_id_to_index(ID_index id) const
1091{
1092 if constexpr (Master_matrix::Option_list::has_map_column_container) {
1093 return idToIndex_->at(id);
1094 } else {
1095 return idToIndex_->operator[](id);
1096 }
1097}
1098
1099template <class Underlying_matrix, class Master_matrix>
1101Id_to_index_overlay<Underlying_matrix, Master_matrix>::_id_to_index(ID_index id)
1102{
1103 return idToIndex_->operator[](id); //for maps, the entry is created if not existing as needed in the constructors
1104}
1105
1106} // namespace persistence_matrix
1107} // namespace Gudhi
1108
1109#endif // PM_ID_TO_POS_TRANSLATION_H
Overlay for non-basic matrices replacing all input and output MatIdx indices of the original methods ...
Definition: Id_to_index_overlay.h:42
Id_to_index_overlay(Column_settings *colSettings)
Constructs an empty matrix.
Definition: Id_to_index_overlay.h:634
bool is_zero_column(ID_index cellID)
Indicates if the column at given index has value zero.
Definition: Id_to_index_overlay.h:933
void update_representative_cycles()
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition: Id_to_index_overlay.h:991
void remove_maximal_cell(ID_index cellID)
Only available for RU and chain matrices and if PersistenceMatrixOptions::has_removable_columns and P...
Definition: Id_to_index_overlay.h:804
friend void swap(Id_to_index_overlay &matrix1, Id_to_index_overlay &matrix2)
Swap operator.
Definition: Id_to_index_overlay.h:524
Id_to_index_overlay & operator=(const Id_to_index_overlay &other)
Assign operator.
Definition: Id_to_index_overlay.h:965
Dimension get_max_dimension() const
Returns the maximal dimension of a cell stored in the matrix. Only available if PersistenceMatrixOpti...
Definition: Id_to_index_overlay.h:874
void add_to(ID_index sourceCellID, ID_index targetCellID)
Adds column corresponding to sourceCellID onto the column corresponding to targetCellID.
Definition: Id_to_index_overlay.h:894
ID_index get_pivot(ID_index cellID)
Returns the row index of the pivot of the given column.
Definition: Id_to_index_overlay.h:954
typename Master_matrix::Row Row
Definition: Id_to_index_overlay.h:56
void remove_last()
Only available if PersistenceMatrixOptions::has_removable_columns is true. Additionally,...
Definition: Id_to_index_overlay.h:849
void multiply_target_and_add_to(ID_index sourceCellID, const Field_element &coefficient, ID_index targetCellID)
Multiplies the target column with the coefficient and then adds the source column to it....
Definition: Id_to_index_overlay.h:900
void reset(Column_settings *colSettings)
Resets the matrix to an empty matrix.
Definition: Id_to_index_overlay.h:510
void zero_column(ID_index cellID)
Zeroes the column at the given index. Not available for chain matrices. In general,...
Definition: Id_to_index_overlay.h:920
typename Master_matrix::Index Index
Definition: Id_to_index_overlay.h:44
void multiply_source_and_add_to(const Field_element &coefficient, ID_index sourceCellID, ID_index targetCellID)
Multiplies the source column with the coefficient before adding it to the target column....
Definition: Id_to_index_overlay.h:907
const Barcode & get_current_barcode()
Returns the current barcode of the matrix. Available only if PersistenceMatrixOptions::has_column_pai...
Definition: Id_to_index_overlay.h:985
typename Master_matrix::Column Column
Definition: Id_to_index_overlay.h:54
typename Master_matrix::Bar Bar
Definition: Id_to_index_overlay.h:57
ID_index get_column_with_pivot(ID_index cellIndex) const
Returns the IDIdx index of the column which has the given row index as pivot. Assumes that the pivot ...
Definition: Id_to_index_overlay.h:940
void insert_boundary(const Boundary_range &boundary, Dimension dim=Master_matrix::template get_null_value< Dimension >())
Inserts at the end of the matrix a new ordered column corresponding to the given boundary....
Definition: Id_to_index_overlay.h:737
void erase_empty_row(ID_index rowIndex)
The effect varies depending on the matrices and the options:
Definition: Id_to_index_overlay.h:798
Column & get_column(ID_index cellID)
Returns the column at the given IDIdx index. For RU matrices, the returned column is from ....
Definition: Id_to_index_overlay.h:785
typename Master_matrix::Boundary Boundary
Definition: Id_to_index_overlay.h:53
Row & get_row(ID_index rowIndex)
Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row ...
Definition: Id_to_index_overlay.h:792
ID_index vine_swap_with_z_eq_1_case(ID_index cellID1, ID_index cellID2)
Only available if PersistenceMatrixOptions::has_vine_update is true. Does the same than vine_swap,...
Definition: Id_to_index_overlay.h:1025
const Cycle & get_representative_cycle(const Bar &bar)
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition: Id_to_index_overlay.h:1005
typename Master_matrix::Cycle Cycle
Definition: Id_to_index_overlay.h:59
bool is_zero_entry(ID_index cellID, ID_index rowIndex) const
Indicates if the entry at given coordinates has value zero.
Definition: Id_to_index_overlay.h:926
typename Master_matrix::Barcode Barcode
Definition: Id_to_index_overlay.h:58
typename Master_matrix::Entry_constructor Entry_constructor
Definition: Id_to_index_overlay.h:60
typename Master_matrix::Dimension Dimension
Definition: Id_to_index_overlay.h:47
~Id_to_index_overlay()
Destructor.
Definition: Id_to_index_overlay.h:728
void swap_columns(ID_index cellID1, ID_index cellID2)
Only available for simple boundary matrices (only storing ) and if PersistenceMatrixOptions::has_colu...
Definition: Id_to_index_overlay.h:1011
typename Master_matrix::Field_operators Field_operators
Field operators class. Necessary only if PersistenceMatrixOptions::is_z2 is false.
Definition: Id_to_index_overlay.h:51
typename Master_matrix::Column_settings Column_settings
Definition: Id_to_index_overlay.h:62
void swap_rows(Index rowIndex1, Index rowIndex2)
Only available for simple boundary matrices (only storing R) and if PersistenceMatrixOptions::has_col...
Definition: Id_to_index_overlay.h:1018
ID_index vine_swap(ID_index cellID1, ID_index cellID2)
Only available if PersistenceMatrixOptions::has_vine_update is true. Does a vine swap between two cel...
Definition: Id_to_index_overlay.h:1051
typename Master_matrix::Pos_index Pos_index
Definition: Id_to_index_overlay.h:46
void zero_entry(ID_index cellID, ID_index rowIndex)
Zeroes the entry at the given coordinates. Not available for chain matrices. In general,...
Definition: Id_to_index_overlay.h:914
Index get_number_of_columns() const
Returns the current number of columns in the matrix.
Definition: Id_to_index_overlay.h:881
const std::vector< Cycle > & get_representative_cycles()
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition: Id_to_index_overlay.h:998
Dimension get_column_dimension(ID_index cellID) const
Returns the dimension of the given cell. Only available for non-basic matrices.
Definition: Id_to_index_overlay.h:888
typename Master_matrix::ID_index ID_index
Definition: Id_to_index_overlay.h:45
typename Master_matrix::Element Field_element
Definition: Id_to_index_overlay.h:52
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14