17#ifndef PM_INTERVAL_INCLUDED
18#define PM_INTERVAL_INCLUDED
26namespace persistence_matrix {
39template <
typename Dimension,
typename Event_value>
50 static constexpr Event_value
inf = std::numeric_limits<Event_value>::has_infinity
51 ? std::numeric_limits<Event_value>::infinity()
52 : static_cast<Event_value>(-1);
75 stream <<
"[" << interval.
dim <<
"] ";
76 if constexpr (std::numeric_limits<Event_value>::has_infinity) {
77 stream << interval.
birth <<
" - " << interval.
death;
82 stream << interval.
birth;
87 stream << interval.
death;
98 template <std::
size_t I>
99 constexpr auto&
get() &
noexcept {
100 static_assert(I < 3,
"Value mismatch at argument 1 in template parameter list. Maximal possible value is 2.");
102 if constexpr (I == 0)
return birth;
103 if constexpr (I == 1)
return death;
104 if constexpr (I == 2)
return dim;
113 template <std::
size_t I>
114 constexpr const auto&
get() const& noexcept {
115 static_assert(I < 3,
"Value mismatch at argument 1 in template parameter list. Maximal possible value is 2.");
117 if constexpr (I == 0)
return birth;
118 if constexpr (I == 1)
return death;
119 if constexpr (I == 2)
return dim;
128 template <std::
size_t I>
129 constexpr auto&&
get() &&
noexcept {
130 static_assert(I < 3,
"Value mismatch at argument 1 in template parameter list. Maximal possible value is 2.");
132 if constexpr (I == 0)
return std::move(
birth);
133 if constexpr (I == 1)
return std::move(
death);
134 if constexpr (I == 2)
return std::move(
dim);
143 template <std::
size_t I>
144 constexpr const auto&&
get() const&& noexcept {
145 static_assert(I < 3,
"Value mismatch at argument 1 in template parameter list. Maximal possible value is 2.");
147 if constexpr (I == 0)
return std::move(
birth);
148 if constexpr (I == 1)
return std::move(
death);
149 if constexpr (I == 2)
return std::move(
dim);
166template <
typename Dimension,
typename Event_value>
167struct tuple_size<
Gudhi::persistence_matrix::Persistence_interval<Dimension, Event_value> >
168 : integral_constant<size_t, 3> {};
180template <
size_t I,
typename Dimension,
typename Event_value>
181struct tuple_element<I,
Gudhi::persistence_matrix::Persistence_interval<Dimension, Event_value> > {
182 static_assert(I < 3,
"Value mismatch at argument 1 in template parameter list. Maximal possible value is 2.");
184 using type =
typename conditional <I < 2, Event_value, Dimension>::type;
198template <
size_t I,
typename Dimension,
typename Event_value>
200 return i.template get<I>();
214template <
size_t I,
typename Dimension,
typename Event_value>
216 return i.template get<I>();
230template <
size_t I,
typename Dimension,
typename Event_value>
232 return std::move(i).template get<I>();
246template <
size_t I,
typename Dimension,
typename Event_value>
248 return std::move(i).template get<I>();
constexpr auto & get(Gudhi::persistence_matrix::Persistence_interval< Dimension, Event_value > &i) noexcept
Partial specialization of get for Gudhi::persistence_matrix::Persistence_interval.
Definition: persistence_interval.h:199
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Type for an interval in a persistent diagram or barcode. Stores the birth, death and dimension of the...
Definition: persistence_interval.h:40
constexpr const auto && get() const &&noexcept
Specialization of get for Gudhi::persistence_matrix::Persistence_interval.
Definition: persistence_interval.h:144
Dimension dim
Definition: persistence_interval.h:64
static constexpr Event_value inf
Stores the infinity value for birth and death events. Its value depends on the template parameter Eve...
Definition: persistence_interval.h:50
constexpr auto && get() &&noexcept
Specialization of get for Gudhi::persistence_matrix::Persistence_interval.
Definition: persistence_interval.h:129
Event_value death
Definition: persistence_interval.h:66
constexpr auto & get() &noexcept
Specialization of get for Gudhi::persistence_matrix::Persistence_interval.
Definition: persistence_interval.h:99
constexpr const auto & get() const &noexcept
Specialization of get for Gudhi::persistence_matrix::Persistence_interval.
Definition: persistence_interval.h:114
Event_value birth
Definition: persistence_interval.h:65
friend std::ostream & operator<<(std::ostream &stream, const Persistence_interval &interval)
operator<<
Definition: persistence_interval.h:74
Persistence_interval(Event_value birth=inf, Event_value death=inf, Dimension dim=-1)
Constructor.
Definition: persistence_interval.h:61