ru_pairing.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_RU_PAIRING_H
18 #define PM_RU_PAIRING_H
19 
20 #include <utility> //std::move
21 
22 namespace Gudhi {
23 namespace persistence_matrix {
24 
33  friend void swap([[maybe_unused]] Dummy_ru_pairing& d1, [[maybe_unused]] Dummy_ru_pairing& d2) {}
34 };
35 
44 template <class Master_matrix>
45 class RU_pairing
46 {
47  public:
48  using barcode_type = typename Master_matrix::barcode_type;
53  RU_pairing();
59  RU_pairing(const RU_pairing& matrixToCopy);
65  RU_pairing(RU_pairing&& other) noexcept;
66 
72  const barcode_type& get_current_barcode() const;
73 
81  friend void swap(RU_pairing& pairing1, RU_pairing& pairing2) {
82  pairing1.barcode_.swap(pairing2.barcode_);
83  pairing1.indexToBar_.swap(pairing2.indexToBar_);
84  }
85 
86  protected:
87  using dictionnary_type = typename Master_matrix::bar_dictionnary_type;
88 
89  barcode_type barcode_;
90  dictionnary_type indexToBar_;
91 };
92 
93 template <class Master_matrix>
95 {}
96 
97 template <class Master_matrix>
99  : barcode_(matrixToCopy.barcode_), indexToBar_(matrixToCopy.indexToBar_)
100 {}
101 
102 template <class Master_matrix>
104  : barcode_(std::move(other.barcode_)), indexToBar_(std::move(other.indexToBar_))
105 {}
106 
107 template <class Master_matrix>
109 {
110  return barcode_;
111 }
112 
113 template <class Master_matrix>
115 {
116  barcode_.swap(other.barcode_);
117  indexToBar_.swap(other.indexToBar_);
118  return *this;
119 }
120 
121 } // namespace persistence_matrix
122 } // namespace Gudhi
123 
124 #endif // PM_RU_PAIRING_H
Class managing the barcode for RU_matrix if the option was enabled.
Definition: ru_pairing.h:46
friend void swap(RU_pairing &pairing1, RU_pairing &pairing2)
Swap operator.
Definition: ru_pairing.h:81
typename Master_matrix::barcode_type barcode_type
Definition: ru_pairing.h:48
RU_pairing()
Default constructor.
Definition: ru_pairing.h:94
const barcode_type & get_current_barcode() const
Returns the current barcode which is maintained at any insertion, removal or vine swap.
Definition: ru_pairing.h:108
RU_pairing & operator=(RU_pairing other)
Assign operator.
Definition: ru_pairing.h:114
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Empty structure. Inheritated instead of RU_pairing, when the computation of the barcode was not enabl...
Definition: ru_pairing.h:32