Loading...
Searching...
No Matches
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 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
16
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;
63
92 template <class Boundary_range = Boundary>
93 Id_to_index_overlay(const std::vector<Boundary_range>& orderedBoundaries, Column_settings* colSettings);
101 Id_to_index_overlay(unsigned int numberOfColumns, Column_settings* colSettings);
124 template <typename BirthComparatorFunction, typename DeathComparatorFunction>
126 const BirthComparatorFunction& birthComparator,
127 const DeathComparatorFunction& deathComparator);
164 template <typename BirthComparatorFunction, typename DeathComparatorFunction, class Boundary_range>
165 Id_to_index_overlay(const std::vector<Boundary_range>& orderedBoundaries,
166 Column_settings* colSettings,
167 const BirthComparatorFunction& birthComparator,
168 const DeathComparatorFunction& deathComparator);
192 template <typename BirthComparatorFunction, typename DeathComparatorFunction>
193 Id_to_index_overlay(unsigned int numberOfColumns,
194 Column_settings* colSettings,
195 const BirthComparatorFunction& birthComparator,
196 const DeathComparatorFunction& deathComparator);
206 Id_to_index_overlay(const Id_to_index_overlay& matrixToCopy, Column_settings* colSettings = nullptr);
217
245 template <class Boundary_range = Boundary>
246 void insert_boundary(const Boundary_range& boundary,
247 Dimension dim = Master_matrix::template get_null_value<Dimension>());
265 template <class Boundary_range = Boundary>
266 void insert_boundary(ID_index cellIndex,
267 const Boundary_range& boundary,
268 Dimension dim = Master_matrix::template get_null_value<Dimension>());
277 Column& get_column(ID_index cellID);
292 Row& get_row(ID_index rowIndex);
317 void erase_empty_row(ID_index rowIndex);
337 void remove_maximal_cell(ID_index cellID);
361 void remove_maximal_cell(ID_index cellID, const std::vector<ID_index>& columnsToSwap);
376 void remove_last();
377
398
409 void add_to(ID_index sourceCellID, ID_index targetCellID);
422 void multiply_target_and_add_to(ID_index sourceCellID, const Field_element& coefficient, ID_index targetCellID);
435 void multiply_source_and_add_to(const Field_element& coefficient, ID_index sourceCellID, ID_index targetCellID);
436
447 void zero_entry(ID_index cellID, ID_index rowIndex);
457 void zero_column(ID_index cellID);
468 bool is_zero_entry(ID_index cellID, ID_index rowIndex) const;
481 bool is_zero_column(ID_index cellID);
482
494 ID_index get_column_with_pivot(ID_index cellIndex) const;
502
509 void reset(Column_settings* colSettings)
510 {
511 matrix_.reset(colSettings);
512 if constexpr (Master_matrix::Option_list::is_of_boundary_type)
513 if (idToIndex_ != nullptr) idToIndex_->clear();
514 nextIndex_ = 0;
515 }
516
525
529 friend void swap(Id_to_index_overlay& matrix1, Id_to_index_overlay& matrix2) noexcept
530 {
531 swap(matrix1.matrix_, matrix2.matrix_);
532 std::swap(matrix1.idToIndex_, matrix2.idToIndex_);
533 std::swap(matrix1.nextIndex_, matrix2.nextIndex_);
534 }
535
536 void print(); // for debug
537
538 // access to optional methods
539
553
563 void swap_columns(ID_index cellID1, ID_index cellID2);
573 void swap_rows(Index rowIndex1, Index rowIndex2);
601 ID_index vine_swap(ID_index cellID1, ID_index cellID2);
602
612 void update_all_representative_cycles(Dimension dim = Master_matrix::template get_null_value<Dimension>());
621 void update_representative_cycle(const Bar& bar);
628 const std::vector<Cycle>& get_all_representative_cycles() const;
636 const Cycle& get_representative_cycle(const Bar& bar) const;
637
638 private:
639 using Dictionary = typename Master_matrix::template Dictionary<Index>;
640
641 Underlying_matrix matrix_;
642 Dictionary* idToIndex_;
643 Index nextIndex_;
644
645 void _initialize_map(unsigned int size);
646 Index _id_to_index(ID_index id) const;
647 Index& _id_to_index(ID_index id);
648};
649
650template <class Underlying_matrix, class Master_matrix>
652 : matrix_(colSettings), idToIndex_(nullptr), nextIndex_(0)
653{
654 _initialize_map(0);
655}
656
657template <class Underlying_matrix, class Master_matrix>
658template <class Boundary_range>
660 const std::vector<Boundary_range>& orderedBoundaries,
661 Column_settings* colSettings)
662 : matrix_(orderedBoundaries, colSettings), idToIndex_(nullptr), nextIndex_(orderedBoundaries.size())
663{
664 _initialize_map(orderedBoundaries.size());
665 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
666 for (unsigned int i = 0; i < orderedBoundaries.size(); i++) {
667 _id_to_index(i) = i;
668 }
669 }
670}
671
672template <class Underlying_matrix, class Master_matrix>
674 Column_settings* colSettings)
675 : matrix_(numberOfColumns, colSettings), idToIndex_(nullptr), nextIndex_(0)
676{
677 _initialize_map(numberOfColumns);
678}
679
680template <class Underlying_matrix, class Master_matrix>
681template <typename BirthComparatorFunction, typename DeathComparatorFunction>
683 Column_settings* colSettings,
684 const BirthComparatorFunction& birthComparator,
685 const DeathComparatorFunction& deathComparator)
686 : matrix_(colSettings, birthComparator, deathComparator), idToIndex_(nullptr), nextIndex_(0)
687{
688 _initialize_map(0);
689}
690
691template <class Underlying_matrix, class Master_matrix>
692template <typename BirthComparatorFunction, typename DeathComparatorFunction, class Boundary_range>
694 const std::vector<Boundary_range>& orderedBoundaries,
695 Column_settings* colSettings,
696 const BirthComparatorFunction& birthComparator,
697 const DeathComparatorFunction& deathComparator)
698 : matrix_(orderedBoundaries, colSettings, birthComparator, deathComparator),
699 idToIndex_(nullptr),
700 nextIndex_(orderedBoundaries.size())
701{
702 _initialize_map(orderedBoundaries.size());
703 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
704 for (unsigned int i = 0; i < orderedBoundaries.size(); i++) {
705 _id_to_index(i) = i;
706 }
707 }
708}
709
710template <class Underlying_matrix, class Master_matrix>
711template <typename BirthComparatorFunction, typename DeathComparatorFunction>
713 unsigned int numberOfColumns,
714 Column_settings* colSettings,
715 const BirthComparatorFunction& birthComparator,
716 const DeathComparatorFunction& deathComparator)
717 : matrix_(numberOfColumns, colSettings, birthComparator, deathComparator), idToIndex_(nullptr), nextIndex_(0)
718{
719 _initialize_map(numberOfColumns);
720}
721
722template <class Underlying_matrix, class Master_matrix>
724 const Id_to_index_overlay& matrixToCopy,
725 Column_settings* colSettings)
726 : matrix_(matrixToCopy.matrix_, colSettings), idToIndex_(nullptr), nextIndex_(matrixToCopy.nextIndex_)
727{
728 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
729 idToIndex_ = new Dictionary(*matrixToCopy.idToIndex_);
730 } else {
731 idToIndex_ = &matrix_.pivotToColumnIndex_;
732 }
733}
734
735template <class Underlying_matrix, class Master_matrix>
737 : matrix_(std::move(other.matrix_)),
738 idToIndex_(std::exchange(other.idToIndex_, nullptr)),
739 nextIndex_(std::exchange(other.nextIndex_, 0))
740{
741}
742
743template <class Underlying_matrix, class Master_matrix>
745{
746 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
747 delete idToIndex_;
748 }
749}
750
751template <class Underlying_matrix, class Master_matrix>
752template <class Boundary_range>
754 Dimension dim)
755{
756 matrix_.insert_boundary(boundary, dim);
757 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
758 if constexpr (Master_matrix::Option_list::has_map_column_container) {
759 idToIndex_->emplace(nextIndex_, nextIndex_);
760 } else {
761 if (idToIndex_->size() == nextIndex_) {
762 idToIndex_->push_back(nextIndex_);
763 } else {
764 _id_to_index(nextIndex_) = nextIndex_;
765 }
766 }
767 ++nextIndex_;
768 }
769}
770
771template <class Underlying_matrix, class Master_matrix>
772template <class Boundary_range>
774 const Boundary_range& boundary,
775 Dimension dim)
776{
777 if constexpr (Master_matrix::Option_list::has_map_column_container) {
778 GUDHI_CHECK(idToIndex_->find(cellIndex) == idToIndex_->end(),
779 std::invalid_argument("Id_to_index_overlay::insert_boundary - Index for simplex already chosen!"));
780 } else {
781 GUDHI_CHECK(
782 (idToIndex_->size() <= cellIndex || _id_to_index(cellIndex) == Master_matrix::template get_null_value<Index>()),
783 std::invalid_argument("Id_to_index_overlay::insert_boundary - Index for simplex already chosen!"));
784 }
785 matrix_.insert_boundary(cellIndex, boundary, dim);
786 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
787 if constexpr (Master_matrix::Option_list::has_map_column_container) {
788 idToIndex_->emplace(cellIndex, nextIndex_);
789 } else {
790 if (idToIndex_->size() <= cellIndex) {
791 idToIndex_->resize(cellIndex + 1, Master_matrix::template get_null_value<Index>());
792 }
793 _id_to_index(cellIndex) = nextIndex_;
794 }
795 ++nextIndex_;
796 }
797}
798
799template <class Underlying_matrix, class Master_matrix>
802{
803 return matrix_.get_column(_id_to_index(cellID));
804}
805
806template <class Underlying_matrix, class Master_matrix>
809{
810 return matrix_.get_row(rowIndex);
811}
812
813template <class Underlying_matrix, class Master_matrix>
815{
816 return matrix_.erase_empty_row(rowIndex);
817}
818
819template <class Underlying_matrix, class Master_matrix>
821{
822 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
823 std::vector<ID_index> indexToID(nextIndex_);
824 if constexpr (Master_matrix::Option_list::has_map_column_container) {
825 for (auto& p : *idToIndex_) {
826 indexToID[p.second] = p.first;
827 }
828 } else {
829 for (ID_index i = 0; i < idToIndex_->size(); ++i) {
830 if (_id_to_index(i) != Master_matrix::template get_null_value<Index>()) indexToID[_id_to_index(i)] = i;
831 }
832 }
833 --nextIndex_;
834 for (Index curr = _id_to_index(cellID); curr < nextIndex_; ++curr) {
835 matrix_.vine_swap(curr);
836 std::swap(idToIndex_->at(indexToID[curr]), idToIndex_->at(indexToID[curr + 1]));
837 }
838 matrix_.remove_last();
839 GUDHI_CHECK(_id_to_index(cellID) == nextIndex_,
840 std::logic_error("Id_to_index_overlay::remove_maximal_cell - Indexation problem."));
841
842 if constexpr (Master_matrix::Option_list::has_map_column_container) {
843 idToIndex_->erase(cellID);
844 } else {
845 _id_to_index(cellID) = Master_matrix::template get_null_value<Index>();
846 }
847 } else {
848 matrix_.remove_maximal_cell(cellID);
849 }
850}
851
852template <class Underlying_matrix, class Master_matrix>
854 ID_index cellID,
855 const std::vector<ID_index>& columnsToSwap)
856{
857 static_assert(!Master_matrix::Option_list::is_of_boundary_type,
858 "'remove_maximal_cell(ID_index,const std::vector<Index>&)' is not available for the chosen options.");
859 std::vector<Index> translatedIndices;
860 std::transform(columnsToSwap.cbegin(), columnsToSwap.cend(), std::back_inserter(translatedIndices), [&](ID_index id) {
861 return _id_to_index(id);
862 });
863 matrix_.remove_maximal_cell(cellID, translatedIndices);
864}
865
866template <class Underlying_matrix, class Master_matrix>
868{
869 if (idToIndex_->empty()) return; // empty matrix
870
871 matrix_.remove_last();
872
873 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
874 --nextIndex_;
875 if constexpr (Master_matrix::Option_list::has_map_column_container) {
876 auto it = idToIndex_->begin();
877 while (it->second != nextIndex_) ++it; // should never reach idToIndex_->end()
878 idToIndex_->erase(it);
879 } else {
880 Index id = idToIndex_->size() - 1;
881 // should always stop before reaching -1
882 while (_id_to_index(id) == Master_matrix::template get_null_value<Index>()) --id;
883 GUDHI_CHECK(_id_to_index(id) == nextIndex_,
884 std::logic_error("Id_to_index_overlay::remove_last - Indexation problem."));
885 _id_to_index(id) = Master_matrix::template get_null_value<Index>();
886 }
887 }
888}
889
890template <class Underlying_matrix, class Master_matrix>
893{
894 return matrix_.get_max_dimension();
895}
896
897template <class Underlying_matrix, class Master_matrix>
900{
901 return matrix_.get_number_of_columns();
902}
903
904template <class Underlying_matrix, class Master_matrix>
907{
908 return matrix_.get_column_dimension(_id_to_index(cellID));
909}
910
911template <class Underlying_matrix, class Master_matrix>
913{
914 return matrix_.add_to(_id_to_index(sourceCellID), _id_to_index(targetCellID));
915}
916
917template <class Underlying_matrix, class Master_matrix>
919 ID_index sourceCellID,
920 const Field_element& coefficient,
921 ID_index targetCellID)
922{
923 return matrix_.multiply_target_and_add_to(_id_to_index(sourceCellID), coefficient, _id_to_index(targetCellID));
924}
925
926template <class Underlying_matrix, class Master_matrix>
928 const Field_element& coefficient,
929 ID_index sourceCellID,
930 ID_index targetCellID)
931{
932 return matrix_.multiply_source_and_add_to(coefficient, _id_to_index(sourceCellID), _id_to_index(targetCellID));
933}
934
935template <class Underlying_matrix, class Master_matrix>
937{
938 return matrix_.zero_entry(_id_to_index(cellID), rowIndex);
939}
940
941template <class Underlying_matrix, class Master_matrix>
943{
944 return matrix_.zero_column(_id_to_index(cellID));
945}
946
947template <class Underlying_matrix, class Master_matrix>
949 ID_index rowIndex) const
950{
951 return matrix_.is_zero_entry(_id_to_index(cellID), rowIndex);
952}
953
954template <class Underlying_matrix, class Master_matrix>
956{
957 return matrix_.is_zero_column(_id_to_index(cellID));
958}
959
960template <class Underlying_matrix, class Master_matrix>
963{
964 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
965 Index pos = matrix_.get_column_with_pivot(cellIndex);
966 ID_index i = 0;
967 while (_id_to_index(i) != pos) ++i;
968 return i;
969 } else {
970 return cellIndex;
971 }
972}
973
974template <class Underlying_matrix, class Master_matrix>
977{
978 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
979 return matrix_.get_pivot(_id_to_index(cellID));
980 } else {
981 return cellID;
982 }
983}
984
985template <class Underlying_matrix, class Master_matrix>
988{
989 if (this == &other) return *this;
990
991 matrix_ = other.matrix_;
992 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
993 delete idToIndex_;
994 idToIndex_ = other.idToIndex_;
995 } else {
996 idToIndex_ = &matrix_.pivotToColumnIndex_;
997 }
998 nextIndex_ = other.nextIndex_;
999
1000 return *this;
1001}
1002
1003template <class Underlying_matrix, class Master_matrix>
1006{
1007 if (this == &other) return *this;
1008
1009 matrix_ = std::move(other.matrix_);
1010 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
1011 delete idToIndex_;
1012 }
1013 idToIndex_ = std::exchange(other.idToIndex_, nullptr);
1014 nextIndex_ = std::exchange(other.nextIndex_, 0);
1015
1016 return *this;
1017}
1018
1019template <class Underlying_matrix, class Master_matrix>
1020inline void Id_to_index_overlay<Underlying_matrix, Master_matrix>::print()
1021{
1022 return matrix_.print();
1023}
1024
1025template <class Underlying_matrix, class Master_matrix>
1028{
1029 return matrix_.get_current_barcode();
1030}
1031
1032template <class Underlying_matrix, class Master_matrix>
1034{
1035 matrix_.update_all_representative_cycles(dim);
1036}
1037
1038template <class Underlying_matrix, class Master_matrix>
1040{
1041 matrix_.update_representative_cycle(bar);
1042}
1043
1044template <class Underlying_matrix, class Master_matrix>
1045inline const std::vector<typename Id_to_index_overlay<Underlying_matrix, Master_matrix>::Cycle>&
1047{
1048 return matrix_.get_all_representative_cycles();
1049}
1050
1051template <class Underlying_matrix, class Master_matrix>
1054{
1055 return matrix_.get_representative_cycle(bar);
1056}
1057
1058template <class Underlying_matrix, class Master_matrix>
1060{
1061 matrix_.swap_columns(_id_to_index(cellID1), _id_to_index(cellID2));
1062 std::swap(idToIndex_->at(cellID1), idToIndex_->at(cellID2));
1063}
1064
1065template <class Underlying_matrix, class Master_matrix>
1067{
1068 matrix_.swap_rows(rowIndex1, rowIndex2);
1069}
1070
1071template <class Underlying_matrix, class Master_matrix>
1074{
1075 Index first = _id_to_index(cellID1);
1076 Index second = _id_to_index(cellID2);
1077 if (first > second) std::swap(first, second);
1078
1079 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
1080 GUDHI_CHECK(second - first == 1,
1081 std::invalid_argument(
1082 "Id_to_index_overlay::vine_swap_with_z_eq_1_case - The columns to swap are not contiguous."));
1083
1084 bool change = matrix_.vine_swap_with_z_eq_1_case(first);
1085
1086 std::swap(idToIndex_->at(cellID1), idToIndex_->at(cellID2));
1087
1088 if (change) {
1089 return cellID1;
1090 }
1091 return cellID2;
1092 } else {
1093 return matrix_.vine_swap_with_z_eq_1_case(first, second);
1094 }
1095}
1096
1097template <class Underlying_matrix, class Master_matrix>
1100{
1101 Index first = _id_to_index(cellID1);
1102 Index second = _id_to_index(cellID2);
1103 if (first > second) std::swap(first, second);
1104
1105 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
1106 GUDHI_CHECK(second - first == 1,
1107 std::invalid_argument("Id_to_index_overlay::vine_swap - The columns to swap are not contiguous."));
1108
1109 bool change = matrix_.vine_swap(first);
1110
1111 std::swap(idToIndex_->at(cellID1), idToIndex_->at(cellID2));
1112
1113 if (change) {
1114 return cellID1;
1115 }
1116 return cellID2;
1117 } else {
1118 return matrix_.vine_swap(first, second);
1119 }
1120}
1121
1122template <class Underlying_matrix, class Master_matrix>
1123inline void Id_to_index_overlay<Underlying_matrix, Master_matrix>::_initialize_map([[maybe_unused]] unsigned int size)
1124{
1125 if constexpr (Master_matrix::Option_list::is_of_boundary_type) {
1126 if constexpr (Master_matrix::Option_list::has_map_column_container) {
1127 idToIndex_ = new Dictionary(size);
1128 } else {
1129 idToIndex_ = new Dictionary(size, Master_matrix::template get_null_value<Index>());
1130 }
1131 } else {
1132 idToIndex_ = &matrix_.pivotToColumnIndex_;
1133 }
1134}
1135
1136template <class Underlying_matrix, class Master_matrix>
1138Id_to_index_overlay<Underlying_matrix, Master_matrix>::_id_to_index(ID_index id) const
1139{
1140 if constexpr (Master_matrix::Option_list::has_map_column_container) {
1141 return idToIndex_->at(id);
1142 } else {
1143 return idToIndex_->operator[](id);
1144 }
1145}
1146
1147template <class Underlying_matrix, class Master_matrix>
1149Id_to_index_overlay<Underlying_matrix, Master_matrix>::_id_to_index(ID_index id)
1150{
1151 return idToIndex_->operator[](id); // for maps, the entry is created if not existing as needed in the constructors
1152}
1153
1154} // namespace persistence_matrix
1155} // namespace Gudhi
1156
1157#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:651
void update_all_representative_cycles(Dimension dim=Master_matrix::template get_null_value< Dimension >())
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition Id_to_index_overlay.h:1033
bool is_zero_column(ID_index cellID)
Indicates if the column at given index has value zero.
Definition Id_to_index_overlay.h:955
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:820
Id_to_index_overlay & operator=(const Id_to_index_overlay &other)
Assign operator.
Definition Id_to_index_overlay.h:987
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:892
const Cycle & get_representative_cycle(const Bar &bar) const
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition Id_to_index_overlay.h:1053
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:912
ID_index get_pivot(ID_index cellID)
Returns the row index of the pivot of the given column.
Definition Id_to_index_overlay.h:976
typename Master_matrix::Row Row
Definition Id_to_index_overlay.h:55
void remove_last()
Only available if PersistenceMatrixOptions::has_removable_columns is true. Additionally,...
Definition Id_to_index_overlay.h:867
void update_representative_cycle(const Bar &bar)
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition Id_to_index_overlay.h:1039
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:918
void reset(Column_settings *colSettings)
Resets the matrix to an empty matrix.
Definition Id_to_index_overlay.h:509
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:942
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:927
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:1027
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:962
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:753
void erase_empty_row(ID_index rowIndex)
The effect varies depending on the matrices and the options:
Definition Id_to_index_overlay.h:814
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:801
typename Master_matrix::Boundary Boundary
Definition Id_to_index_overlay.h:53
friend void swap(Id_to_index_overlay &matrix1, Id_to_index_overlay &matrix2) noexcept
Swap operator.
Definition Id_to_index_overlay.h:529
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:808
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:1073
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:948
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:744
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:1059
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:61
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:1066
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:1099
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:936
Index get_number_of_columns() const
Returns the current number of columns in the matrix.
Definition Id_to_index_overlay.h:899
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:906
const std::vector< Cycle > & get_all_representative_cycles() const
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition Id_to_index_overlay.h:1046
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
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14