overlay_ididx_to_matidx.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 
27 namespace Gudhi {
28 namespace persistence_matrix {
29 
40 template <class Matrix_type, class Master_matrix_type>
42 {
43  public:
44  using index = typename Master_matrix_type::index;
45  using id_index = typename Master_matrix_type::id_index;
46  using dimension_type = typename Master_matrix_type::dimension_type;
50  using Field_operators = typename Master_matrix_type::Field_operators;
51  using Field_element_type = typename Master_matrix_type::element_type;
52  using boundary_type = typename Master_matrix_type::boundary_type;
53  using Column_type = typename Master_matrix_type::Column_type;
54  using Row_type = typename Master_matrix_type::Row_type;
56  using bar_type = typename Master_matrix_type::Bar;
57  using barcode_type = typename Master_matrix_type::barcode_type;
58  using cycle_type = typename Master_matrix_type::cycle_type;
59  using Cell_constructor = typename Master_matrix_type::Cell_constructor;
60  using Column_settings = typename Master_matrix_type::Column_settings;
90  template <class Boundary_type = boundary_type>
91  Id_to_index_overlay(const std::vector<Boundary_type>& orderedBoundaries,
92  Column_settings* colSettings);
100  Id_to_index_overlay(unsigned int numberOfColumns, Column_settings* colSettings);
123  template <typename BirthComparatorFunction, typename DeathComparatorFunction>
125  const BirthComparatorFunction& birthComparator,
126  const DeathComparatorFunction& deathComparator);
163  template <typename BirthComparatorFunction, typename DeathComparatorFunction, class Boundary_type>
164  Id_to_index_overlay(const std::vector<Boundary_type>& orderedBoundaries,
165  Column_settings* colSettings,
166  const BirthComparatorFunction& birthComparator,
167  const DeathComparatorFunction& deathComparator);
191  template <typename BirthComparatorFunction, typename DeathComparatorFunction>
192  Id_to_index_overlay(unsigned int numberOfColumns,
193  Column_settings* colSettings,
194  const BirthComparatorFunction& birthComparator,
195  const DeathComparatorFunction& deathComparator);
205  Id_to_index_overlay(const Id_to_index_overlay& matrixToCopy,
206  Column_settings* colSettings = nullptr);
212  Id_to_index_overlay(Id_to_index_overlay&& other) noexcept;
217 
244  template <class Boundary_type = boundary_type>
245  void insert_boundary(const Boundary_type& boundary, dimension_type dim = -1);
262  template <class Boundary_type = boundary_type>
263  void insert_boundary(id_index faceIndex, const Boundary_type& boundary, dimension_type dim = -1);
286  Row_type& get_row(id_index rowIndex);
311  void erase_empty_row(id_index rowIndex);
330  void remove_maximal_face(id_index faceID);
354  void remove_maximal_face(id_index faceID, const std::vector<id_index>& columnsToSwap);
369  void remove_last();
370 
391 
402  void add_to(id_index sourceFaceID, id_index targetFaceID);
415  void multiply_target_and_add_to(id_index sourceFaceID, const Field_element_type& coefficient, id_index targetFaceID);
428  void multiply_source_and_add_to(const Field_element_type& coefficient, id_index sourceFaceID, id_index targetFaceID);
429 
440  void zero_cell(id_index faceID, id_index rowIndex);
450  void zero_column(id_index faceID);
461  bool is_zero_cell(id_index faceID, id_index rowIndex) const;
474  bool is_zero_column(id_index faceID);
475 
487  id_index get_column_with_pivot(id_index faceIndex) const;
494  id_index get_pivot(id_index faceID);
495 
502  void reset(Column_settings* colSettings) {
503  matrix_.reset(colSettings);
504  nextIndex_ = 0;
505  }
506 
507  // void set_operators(Field_operators* operators) { matrix_.set_operators(operators); }
508 
516  friend void swap(Id_to_index_overlay& matrix1, Id_to_index_overlay& matrix2) {
517  swap(matrix1.matrix_, matrix2.matrix_);
518  if (Master_matrix_type::Option_list::is_of_boundary_type) std::swap(matrix1.idToIndex_, matrix2.idToIndex_);
519  std::swap(matrix1.nextIndex_, matrix2.nextIndex_);
520  }
521 
522  void print(); // for debug
523 
524  // access to optionnal methods
525 
539 
549  void swap_columns(id_index faceID1, id_index faceID2);
559  void swap_rows(index rowIndex1, index rowIndex2);
587  id_index vine_swap(id_index faceID1, id_index faceID2);
588 
603  const std::vector<cycle_type>& get_representative_cycles();
611  const cycle_type& get_representative_cycle(const bar_type& bar);
612 
613  private:
614  using dictionnary_type = typename Master_matrix_type::template dictionnary_type<index>;
615 
616  Matrix_type matrix_;
617  dictionnary_type* idToIndex_;
618  index nextIndex_;
620  void _initialize_map(unsigned int size);
621  index _id_to_index(id_index id) const;
622 };
623 
624 template <class Matrix_type, class Master_matrix_type>
626  : matrix_(colSettings), idToIndex_(nullptr), nextIndex_(0)
627 {
628  _initialize_map(0);
629 }
630 
631 template <class Matrix_type, class Master_matrix_type>
632 template <class Boundary_type>
634  const std::vector<Boundary_type>& orderedBoundaries, Column_settings* colSettings)
635  : matrix_(orderedBoundaries, colSettings), idToIndex_(nullptr), nextIndex_(orderedBoundaries.size())
636 {
637  _initialize_map(orderedBoundaries.size());
638  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
639  for (unsigned int i = 0; i < orderedBoundaries.size(); i++) {
640  idToIndex_->operator[](i) = i;
641  }
642  }
643 }
644 
645 template <class Matrix_type, class Master_matrix_type>
647  Column_settings* colSettings)
648  : matrix_(numberOfColumns, colSettings), idToIndex_(nullptr), nextIndex_(0)
649 {
650  _initialize_map(numberOfColumns);
651 }
652 
653 template <class Matrix_type, class Master_matrix_type>
654 template <typename BirthComparatorFunction, typename DeathComparatorFunction>
656  Column_settings* colSettings,
657  const BirthComparatorFunction& birthComparator,
658  const DeathComparatorFunction& deathComparator)
659  : matrix_(colSettings, birthComparator, deathComparator), idToIndex_(nullptr), nextIndex_(0)
660 {
661  _initialize_map(0);
662 }
663 
664 template <class Matrix_type, class Master_matrix_type>
665 template <typename BirthComparatorFunction, typename DeathComparatorFunction, class Boundary_type>
667  const std::vector<Boundary_type>& orderedBoundaries,
668  Column_settings* colSettings,
669  const BirthComparatorFunction& birthComparator,
670  const DeathComparatorFunction& deathComparator)
671  : matrix_(orderedBoundaries, colSettings, birthComparator, deathComparator),
672  idToIndex_(nullptr),
673  nextIndex_(orderedBoundaries.size())
674 {
675  _initialize_map(orderedBoundaries.size());
676  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
677  for (unsigned int i = 0; i < orderedBoundaries.size(); i++) {
678  idToIndex_->operator[](i) = i;
679  }
680  }
681 }
682 
683 template <class Matrix_type, class Master_matrix_type>
684 template <typename BirthComparatorFunction, typename DeathComparatorFunction>
686  unsigned int numberOfColumns,
687  Column_settings* colSettings,
688  const BirthComparatorFunction& birthComparator,
689  const DeathComparatorFunction& deathComparator)
690  : matrix_(numberOfColumns, colSettings, birthComparator, deathComparator),
691  idToIndex_(nullptr),
692  nextIndex_(0)
693 {
694  _initialize_map(numberOfColumns);
695 }
696 
697 template <class Matrix_type, class Master_matrix_type>
699  const Id_to_index_overlay& matrixToCopy, Column_settings* colSettings)
700  : matrix_(matrixToCopy.matrix_, colSettings),
701  idToIndex_(nullptr),
702  nextIndex_(matrixToCopy.nextIndex_)
703 {
704  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
705  idToIndex_ = new dictionnary_type(*matrixToCopy.idToIndex_);
706  } else {
707  idToIndex_ = &matrix_.pivotToColumnIndex_;
708  }
709 }
710 
711 template <class Matrix_type, class Master_matrix_type>
713  : matrix_(std::move(other.matrix_)),
714  idToIndex_(std::exchange(other.idToIndex_, nullptr)),
715  nextIndex_(std::exchange(other.nextIndex_, 0))
716 {}
717 
718 template <class Matrix_type, class Master_matrix_type>
720 {
721  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
722  if (idToIndex_ != nullptr) delete idToIndex_;
723  }
724 }
725 
726 template <class Matrix_type, class Master_matrix_type>
727 template <class Boundary_type>
729  dimension_type dim)
730 {
731  matrix_.insert_boundary(boundary, dim);
732  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
733  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
734  idToIndex_->emplace(nextIndex_, nextIndex_);
735  } else {
736  if (idToIndex_->size() == nextIndex_) {
737  idToIndex_->push_back(nextIndex_);
738  } else {
739  idToIndex_->operator[](nextIndex_) = nextIndex_;
740  }
741  }
742  ++nextIndex_;
743  }
744 }
745 
746 template <class Matrix_type, class Master_matrix_type>
747 template <class Boundary_type>
749  const Boundary_type& boundary,
750  dimension_type dim)
751 {
752  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
753  GUDHI_CHECK(idToIndex_->find(faceIndex) == idToIndex_->end(),
754  std::invalid_argument("Id_to_index_overlay::insert_boundary - Index for simplex already chosen!"));
755  } else {
756  GUDHI_CHECK((idToIndex_->size() <= faceIndex || idToIndex_[faceIndex] == static_cast<index>(-1)),
757  std::invalid_argument("Id_to_index_overlay::insert_boundary - Index for simplex already chosen!"));
758  }
759  matrix_.insert_boundary(faceIndex, boundary, dim);
760  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
761  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
762  idToIndex_->emplace(faceIndex, nextIndex_);
763  } else {
764  if (idToIndex_->size() <= faceIndex) {
765  idToIndex_->resize(faceIndex + 1, -1);
766  }
767  idToIndex_->operator[](faceIndex) = nextIndex_;
768  }
769  ++nextIndex_;
770  }
771 }
772 
773 template <class Matrix_type, class Master_matrix_type>
776 {
777  return matrix_.get_column(_id_to_index(faceID));
778 }
779 
780 template <class Matrix_type, class Master_matrix_type>
783 {
784  return matrix_.get_row(rowIndex);
785 }
786 
787 template <class Matrix_type, class Master_matrix_type>
789 {
790  return matrix_.erase_empty_row(rowIndex);
791 }
792 
793 template <class Matrix_type, class Master_matrix_type>
795 {
796  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
797  std::vector<id_index> indexToID(nextIndex_);
798  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
799  for (auto& p : *idToIndex_) {
800  indexToID[p.second] = p.first;
801  }
802  } else {
803  for (id_index i = 0; i < idToIndex_->size(); ++i) {
804  if (idToIndex_->operator[](i) != static_cast<index>(-1)) indexToID[idToIndex_->operator[](i)] = i;
805  }
806  }
807  --nextIndex_;
808  for (index curr = _id_to_index(faceID); curr < nextIndex_; ++curr) {
809  matrix_.vine_swap(curr);
810  std::swap(idToIndex_->at(indexToID[curr]), idToIndex_->at(indexToID[curr + 1]));
811  }
812  matrix_.remove_last();
813  GUDHI_CHECK(_id_to_index(faceID) == nextIndex_,
814  std::logic_error("Id_to_index_overlay::remove_maximal_face - Indexation problem."));
815 
816  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
817  idToIndex_->erase(faceID);
818  } else {
819  idToIndex_->operator[](faceID) = -1;
820  }
821  } else {
822  matrix_.remove_maximal_face(faceID);
823  }
824 }
825 
826 template <class Matrix_type, class Master_matrix_type>
828  id_index faceID, const std::vector<id_index>& columnsToSwap)
829 {
830  static_assert(!Master_matrix_type::Option_list::is_of_boundary_type,
831  "'remove_maximal_face(id_index,const std::vector<index>&)' is not available for the chosen options.");
832  std::vector<index> translatedIndices;
833  std::transform(columnsToSwap.cbegin(), columnsToSwap.cend(), std::back_inserter(translatedIndices),
834  [&](id_index id) { return _id_to_index(id); });
835  matrix_.remove_maximal_face(faceID, translatedIndices);
836 }
837 
838 template <class Matrix_type, class Master_matrix_type>
840 {
841  if (idToIndex_->empty()) return; //empty matrix
842 
843  matrix_.remove_last();
844 
845  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
846  --nextIndex_;
847  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
848  auto it = idToIndex_->begin();
849  while (it->second != nextIndex_) ++it; //should never reach idToIndex_->end()
850  idToIndex_->erase(it);
851  } else {
852  index id = idToIndex_->size() - 1;
853  while (idToIndex_->operator[](id) == static_cast<index>(-1)) --id; // should always stop before reaching -1
854  GUDHI_CHECK(idToIndex_->operator[](id) == nextIndex_,
855  std::logic_error("Id_to_index_overlay::remove_last - Indexation problem."));
856  idToIndex_->operator[](id) = -1;
857  }
858  }
859 }
860 
861 template <class Matrix_type, class Master_matrix_type>
864 {
865  return matrix_.get_max_dimension();
866 }
867 
868 template <class Matrix_type, class Master_matrix_type>
871 {
872  return matrix_.get_number_of_columns();
873 }
874 
875 template <class Matrix_type, class Master_matrix_type>
878 {
879  return matrix_.get_column_dimension(_id_to_index(faceID));
880 }
881 
882 template <class Matrix_type, class Master_matrix_type>
884 {
885  return matrix_.add_to(_id_to_index(sourceFaceID), _id_to_index(targetFaceID));
886 }
887 
888 template <class Matrix_type, class Master_matrix_type>
890  id_index sourceFaceID, const Field_element_type& coefficient, id_index targetFaceID)
891 {
892  return matrix_.multiply_target_and_add_to(_id_to_index(sourceFaceID), coefficient, _id_to_index(targetFaceID));
893 }
894 
895 template <class Matrix_type, class Master_matrix_type>
897  const Field_element_type& coefficient, id_index sourceFaceID, id_index targetFaceID)
898 {
899  return matrix_.multiply_source_and_add_to(coefficient, _id_to_index(sourceFaceID), _id_to_index(targetFaceID));
900 }
901 
902 template <class Matrix_type, class Master_matrix_type>
904 {
905  return matrix_.zero_cell(_id_to_index(faceID), rowIndex);
906 }
907 
908 template <class Matrix_type, class Master_matrix_type>
910 {
911  return matrix_.zero_column(_id_to_index(faceID));
912 }
913 
914 template <class Matrix_type, class Master_matrix_type>
916  id_index rowIndex) const
917 {
918  return matrix_.is_zero_cell(_id_to_index(faceID), rowIndex);
919 }
920 
921 template <class Matrix_type, class Master_matrix_type>
923 {
924  return matrix_.is_zero_column(_id_to_index(faceID));
925 }
926 
927 template <class Matrix_type, class Master_matrix_type>
930 {
931  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
932  index pos = matrix_.get_column_with_pivot(simplexIndex);
933  id_index i = 0;
934  while (_id_to_index(i) != pos) ++i;
935  return i;
936  } else {
937  return simplexIndex;
938  }
939 }
940 
941 template <class Matrix_type, class Master_matrix_type>
944 {
945  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
946  return matrix_.get_pivot(_id_to_index(faceID));
947  } else {
948  return faceID;
949  }
950 }
951 
952 template <class Matrix_type, class Master_matrix_type>
955 {
956  matrix_ = other.matrix_;
957  if (Master_matrix_type::Option_list::is_of_boundary_type)
958  idToIndex_ = other.idToIndex_;
959  else
960  idToIndex_ = &matrix_.pivotToColumnIndex_;
961  nextIndex_ = other.nextIndex_;
962 
963  return *this;
964 }
965 
966 template <class Matrix_type, class Master_matrix_type>
968 {
969  return matrix_.print();
970 }
971 
972 template <class Matrix_type, class Master_matrix_type>
975 {
976  return matrix_.get_current_barcode();
977 }
978 
979 template <class Matrix_type, class Master_matrix_type>
981 {
982  matrix_.update_representative_cycles();
983 }
984 
985 template <class Matrix_type, class Master_matrix_type>
986 inline const std::vector<typename Id_to_index_overlay<Matrix_type, Master_matrix_type>::cycle_type>&
988 {
989  return matrix_.get_representative_cycles();
990 }
991 
992 template <class Matrix_type, class Master_matrix_type>
995 {
996  return matrix_.get_representative_cycle(bar);
997 }
998 
999 template <class Matrix_type, class Master_matrix_type>
1001 {
1002  matrix_.swap_columns(_id_to_index(faceID1), _id_to_index(faceID2));
1003  std::swap(idToIndex_->at(faceID1), idToIndex_->at(faceID2));
1004 }
1005 
1006 template <class Matrix_type, class Master_matrix_type>
1008 {
1009  matrix_.swap_rows(rowIndex1, rowIndex2);
1010 }
1011 
1012 template <class Matrix_type, class Master_matrix_type>
1015 {
1016  index first = _id_to_index(faceID1);
1017  index second = _id_to_index(faceID2);
1018  if (first > second) std::swap(first, second);
1019 
1020  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
1021  GUDHI_CHECK(second - first == 1,
1022  std::invalid_argument(
1023  "Id_to_index_overlay::vine_swap_with_z_eq_1_case - The columns to swap are not contiguous."));
1024 
1025  bool change = matrix_.vine_swap_with_z_eq_1_case(first);
1026 
1027  std::swap(idToIndex_->at(faceID1), idToIndex_->at(faceID2));
1028 
1029  if (change) {
1030  return faceID1;
1031  }
1032  return faceID2;
1033  } else {
1034  return matrix_.vine_swap_with_z_eq_1_case(first, second);
1035  }
1036 }
1037 
1038 template <class Matrix_type, class Master_matrix_type>
1041 {
1042  index first = _id_to_index(faceID1);
1043  index second = _id_to_index(faceID2);
1044  if (first > second) std::swap(first, second);
1045 
1046  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
1047  GUDHI_CHECK(second - first == 1,
1048  std::invalid_argument("Id_to_index_overlay::vine_swap - The columns to swap are not contiguous."));
1049 
1050  bool change = matrix_.vine_swap(first);
1051 
1052  std::swap(idToIndex_->at(faceID1), idToIndex_->at(faceID2));
1053 
1054  if (change) {
1055  return faceID1;
1056  }
1057  return faceID2;
1058  } else {
1059  return matrix_.vine_swap(first, second);
1060  }
1061 }
1062 
1063 template <class Matrix_type, class Master_matrix_type>
1064 inline void Id_to_index_overlay<Matrix_type, Master_matrix_type>::_initialize_map([[maybe_unused]] unsigned int size)
1065 {
1066  if constexpr (Master_matrix_type::Option_list::is_of_boundary_type) {
1067  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
1068  idToIndex_ = new dictionnary_type(size);
1069  } else {
1070  idToIndex_ = new dictionnary_type(size, -1);
1071  }
1072  } else {
1073  idToIndex_ = &matrix_.pivotToColumnIndex_;
1074  }
1075 }
1076 
1077 template <class Matrix_type, class Master_matrix_type>
1079 Id_to_index_overlay<Matrix_type, Master_matrix_type>::_id_to_index(id_index id) const
1080 {
1081  if constexpr (Master_matrix_type::Option_list::has_map_column_container) {
1082  return idToIndex_->at(id);
1083  } else {
1084  return idToIndex_->operator[](id);
1085  }
1086 }
1087 
1088 } // namespace persistence_matrix
1089 } // namespace Gudhi
1090 
1091 #endif // PM_ID_TO_POS_TRANSLATION_H
Overlay for non-basic matrices replacing all input and output MatIdx indices of the original methods ...
Definition: overlay_ididx_to_matidx.h:42
void reset(Column_settings *colSettings)
Resets the matrix to an empty matrix.
Definition: overlay_ididx_to_matidx.h:502
Row_type & get_row(id_index rowIndex)
Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row ...
Definition: overlay_ididx_to_matidx.h:782
const barcode_type & get_current_barcode()
Returns the current barcode of the matrix. Available only if PersistenceMatrixOptions::has_column_pai...
Definition: overlay_ididx_to_matidx.h:974
void zero_cell(id_index faceID, id_index rowIndex)
Zeroes the cell at the given coordinates. Not available for chain matrices. In general,...
Definition: overlay_ididx_to_matidx.h:903
typename Master_matrix_type::index index
Definition: overlay_ididx_to_matidx.h:44
Id_to_index_overlay(Column_settings *colSettings)
Constructs an empty matrix.
Definition: overlay_ididx_to_matidx.h:625
id_index get_pivot(id_index faceID)
Returns the row index of the pivot of the given column.
Definition: overlay_ididx_to_matidx.h:943
typename Master_matrix_type::Bar bar_type
Definition: overlay_ididx_to_matidx.h:56
typename Master_matrix_type::Field_operators Field_operators
Field operators class. Necessary only if PersistenceMatrixOptions::is_z2 is false.
Definition: overlay_ididx_to_matidx.h:50
bool is_zero_column(id_index faceID)
Indicates if the column at given index has value zero.
Definition: overlay_ididx_to_matidx.h:922
friend void swap(Id_to_index_overlay &matrix1, Id_to_index_overlay &matrix2)
Swap operator.
Definition: overlay_ididx_to_matidx.h:516
typename Master_matrix_type::Row_type Row_type
Definition: overlay_ididx_to_matidx.h:55
bool is_zero_cell(id_index faceID, id_index rowIndex) const
Indicates if the cell at given coordinates has value zero.
Definition: overlay_ididx_to_matidx.h:915
typename Master_matrix_type::cycle_type cycle_type
Definition: overlay_ididx_to_matidx.h:58
void multiply_source_and_add_to(const Field_element_type &coefficient, id_index sourceFaceID, id_index targetFaceID)
Multiplies the source column with the coefficiant before adding it to the target column....
Definition: overlay_ididx_to_matidx.h:896
void update_representative_cycles()
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition: overlay_ididx_to_matidx.h:980
id_index get_column_with_pivot(id_index faceIndex) const
Returns the IDIdx index of the column which has the given row index as pivot. Assumes that the pivot ...
Definition: overlay_ididx_to_matidx.h:929
Column_type & get_column(id_index faceID)
Returns the column at the given IDIdx index. For RU matrices, the returned column is from ....
Definition: overlay_ididx_to_matidx.h:775
index get_number_of_columns() const
Returns the current number of columns in the matrix.
Definition: overlay_ididx_to_matidx.h:870
dimension_type get_max_dimension() const
Returns the maximal dimension of a face stored in the matrix. Only available if PersistenceMatrixOpti...
Definition: overlay_ididx_to_matidx.h:863
void remove_maximal_face(id_index faceID)
Only available for RU and chain matrices and if PersistenceMatrixOptions::has_removable_columns and P...
Definition: overlay_ididx_to_matidx.h:794
typename Master_matrix_type::boundary_type boundary_type
Definition: overlay_ididx_to_matidx.h:52
const std::vector< cycle_type > & get_representative_cycles()
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition: overlay_ididx_to_matidx.h:987
typename Master_matrix_type::element_type Field_element_type
Definition: overlay_ididx_to_matidx.h:51
typename Master_matrix_type::Column_type Column_type
Definition: overlay_ididx_to_matidx.h:53
void zero_column(id_index faceID)
Zeroes the column at the given index. Not available for chain matrices. In general,...
Definition: overlay_ididx_to_matidx.h:909
typename Master_matrix_type::id_index id_index
Definition: overlay_ididx_to_matidx.h:45
const cycle_type & get_representative_cycle(const bar_type &bar)
Only available if PersistenceMatrixOptions::can_retrieve_representative_cycles is true....
Definition: overlay_ididx_to_matidx.h:994
void add_to(id_index sourceFaceID, id_index targetFaceID)
Adds column corresponding to sourceFaceID onto the column corresponding to targetFaceID.
Definition: overlay_ididx_to_matidx.h:883
void swap_columns(id_index faceID1, id_index faceID2)
Only available for simple boundary matrices (only storing ) and if PersistenceMatrixOptions::has_colu...
Definition: overlay_ididx_to_matidx.h:1000
void remove_last()
Only available if PersistenceMatrixOptions::has_removable_columns is true. Additionnaly,...
Definition: overlay_ididx_to_matidx.h:839
void erase_empty_row(id_index rowIndex)
The effect varies depending on the matrices and the options:
Definition: overlay_ididx_to_matidx.h:788
typename Master_matrix_type::barcode_type barcode_type
Definition: overlay_ididx_to_matidx.h:57
void swap_rows(index rowIndex1, index rowIndex2)
Only available for simple boundary matrices (only storing R) and if PersistenceMatrixOptions::has_col...
Definition: overlay_ididx_to_matidx.h:1007
void insert_boundary(const Boundary_type &boundary, dimension_type dim=-1)
Inserts at the end of the matrix a new ordered column corresponding to the given boundary....
Definition: overlay_ididx_to_matidx.h:728
Id_to_index_overlay & operator=(const Id_to_index_overlay &other)
Assign operator.
Definition: overlay_ididx_to_matidx.h:954
id_index vine_swap_with_z_eq_1_case(id_index faceID1, id_index faceID2)
Only available if PersistenceMatrixOptions::has_vine_update is true. Does the same than vine_swap,...
Definition: overlay_ididx_to_matidx.h:1014
typename Master_matrix_type::Cell_constructor Cell_constructor
Definition: overlay_ididx_to_matidx.h:59
typename Master_matrix_type::Column_settings Column_settings
Definition: overlay_ididx_to_matidx.h:61
dimension_type get_column_dimension(id_index faceID) const
Returns the dimension of the given face. Only available for non-basic matrices.
Definition: overlay_ididx_to_matidx.h:877
typename Master_matrix_type::dimension_type dimension_type
Definition: overlay_ididx_to_matidx.h:46
~Id_to_index_overlay()
Destructor.
Definition: overlay_ididx_to_matidx.h:719
id_index vine_swap(id_index faceID1, id_index faceID2)
Only available if PersistenceMatrixOptions::has_vine_update is true. Does a vine swap between two fac...
Definition: overlay_ididx_to_matidx.h:1040
void multiply_target_and_add_to(id_index sourceFaceID, const Field_element_type &coefficient, id_index targetFaceID)
Multiplies the target column with the coefficiant and then adds the source column to it....
Definition: overlay_ididx_to_matidx.h:889
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14