diff --git a/src/Multi_filtration/include/gudhi/Multi_critical_filtration.h b/src/Multi_filtration/include/gudhi/Multi_critical_filtration.h index 340f54d9a..8e665b47b 100644 --- a/src/Multi_filtration/include/gudhi/Multi_critical_filtration.h +++ b/src/Multi_filtration/include/gudhi/Multi_critical_filtration.h @@ -89,27 +89,27 @@ class Multi_critical_filtration { * @brief Default constructor. The constructed value will be either at infinity if `co` is true or at minus infinity * if `co` is false. */ - Multi_critical_filtration() : multi_filtration_(get_default_filtration_value()) {}; + Multi_critical_filtration() : multi_filtration_(_get_default_filtration_value()) {}; /** * @brief Constructs a filtration value with one generator and @p n parameters. * All parameters will be initialized at -inf if `co` is false and at inf if `co` is true. * * @warning The generator `{-inf, -inf, ...}`/`{inf, inf, ...}` with \f$ n > 1 \f$ entries is not considered as - * "(minus) infinity" (the resp. methods @ref is_minus_inf() and @ref is_inf() "", as well as the ones of the + * "(minus) infinity" (the resp. methods @ref is_minus_inf() and @ref is_plus_inf() "", as well as the ones of the * generator, will not return true). The `-inf/inf` are just meant as placeholders, at least one entry should be * modified by the user. * Otherwise, either use the static methods @ref minus_inf() or @ref inf(), or set @p n to 1 instead. * * @param n Number of parameters. */ - Multi_critical_filtration(int n) : multi_filtration_(1, Generator(n, get_default_value())) {}; + Multi_critical_filtration(int n) : multi_filtration_(1, Generator(n, _get_default_value())) {}; /** * @brief Constructs a filtration value with one generator and @p n parameters. All parameters will be initialized * with @p value. * * @warning If @p value is `inf`, `-inf`, or `NaN`, the generator `{value, value, ...}` with \f$ n > 1 \f$ entries * is not wrong but will not be considered as respectively "infinity", "minus infinity" or "NaN" (the corresponding - * methods @ref is_inf(), @ref is_minus_inf() and @ref is_nan() will return false). For this purpose, please use + * methods @ref is_plus_inf(), @ref is_minus_inf() and @ref is_nan() will return false). For this purpose, please use * the static methods @ref inf(), @ref minus_inf() and @ref nan() instead. * * @param n Number of parameters. @@ -142,13 +142,13 @@ class Multi_critical_filtration { * @pre All generators in the vector have to have the same number of parameters, i.e., size. * Furthermore, the generators have to be a minimal generating set. * - * @warning If the set of generators is not minimal, the behaviour of most methods is undefined. It is possible - * to call @ref simplify() after construction if there is a doubt to ensure this property. + * @warning If the set of generators is not minimal or not sorted, the behaviour of most methods is undefined. + * It is possible to call @ref simplify() after construction if there is a doubt to ensure this property. * * @param v Vector of generators. */ Multi_critical_filtration(const std::vector &v) - : multi_filtration_(v.empty() ? get_default_filtration_value() : v) {}; + : multi_filtration_(v.empty() ? _get_default_filtration_value() : v) {}; /** * @brief Constructs filtration value with as many generators than elements in the given vector and moves those * elements to initialize the generators. @@ -157,13 +157,13 @@ class Multi_critical_filtration { * @pre All generators in the vector have to have the same number of parameters, i.e., size. * Furthermore, the generators have to be a minimal generating set. * - * @warning If the set of generators is not minimal, the behaviour of most methods is undefined. It is possible - * to call @ref simplify() after construction if there is a doubt to ensure this property. + * @warning If the set of generators is not minimal or not sorted, the behaviour of most methods is undefined. + * It is possible to call @ref simplify() after construction if there is a doubt to ensure this property. * * @param v Vector of generators. */ Multi_critical_filtration(std::vector &&v) - : multi_filtration_(v.empty() ? get_default_filtration_value() : std::move(v)) {}; + : multi_filtration_(v.empty() ? _get_default_filtration_value() : std::move(v)) {}; /** * @brief Constructs a filtration value with one generator initialzed by the range given by the begin and end * iterators. @@ -199,11 +199,19 @@ class Multi_critical_filtration { /** * @brief Returns begin iterator of the generator range. + * + * @warning If the generator is modified and the new set of generators is not minimal or not sorted, the behaviour + * of most methods is undefined. It is possible to call @ref simplify() after construction if there is a doubt to + * ensure this property. */ iterator begin() { return multi_filtration_.begin(); } /** * @brief Returns end iterator of the generator range. + * + * @warning If the generator is modified and the new set of generators is not minimal or not sorted, the behaviour + * of most methods is undefined. It is possible to call @ref simplify() after construction if there is a doubt to + * ensure this property. */ iterator end() { return multi_filtration_.end(); } @@ -231,7 +239,7 @@ class Multi_critical_filtration { * @pre The filtration value is 1-critical. If there are more than one generator, only the first will be preserved * and if there is no generator, the method will segfault. */ - operator Generator() const { + operator Generator() { GUDHI_CHECK(num_generators() == 1, "Casting a " + std::to_string(num_generators()) + "-critical filtration value into an 1-critical filtration value."); return multi_filtration_[0]; @@ -257,6 +265,10 @@ class Multi_critical_filtration { /** * @brief Returns a reference to the underlying container storing the generators. + * + * @warning If a generator is modified and the new set of generators is not minimal or not sorted, the behaviour + * of most methods is undefined. It is possible to call @ref simplify() after construction if there is a doubt to + * ensure this property. */ const Generators &get_underlying_container() const { return multi_filtration_; } @@ -271,7 +283,7 @@ class Multi_critical_filtration { std::size_t num_generators() const { return multi_filtration_.size(); } /** - * @brief Returns a filtration value for which @ref is_inf() returns `true`. + * @brief Returns a filtration value for which @ref is_plus_inf() returns `true`. * * @return Infinity. */ @@ -298,7 +310,7 @@ class Multi_critical_filtration { /** * @brief Returns `true` if and only if the filtration value is considered as infinity. */ - bool is_inf() const { return multi_filtration_.size() == 1 && multi_filtration_[0].is_inf(); } + bool is_plus_inf() const { return multi_filtration_.size() == 1 && multi_filtration_[0].is_plus_inf(); } /** * @brief Returns `true` if and only if the filtration value is considered as minus infinity. @@ -322,10 +334,6 @@ class Multi_critical_filtration { // COMPARAISON OPERATORS // TODO : this costs a lot... optimize / cheat in some way for python ? - /* - * Checks if `this`, seen as a birth curve is under the `other` birth curve, - * - */ /** * @brief Returns `true` if and only if the positive cones generated by @p b are strictly contained in the @@ -340,7 +348,8 @@ class Multi_critical_filtration { // for each generator in b, verify if it is strictly in the cone of at least one generator of a bool isContained = false; for (std::size_t j = 0u; j < a.multi_filtration_.size() && !isContained; ++j) { - // i j. + if (_first_dominates(a.multi_filtration_[j], b.multi_filtration_[i])) return false; isContained = _strictly_contains(a.multi_filtration_[j], b.multi_filtration_[i]); } if (!isContained) return false; @@ -370,10 +379,11 @@ class Multi_critical_filtration { // check if this curves is below other's curve // ie for each guy in this, check if there is a guy in other that dominates him for (std::size_t i = 0u; i < b.multi_filtration_.size(); ++i) { - // for each generator in other, verify if it is in the cone of at least one generator of this + // for each generator in b, verify if it is in the cone of at least one generator of a bool isContained = false; for (std::size_t j = 0u; j < a.multi_filtration_.size() && !isContained; ++j) { - // i j. + if (_first_strictly_dominates(a.multi_filtration_[j], b.multi_filtration_[i])) return false; isContained = _contains(a.multi_filtration_[j], b.multi_filtration_[i]); } if (!isContained) return false; @@ -395,11 +405,8 @@ class Multi_critical_filtration { * @brief Returns `true` if and only if for each \f$ i \f$, \f$ a[i] \f$ is equal to \f$ b[i] \f$. */ friend bool operator==(const Multi_critical_filtration &a, const Multi_critical_filtration &b) { - if (a.num_generators() != b.num_generators()) return false; - for (auto i = 0u; i < a.num_generators(); i++) { - if (a[i] != b[i]) return false; - } - return true; + // assumes lexicographical order for both + return a.multi_filtration_ == b.multi_filtration_; } /** @@ -419,6 +426,9 @@ class Multi_critical_filtration { * non empty generators in the container. Make sure to fill them with real generators or to remove them before * using those methods. * + * @warning Be sure to call @ref simplify if necessary after setting all the generators. Most methods will have an + * undefined behaviour if the set of generators is not minimal or sorted. + * * @param n New number of generators. */ void set_num_generators(std::size_t n) { @@ -436,12 +446,12 @@ class Multi_critical_filtration { * @param x The target filtration value towards which to push. */ void push_to_least_common_upper_bound(const Generator &x) { - if (this->is_inf() || this->is_nan() || x.is_nan() || x.is_minus_inf()) return; + if (this->is_plus_inf() || this->is_nan() || x.is_nan() || x.is_minus_inf()) return; - GUDHI_CHECK(x.is_inf() || x.num_parameters() == multi_filtration_[0].num_parameters() || !is_finite(), + GUDHI_CHECK(x.is_plus_inf() || x.num_parameters() == multi_filtration_[0].num_parameters() || !is_finite(), "Pushing to a filtration value with different number of parameters."); - if (x.is_inf() || this->is_minus_inf()) { + if (x.is_plus_inf() || this->is_minus_inf()) { multi_filtration_ = {x}; return; } @@ -463,12 +473,12 @@ class Multi_critical_filtration { * @param x The target filtration value towards which to pull. */ void pull_to_greatest_common_lower_bound(const Generator &x) { - if (x.is_inf() || this->is_nan() || x.is_nan() || this->is_minus_inf()) return; + if (x.is_plus_inf() || this->is_nan() || x.is_nan() || this->is_minus_inf()) return; GUDHI_CHECK(x.is_minus_inf() || x.num_parameters() == multi_filtration_[0].num_parameters() || !is_finite(), "Pulling to a filtration value with different number of parameters."); - if (this->is_inf() || x.is_minus_inf()) { + if (this->is_plus_inf() || x.is_minus_inf()) { multi_filtration_ = {x}; return; } @@ -498,6 +508,7 @@ class Multi_critical_filtration { if (_generator_can_be_added(x, 0, end)) { multi_filtration_.resize(end); multi_filtration_.push_back(x); + std::sort(multi_filtration_.begin(), multi_filtration_.end(), Is_strictly_smaller_lexicographically()); return true; } @@ -520,8 +531,10 @@ class Multi_critical_filtration { /** * @brief Projects the filtration value into the given grid. If @p coordinate is false, the entries are set to - * the nearest upper bound value with the same parameter in the grid. Otherwise, the entries are set to the indices - * of those nearest upper bound values. + * the nearest upper bound value with the same parameter in the grid and the new generators are simplified and + * ordered. Otherwise, the entries are set to the indices of those nearest upper bound values. In this case, + * no simplification or sort are done, such that the new coordinates have a one by one correspondence with the + * positions of the old generators. * The grid has to be represented as a vector of ordered ranges of values convertible into `T`. An index * \f$ i \f$ of the vector corresponds to the same parameter as the index \f$ i \f$ in a generator. * The ranges correspond to the possible values of the parameters, ordered by increasing value, forming therefore @@ -557,15 +570,17 @@ class Multi_critical_filtration { multi_filtration_.erase(std::remove_if(multi_filtration_.begin(), multi_filtration_.end(), [include_infinities](const Generator &a) { return a.empty() || - ((include_infinities) && (a.is_inf() || a.is_minus_inf())); + ((include_infinities) && (a.is_plus_inf() || a.is_minus_inf())); }), multi_filtration_.end()); - if (multi_filtration_.empty()) multi_filtration_.push_back(Generator{get_default_value()}); + std::sort(multi_filtration_.begin(), multi_filtration_.end(), Is_strictly_smaller_lexicographically()); + if (multi_filtration_.empty()) multi_filtration_.push_back(Generator{_get_default_value()}); } /** - * @brief Simplifies the current set of generators such that it becomes minimal. Only necessary if generators were - * added "by hand" either trough the constructor or with @ref add_guaranteed_generator "". + * @brief Simplifies the current set of generators such that it becomes minimal. Also orders it in increasing + * lexicographical order. Only necessary if generators were added "by hand" without verification either trough the + * constructor or with @ref add_guaranteed_generator "", etc. */ void simplify() { std::size_t end = 0; @@ -578,6 +593,7 @@ class Multi_critical_filtration { } multi_filtration_.resize(end); + std::sort(multi_filtration_.begin(), multi_filtration_.end(), Is_strictly_smaller_lexicographically()); } // FONCTIONNALITIES @@ -591,7 +607,7 @@ class Multi_critical_filtration { Generator result(f.num_parameters(), Generator::T_inf); for (const auto &g : f) { if (g.is_nan() || g.is_minus_inf()) return g; - if (g.is_inf()) continue; + if (g.is_plus_inf()) continue; for (std::size_t i = 0; i < f.num_parameters(); ++i) { result[i] = std::min(result[i], g[i]); } @@ -607,7 +623,7 @@ class Multi_critical_filtration { if (f.num_generators() == 0) return Generator(); Generator result(f.num_parameters(), -Generator::T_inf); for (auto &g : f) { - if (g.is_nan() || g.is_inf()) return g; + if (g.is_nan() || g.is_plus_inf()) return g; if (g.is_minus_inf()) continue; for (std::size_t i = 0; i < g.num_parameters(); ++i) { result[i] = std::max(result[i], g[i]); @@ -701,7 +717,7 @@ class Multi_critical_filtration { * @brief Outstream operator. */ friend std::ostream &operator<<(std::ostream &stream, const Multi_critical_filtration &f) { - if (f.is_inf()) { + if (f.is_plus_inf()) { stream << "[inf, ..., inf]"; return stream; } @@ -734,9 +750,26 @@ class Multi_critical_filtration { private: Generators multi_filtration_; /**< Container for generators. */ - constexpr static T get_default_value() { return co ? Generator::T_inf : -Generator::T_inf; } + struct Is_strictly_smaller_lexicographically { + //assumes both generators have the same length if not infinite/nan. + bool operator()(const Generator &g1, const Generator &g2) { + if (g1.is_nan() || g2.is_nan()) return !g1.is_nan(); + if (g1.is_plus_inf()) return false; + if (g2.is_plus_inf()) return true; + if (g1.is_minus_inf()) return false; + if (g2.is_minus_inf()) return true; + + // g1 and g2 have to finite and of the same size + for (std::size_t i = 0; i < g1.size(); ++i) { + if (g1[i] != g2[i]) return g1[i] < g2[i]; + } + return false; + } + }; + + constexpr static T _get_default_value() { return co ? Generator::T_inf : -Generator::T_inf; } - constexpr static Generators get_default_filtration_value() { return Generators{Generator{get_default_value()}}; } + constexpr static Generators _get_default_filtration_value() { return Generators{Generator{_get_default_value()}}; } /** * @brief Verifies if @p b is strictly contained in the positive cone originating in `a`. @@ -758,6 +791,22 @@ class Multi_critical_filtration { return a <= b; } } + + static bool _first_strictly_dominates(const Generator& a, const Generator& b){ + if constexpr (co){ + return !a.empty() && !b.empty() && a[0] < b[0]; + } else { + return !a.empty() && !b.empty() && a[0] > b[0]; + } + } + + static bool _first_dominates(const Generator& a, const Generator& b){ + if constexpr (co){ + return !a.empty() && !b.empty() && a[0] <= b[0]; + } else { + return !a.empty() && !b.empty() && a[0] >= b[0]; + } + } enum class Rel { EQUAL, DOMINATES, IS_DOMINATED, NONE }; @@ -794,8 +843,9 @@ class Multi_critical_filtration { // assumes between 'curr' and 'end' everything is simplified: // no nan values and if there is an inf/-inf, then 'end - curr == 1' + // modifies multi_filtration_ only if true is returned. bool _generator_can_be_added(const Generator &x, std::size_t curr, std::size_t &end) { - if (x.empty() || x.is_nan() || (x.is_inf() && end - curr != 0)) return false; + if (x.empty() || x.is_nan() || (x.is_plus_inf() && end - curr != 0)) return false; if (x.is_minus_inf()) { if (end - curr == 1 && multi_filtration_[curr].is_minus_inf()) return false; diff --git a/src/Multi_filtration/include/gudhi/One_critical_filtration.h b/src/Multi_filtration/include/gudhi/One_critical_filtration.h index 010c96673..8b44fbfcb 100644 --- a/src/Multi_filtration/include/gudhi/One_critical_filtration.h +++ b/src/Multi_filtration/include/gudhi/One_critical_filtration.h @@ -99,7 +99,7 @@ class One_critical_filtration : public std::vector { * * @warning If @p value is `inf`, `-inf`, or `NaN`, the vector `{value, value, ...}` with \f$ n > 1 \f$ entries * is not wrong but will not be considered as respectively "infinity", "minus infinity" or "NaN" (the corresponding - * methods @ref is_inf(), @ref is_minus_inf() and @ref is_nan() will return false). For this purpose, please use + * methods @ref is_plus_inf(), @ref is_minus_inf() and @ref is_nan() will return false). For this purpose, please use * the static methods @ref inf(), @ref minus_inf() and @ref nan() instead. * * @param n Number of parameters. @@ -142,14 +142,6 @@ class One_critical_filtration : public std::vector { typename std::vector::const_iterator it_end) : Base(it_begin, it_end) {}; - /** - * @brief Assign operator. - */ - One_critical_filtration &operator=(const One_critical_filtration &a) { - Base::operator=(a); - return *this; - } - // HERITAGE using std::vector::operator[]; /**< Inheritance of entry access. */ @@ -157,16 +149,6 @@ class One_critical_filtration : public std::vector { // CONVERTERS - /** - * @brief Cast into `std::vector &`. - */ - operator std::vector &() const { return *this; } - - /** - * @brief Cast into `std::vector`. - */ - operator std::vector() const { return static_cast >(*this); } - // like numpy /** * @brief Returns a copy with entries casted into the type given as template parameter. @@ -193,7 +175,7 @@ class One_critical_filtration : public std::vector { std::size_t num_parameters() const { return Base::size(); } /** - * @brief Returns a filtration value for which @ref is_inf() returns `true`. + * @brief Returns a filtration value for which @ref is_plus_inf() returns `true`. * * @return Infinity. */ @@ -226,7 +208,7 @@ class One_critical_filtration : public std::vector { /** * @brief Returns `true` if and only if the filtration value is considered as infinity. */ - bool is_inf() const { + bool is_plus_inf() const { if (Base::size() != 1) return false; return (Base::operator[](0) == T_inf); } @@ -273,8 +255,8 @@ class One_critical_filtration : public std::vector { * does **not** imply \f$ a == b \f$. */ friend bool operator<(const One_critical_filtration &a, const One_critical_filtration &b) { - if (a.is_inf() || a.is_nan() || b.is_nan() || b.is_minus_inf()) return false; - if (b.is_inf() || a.is_minus_inf()) return true; + if (a.is_plus_inf() || a.is_nan() || b.is_nan() || b.is_minus_inf()) return false; + if (b.is_plus_inf() || a.is_minus_inf()) return true; bool isSame = true; auto n = a.size(); GUDHI_CHECK(a.size() == b.size(), "Two filtration values with different number of parameters are not comparable."); @@ -294,8 +276,8 @@ class One_critical_filtration : public std::vector { */ friend bool operator<=(const One_critical_filtration &a, const One_critical_filtration &b) { if (a.is_nan() || b.is_nan()) return false; - if (b.is_inf() || a.is_minus_inf()) return true; - if (a.is_inf() || b.is_minus_inf()) return false; + if (b.is_plus_inf() || a.is_minus_inf()) return true; + if (a.is_plus_inf() || b.is_minus_inf()) return false; auto n = a.size(); GUDHI_CHECK(a.size() == b.size(), "Two filtration values with different number of parameters are not comparable."); for (std::size_t i = 0u; i < n; ++i) { @@ -326,11 +308,7 @@ class One_critical_filtration : public std::vector { * @brief Returns `true` if and only if for each \f$ i \f$, \f$ a[i] \f$ is equal to \f$ b[i] \f$. */ friend bool operator==(const One_critical_filtration &a, const One_critical_filtration &b) { - if (a.num_parameters() != b.num_parameters()) return false; - for (auto i = 0u; i < a.num_parameters(); i++) { - if (a[i] != b[i]) return false; - } - return true; + return static_cast(a) == static_cast(b); } /** @@ -448,16 +426,16 @@ class One_critical_filtration : public std::vector { const One_critical_filtration &to_subtract) { if (result.empty()) return result; - if (result.is_nan() || to_subtract.is_nan() || (result.is_inf() && to_subtract.is_inf()) || + if (result.is_nan() || to_subtract.is_nan() || (result.is_plus_inf() && to_subtract.is_plus_inf()) || (result.is_minus_inf() && to_subtract.is_minus_inf())) { result = nan(); return result; } - if (result.is_inf() || to_subtract.is_minus_inf()) { + if (result.is_plus_inf() || to_subtract.is_minus_inf()) { result = inf(); return result; } - if (result.is_minus_inf() || to_subtract.is_inf()) { + if (result.is_minus_inf() || to_subtract.is_plus_inf()) { result = minus_inf(); return result; } @@ -488,12 +466,12 @@ class One_critical_filtration : public std::vector { friend One_critical_filtration &operator-=(One_critical_filtration &result, const T &to_subtract) { if (result.empty()) return result; - if (result.is_nan() || is_nan_(to_subtract) || (result.is_inf() && to_subtract == T_inf) || + if (result.is_nan() || is_nan_(to_subtract) || (result.is_plus_inf() && to_subtract == T_inf) || (result.is_minus_inf() && to_subtract == -T_inf)) { result = nan(); return result; } - if (result.is_inf() || to_subtract == -T_inf) { + if (result.is_plus_inf() || to_subtract == -T_inf) { result = inf(); return result; } @@ -583,12 +561,12 @@ class One_critical_filtration : public std::vector { friend One_critical_filtration &operator+=(One_critical_filtration &result, const One_critical_filtration &to_add) { if (result.empty()) return result; - if (result.is_nan() || to_add.is_nan() || (result.is_inf() && to_add.is_minus_inf()) || - (result.is_minus_inf() && to_add.is_inf())) { + if (result.is_nan() || to_add.is_nan() || (result.is_plus_inf() && to_add.is_minus_inf()) || + (result.is_minus_inf() && to_add.is_plus_inf())) { result = nan(); return result; } - if (result.is_inf() || to_add.is_inf()) { + if (result.is_plus_inf() || to_add.is_plus_inf()) { result = inf(); return result; } @@ -621,12 +599,12 @@ class One_critical_filtration : public std::vector { friend One_critical_filtration &operator+=(One_critical_filtration &result, const T &to_add) { if (result.empty()) return result; - if (result.is_nan() || is_nan_(to_add) || (result.is_inf() && to_add == -T_inf) || + if (result.is_nan() || is_nan_(to_add) || (result.is_plus_inf() && to_add == -T_inf) || (result.is_minus_inf() && to_add == T_inf)) { result = nan(); return result; } - if (result.is_inf() || to_add == T_inf) { + if (result.is_plus_inf() || to_add == T_inf) { result = inf(); return result; } @@ -737,8 +715,8 @@ class One_critical_filtration : public std::vector { return result; } - bool res_is_infinite = result.is_inf() || result.is_minus_inf(); - bool to_mul_is_infinite = to_mul.is_inf() || to_mul.is_minus_inf(); + bool res_is_infinite = result.is_plus_inf() || result.is_minus_inf(); + bool to_mul_is_infinite = to_mul.is_plus_inf() || to_mul.is_minus_inf(); if (res_is_infinite && to_mul_is_infinite) { if (to_mul.is_minus_inf()) { @@ -787,7 +765,7 @@ class One_critical_filtration : public std::vector { return result; } - if (result.is_inf() || result.is_minus_inf()) { + if (result.is_plus_inf() || result.is_minus_inf()) { if (to_mul == 0) result = nan(); else if (to_mul < 0) @@ -908,8 +886,8 @@ class One_critical_filtration : public std::vector { friend One_critical_filtration &operator/=(One_critical_filtration &result, const One_critical_filtration &to_div) { if (result.empty()) return result; - bool res_is_infinite = result.is_inf() || result.is_minus_inf(); - bool to_div_is_infinite = to_div.is_inf() || to_div.is_minus_inf(); + bool res_is_infinite = result.is_plus_inf() || result.is_minus_inf(); + bool to_div_is_infinite = to_div.is_plus_inf() || to_div.is_minus_inf(); if (result.is_nan() || to_div.is_nan() || (res_is_infinite && to_div_is_infinite)) { result = nan(); @@ -955,7 +933,7 @@ class One_critical_filtration : public std::vector { friend One_critical_filtration &operator/=(One_critical_filtration &result, const T &to_div) { if (result.empty()) return result; - bool res_is_infinite = result.is_inf() || result.is_minus_inf(); + bool res_is_infinite = result.is_plus_inf() || result.is_minus_inf(); bool to_div_is_infinite = to_div == T_inf || to_div == -T_inf; if (to_div == 0 || is_nan_(to_div) || result.is_nan() || (res_is_infinite && to_div_is_infinite)) { @@ -983,8 +961,8 @@ class One_critical_filtration : public std::vector { * @param x The target filtration value towards which to push. */ void push_to_least_common_upper_bound(const One_critical_filtration &x) { - if (this->is_inf() || this->is_nan() || x.is_nan() || x.is_minus_inf()) return; - if (x.is_inf() || this->is_minus_inf()) { + if (this->is_plus_inf() || this->is_nan() || x.is_nan() || x.is_minus_inf()) return; + if (x.is_plus_inf() || this->is_minus_inf()) { *this = x; return; } @@ -1006,8 +984,8 @@ class One_critical_filtration : public std::vector { * @param x The target filtration value towards which to pull. */ void pull_to_greatest_common_lower_bound(const One_critical_filtration &x) { - if (x.is_inf() || this->is_nan() || x.is_nan() || this->is_minus_inf()) return; - if (this->is_inf() || x.is_minus_inf()) { + if (x.is_plus_inf() || this->is_nan() || x.is_nan() || this->is_minus_inf()) return; + if (this->is_plus_inf() || x.is_minus_inf()) { *this = x; return; } @@ -1166,7 +1144,7 @@ class One_critical_filtration : public std::vector { * @brief Outstream operator. */ friend std::ostream &operator<<(std::ostream &stream, const One_critical_filtration &f) { - if (f.is_inf()) { + if (f.is_plus_inf()) { stream << "[inf, ..., inf]"; return stream; } @@ -1186,7 +1164,7 @@ class One_critical_filtration : public std::vector { for (std::size_t i = 0; i < f.size() - 1; i++) { stream << f[i] << ", "; } - if (!f.empty()) stream << f.back(); + stream << f.back(); stream << "]"; return stream; } diff --git a/src/Multi_filtration/test/multifiltration_multicritical_unit_test.cpp b/src/Multi_filtration/test/multifiltration_multicritical_unit_test.cpp index a57db7718..8fd28d4f4 100644 --- a/src/Multi_filtration/test/multifiltration_multicritical_unit_test.cpp +++ b/src/Multi_filtration/test/multifiltration_multicritical_unit_test.cpp @@ -121,19 +121,19 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_utilities, T, list_of_te BOOST_CHECK(f2[0][1] == 1.); BOOST_CHECK(f2[0][2] == 2.); - BOOST_CHECK(!f.is_inf()); + BOOST_CHECK(!f.is_plus_inf()); BOOST_CHECK(!f.is_minus_inf()); BOOST_CHECK(!f.is_nan()); BOOST_CHECK(f.is_finite()); Multi_critical_filtration f31; - BOOST_CHECK(!f31.is_inf()); + BOOST_CHECK(!f31.is_plus_inf()); BOOST_CHECK(f31.is_minus_inf()); BOOST_CHECK(!f31.is_nan()); BOOST_CHECK(!f31.is_finite()); Multi_critical_filtration f32; - BOOST_CHECK(f32.is_inf()); + BOOST_CHECK(f32.is_plus_inf()); BOOST_CHECK(!f32.is_minus_inf()); BOOST_CHECK(!f32.is_nan()); BOOST_CHECK(!f32.is_finite()); @@ -142,25 +142,25 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_utilities, T, list_of_te //the idea is just to reserve space and to give the possibility to use `f4[i] =` //if the value should really be -inf, use `f4(1)` or `f4 = minus_inf()` instead. Multi_critical_filtration f4(3); - BOOST_CHECK(!f4.is_inf()); + BOOST_CHECK(!f4.is_plus_inf()); BOOST_CHECK(!f4.is_minus_inf()); BOOST_CHECK(!f4.is_nan()); BOOST_CHECK(f4.is_finite()); Multi_critical_filtration f5(1); - BOOST_CHECK(!f5.is_inf()); + BOOST_CHECK(!f5.is_plus_inf()); BOOST_CHECK(f5.is_minus_inf()); BOOST_CHECK(!f5.is_nan()); BOOST_CHECK(!f5.is_finite()); auto f6 = Multi_critical_filtration::nan(); - BOOST_CHECK(!f6.is_inf()); + BOOST_CHECK(!f6.is_plus_inf()); BOOST_CHECK(!f6.is_minus_inf()); BOOST_CHECK(f6.is_nan()); BOOST_CHECK(!f6.is_finite()); auto f7 = Multi_critical_filtration::inf(); - BOOST_CHECK(f7.is_inf()); + BOOST_CHECK(f7.is_plus_inf()); BOOST_CHECK(!f7.is_minus_inf()); BOOST_CHECK(!f7.is_nan()); BOOST_CHECK(!f7.is_finite()); @@ -168,10 +168,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_utilities, T, list_of_te BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_comparators, T, list_of_tested_variants) { - Multi_critical_filtration f1({{0, 1, 2}, {-1, 4, 5}}); - Multi_critical_filtration f2({{-2, 0, 1}, {-5, 0, 0}, {-2, -5, -1}}); + Multi_critical_filtration f1({{-1, 4, 5}, {0, 1, 2}}); + Multi_critical_filtration f2({{-5, 0, 0}, {-2, -5, -1}, {-2, 0, 1}}); Multi_critical_filtration f3({4, 5, 6}); - Multi_critical_filtration f4({{0, 0, 1}, {-4, 5, 6}}); + Multi_critical_filtration f4({{-4, 5, 6}, {0, 0, 1}}); BOOST_CHECK(!(f1 < f1)); BOOST_CHECK(!(f1 < f2)); @@ -224,43 +224,43 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_comparators, T, list_of_ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_modifiers, T, list_of_tested_variants) { - Multi_critical_filtration f({{0, 1, 2}, {-3, 1, 7}}); - BOOST_CHECK_EQUAL(f[0][0], 0); + Multi_critical_filtration f({{-3, 1, 7}, {0, 1, 2}}); + BOOST_CHECK_EQUAL(f[0][0], -3); BOOST_CHECK_EQUAL(f[0][1], 1); - BOOST_CHECK_EQUAL(f[0][2], 2); - BOOST_CHECK_EQUAL(f[1][0], -3); + BOOST_CHECK_EQUAL(f[0][2], 7); + BOOST_CHECK_EQUAL(f[1][0], 0); BOOST_CHECK_EQUAL(f[1][1], 1); - BOOST_CHECK_EQUAL(f[1][2], 7); + BOOST_CHECK_EQUAL(f[1][2], 2); f.push_to_least_common_upper_bound({-1, 5, 6}); - BOOST_CHECK_EQUAL(f[0][0], 0); + BOOST_CHECK_EQUAL(f[0][0], -1); BOOST_CHECK_EQUAL(f[0][1], 5); - BOOST_CHECK_EQUAL(f[0][2], 6); - BOOST_CHECK_EQUAL(f[1][0], -1); + BOOST_CHECK_EQUAL(f[0][2], 7); + BOOST_CHECK_EQUAL(f[1][0], 0); BOOST_CHECK_EQUAL(f[1][1], 5); - BOOST_CHECK_EQUAL(f[1][2], 7); + BOOST_CHECK_EQUAL(f[1][2], 6); f.push_to_least_common_upper_bound({-1, -5, -6}); - BOOST_CHECK_EQUAL(f[0][0], 0); + BOOST_CHECK_EQUAL(f[0][0], -1); BOOST_CHECK_EQUAL(f[0][1], 5); - BOOST_CHECK_EQUAL(f[0][2], 6); - BOOST_CHECK_EQUAL(f[1][0], -1); + BOOST_CHECK_EQUAL(f[0][2], 7); + BOOST_CHECK_EQUAL(f[1][0], 0); BOOST_CHECK_EQUAL(f[1][1], 5); - BOOST_CHECK_EQUAL(f[1][2], 7); + BOOST_CHECK_EQUAL(f[1][2], 6); f.push_to_least_common_upper_bound(Multi_critical_filtration::Generator::minus_inf()); - BOOST_CHECK_EQUAL(f[0][0], 0); + BOOST_CHECK_EQUAL(f[0][0], -1); BOOST_CHECK_EQUAL(f[0][1], 5); - BOOST_CHECK_EQUAL(f[0][2], 6); - BOOST_CHECK_EQUAL(f[1][0], -1); + BOOST_CHECK_EQUAL(f[0][2], 7); + BOOST_CHECK_EQUAL(f[1][0], 0); BOOST_CHECK_EQUAL(f[1][1], 5); - BOOST_CHECK_EQUAL(f[1][2], 7); + BOOST_CHECK_EQUAL(f[1][2], 6); f.push_to_least_common_upper_bound(Multi_critical_filtration::Generator::inf()); - BOOST_CHECK(f.is_inf()); + BOOST_CHECK(f.is_plus_inf()); f.push_to_least_common_upper_bound(Multi_critical_filtration::Generator::nan()); - BOOST_CHECK(f.is_inf()); + BOOST_CHECK(f.is_plus_inf()); f.pull_to_greatest_common_lower_bound({-1, 5, 6}); BOOST_CHECK_EQUAL(f[0][0], -1); @@ -311,12 +311,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_add, T, list_of_tested_v BOOST_CHECK(res); BOOST_CHECK_EQUAL(f.num_generators(), 2); BOOST_CHECK_EQUAL(f.num_parameters(), 3); - BOOST_CHECK_EQUAL(f[0][0], 0); + BOOST_CHECK_EQUAL(f[0][0], -3); BOOST_CHECK_EQUAL(f[0][1], 1); - BOOST_CHECK_EQUAL(f[0][2], 2); - BOOST_CHECK_EQUAL(f[1][0], -3); + BOOST_CHECK_EQUAL(f[0][2], 7); + BOOST_CHECK_EQUAL(f[1][0], 0); BOOST_CHECK_EQUAL(f[1][1], 1); - BOOST_CHECK_EQUAL(f[1][2], 7); + BOOST_CHECK_EQUAL(f[1][2], 2); res = f.add_generator({-1, -2, -3}); BOOST_CHECK(res); @@ -382,17 +382,16 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_add, T, list_of_tested_v BOOST_CHECK_EQUAL(f2[0][0], 0); BOOST_CHECK_EQUAL(f2[0][1], 1); BOOST_CHECK_EQUAL(f2[0][2], 2); - BOOST_CHECK(f2[1].is_inf()); - BOOST_CHECK_EQUAL(f2[2][0], 0); - BOOST_CHECK_EQUAL(f2[2][1], 1); - BOOST_CHECK_EQUAL(f2[2][2], 2); + BOOST_CHECK_EQUAL(f2[1][0], 0); + BOOST_CHECK_EQUAL(f2[1][1], 1); + BOOST_CHECK_EQUAL(f2[1][2], 2); + BOOST_CHECK(f2[2].is_minus_inf()); + BOOST_CHECK(f2[3].is_plus_inf()); if constexpr (std::numeric_limits::has_quiet_NaN){ BOOST_CHECK_EQUAL(f2.num_generators(), 5); - BOOST_CHECK(f2[3].is_nan()); - BOOST_CHECK(f2[4].is_minus_inf()); + BOOST_CHECK(f2[4].is_nan()); } else { BOOST_CHECK_EQUAL(f2.num_generators(), 4); - BOOST_CHECK(f2[3].is_minus_inf()); } Multi_critical_filtration f3(v); @@ -455,7 +454,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_friends, T, list_of_test BOOST_AUTO_TEST_CASE_TEMPLATE(multi_critical_filtration_numerical_limits, T, list_of_tested_variants) { BOOST_CHECK(std::numeric_limits >::has_infinity); - BOOST_CHECK(std::numeric_limits >::infinity().is_inf()); + BOOST_CHECK(std::numeric_limits >::infinity().is_plus_inf()); BOOST_CHECK(std::numeric_limits >::quiet_NaN().is_nan()); BOOST_CHECK_THROW(std::numeric_limits >::max(), std::logic_error); auto max = std::numeric_limits >::max(2, 3); diff --git a/src/Multi_filtration/test/multifiltration_onecritical_unit_test.cpp b/src/Multi_filtration/test/multifiltration_onecritical_unit_test.cpp index db740613b..b7924405b 100644 --- a/src/Multi_filtration/test/multifiltration_onecritical_unit_test.cpp +++ b/src/Multi_filtration/test/multifiltration_onecritical_unit_test.cpp @@ -83,13 +83,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_utilities, T, list_of_test BOOST_CHECK(f2[1] == 1.); BOOST_CHECK(f2[2] == 2.); - BOOST_CHECK(!f.is_inf()); + BOOST_CHECK(!f.is_plus_inf()); BOOST_CHECK(!f.is_minus_inf()); BOOST_CHECK(!f.is_nan()); BOOST_CHECK(f.is_finite()); One_critical_filtration f3; - BOOST_CHECK(!f3.is_inf()); + BOOST_CHECK(!f3.is_plus_inf()); BOOST_CHECK(f3.is_minus_inf()); BOOST_CHECK(!f3.is_nan()); BOOST_CHECK(!f3.is_finite()); @@ -98,25 +98,25 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_utilities, T, list_of_test //the idea is just to reserve space and to give the possibility to use `f4[i] =` //if the value should really be -inf, use `f4(1)` or `f4 = minus_inf()` instead. One_critical_filtration f4(3); - BOOST_CHECK(!f4.is_inf()); + BOOST_CHECK(!f4.is_plus_inf()); BOOST_CHECK(!f4.is_minus_inf()); BOOST_CHECK(!f4.is_nan()); BOOST_CHECK(f4.is_finite()); One_critical_filtration f5(1); - BOOST_CHECK(!f5.is_inf()); + BOOST_CHECK(!f5.is_plus_inf()); BOOST_CHECK(f5.is_minus_inf()); BOOST_CHECK(!f5.is_nan()); BOOST_CHECK(!f5.is_finite()); auto f6 = One_critical_filtration::nan(); - BOOST_CHECK(!f6.is_inf()); + BOOST_CHECK(!f6.is_plus_inf()); BOOST_CHECK(!f6.is_minus_inf()); BOOST_CHECK(f6.is_nan()); BOOST_CHECK(!f6.is_finite()); auto f7 = One_critical_filtration::inf(); - BOOST_CHECK(f7.is_inf()); + BOOST_CHECK(f7.is_plus_inf()); BOOST_CHECK(!f7.is_minus_inf()); BOOST_CHECK(!f7.is_nan()); BOOST_CHECK(!f7.is_finite()); @@ -192,7 +192,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_operators, T, list_of_test BOOST_CHECK_EQUAL(res[1], 0); BOOST_CHECK_EQUAL(res[2], -1); BOOST_CHECK((-One_critical_filtration::inf()).is_minus_inf()); - BOOST_CHECK((-One_critical_filtration::minus_inf()).is_inf()); + BOOST_CHECK((-One_critical_filtration::minus_inf()).is_plus_inf()); BOOST_CHECK((-One_critical_filtration::nan()).is_nan()); res = f - f2; @@ -221,8 +221,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_operators, T, list_of_test BOOST_CHECK_EQUAL(res[2], -4); BOOST_CHECK((f - One_critical_filtration::inf()).is_minus_inf()); - BOOST_CHECK((One_critical_filtration::inf() - f).is_inf()); - BOOST_CHECK((f - One_critical_filtration::minus_inf()).is_inf()); + BOOST_CHECK((One_critical_filtration::inf() - f).is_plus_inf()); + BOOST_CHECK((f - One_critical_filtration::minus_inf()).is_plus_inf()); BOOST_CHECK((One_critical_filtration::minus_inf() - f).is_minus_inf()); BOOST_CHECK((f - One_critical_filtration::nan()).is_nan()); BOOST_CHECK((One_critical_filtration::nan() - f).is_nan()); @@ -254,8 +254,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_operators, T, list_of_test BOOST_CHECK_EQUAL(res[1], 5); BOOST_CHECK_EQUAL(res[2], 6); - BOOST_CHECK((f + One_critical_filtration::inf()).is_inf()); - BOOST_CHECK((One_critical_filtration::inf() + f).is_inf()); + BOOST_CHECK((f + One_critical_filtration::inf()).is_plus_inf()); + BOOST_CHECK((One_critical_filtration::inf() + f).is_plus_inf()); BOOST_CHECK((f + One_critical_filtration::minus_inf()).is_minus_inf()); BOOST_CHECK((One_critical_filtration::minus_inf() + f).is_minus_inf()); BOOST_CHECK((f + One_critical_filtration::nan()).is_nan()); @@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_operators, T, list_of_test BOOST_CHECK(res.is_nan()); res = f3 * f3; - BOOST_CHECK(res.is_inf()); + BOOST_CHECK(res.is_plus_inf()); res = f3 * f4; BOOST_CHECK(res.is_minus_inf()); @@ -427,10 +427,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_modifiers, T, list_of_test BOOST_CHECK_EQUAL(f[2], 6); f.push_to_least_common_upper_bound(One_critical_filtration::inf()); - BOOST_CHECK(f.is_inf()); + BOOST_CHECK(f.is_plus_inf()); f.push_to_least_common_upper_bound(One_critical_filtration::nan()); - BOOST_CHECK(f.is_inf()); + BOOST_CHECK(f.is_plus_inf()); f.pull_to_greatest_common_lower_bound({-1, 5, 6}); BOOST_CHECK_EQUAL(f[0], -1); @@ -493,7 +493,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_friends, T, list_of_tested BOOST_AUTO_TEST_CASE_TEMPLATE(one_critical_filtration_numerical_limits, T, list_of_tested_variants) { BOOST_CHECK(std::numeric_limits >::has_infinity); - BOOST_CHECK(std::numeric_limits >::infinity().is_inf()); + BOOST_CHECK(std::numeric_limits >::infinity().is_plus_inf()); BOOST_CHECK(std::numeric_limits >::quiet_NaN().is_nan()); BOOST_CHECK_THROW(std::numeric_limits >::max(), std::logic_error); auto max = std::numeric_limits >::max(3); diff --git a/src/Multi_persistence/include/gudhi/Multi_persistence/Box.h b/src/Multi_persistence/include/gudhi/Multi_persistence/Box.h index e93442db2..2f90f4d99 100644 --- a/src/Multi_persistence/include/gudhi/Multi_persistence/Box.h +++ b/src/Multi_persistence/include/gudhi/Multi_persistence/Box.h @@ -61,7 +61,7 @@ class Box { * * @param box Pair of corners defining the wished box. */ - Box(const std::pair &box) : lowerCorner_(box.first), upperCorner_(box.second) {} + Box(const std::pair &box) : Box(box.first, box.second) {} /** * @brief Returns the lowest of both defining corners. @@ -103,7 +103,7 @@ class Box { */ bool is_trivial() const { return lowerCorner_.empty() || upperCorner_.empty() || lowerCorner_.is_nan() || upperCorner_.is_nan() || - (lowerCorner_.is_inf() && upperCorner_.is_inf()) || + (lowerCorner_.is_plus_inf() && upperCorner_.is_plus_inf()) || (lowerCorner_.is_minus_inf() && upperCorner_.is_minus_inf()) || (lowerCorner_.is_finite() && upperCorner_.is_finite() && lowerCorner_.num_parameters() != upperCorner_.num_parameters()); @@ -116,7 +116,7 @@ class Box { */ bool contains(const Point &point) const { if (point.is_nan() || is_trivial()) return false; - if (point.is_inf()) return upperCorner_.is_inf(); + if (point.is_plus_inf()) return upperCorner_.is_plus_inf(); if (point.is_minus_inf()) return lowerCorner_.is_minus_inf(); if ((lowerCorner_.is_finite() && point.size() != lowerCorner_.size()) || @@ -134,7 +134,7 @@ class Box { */ std::size_t dimension() const { if (is_trivial()) return 0; - if (lowerCorner_.is_minus_inf() && upperCorner_.is_inf()) return 0; // not so sure what we want to do here + if (lowerCorner_.is_minus_inf() && upperCorner_.is_plus_inf()) return 0; // not so sure what we want to do here return lowerCorner_.is_finite() ? lowerCorner_.size() : upperCorner_.size(); } diff --git a/src/Multi_persistence/include/gudhi/Multi_persistence/Line.h b/src/Multi_persistence/include/gudhi/Multi_persistence/Line.h index 4f52d141a..702ab958a 100644 --- a/src/Multi_persistence/include/gudhi/Multi_persistence/Line.h +++ b/src/Multi_persistence/include/gudhi/Multi_persistence/Line.h @@ -134,7 +134,7 @@ class Line { constexpr const U inf = std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : std::numeric_limits::max(); - if (x.is_inf() || x.is_nan()) return inf; + if (x.is_plus_inf() || x.is_nan()) return inf; if (x.is_minus_inf()) return -inf; U t = -inf; if (direction_.size()) { @@ -163,7 +163,7 @@ class Line { U compute_forward_intersection(const K_critical_point &x) const { constexpr const U inf = std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : std::numeric_limits::max(); - if (x.is_inf() || x.is_nan()) return inf; + if (x.is_plus_inf() || x.is_nan()) return inf; if (x.is_minus_inf()) return -inf; U t = inf; for (const auto &y : x) { @@ -183,7 +183,7 @@ class Line { U compute_backward_intersection(const Point &x) const { constexpr const U inf = std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : std::numeric_limits::max(); - if (x.is_inf()) return inf; + if (x.is_plus_inf()) return inf; if (x.is_minus_inf() || x.is_nan()) return -inf; U t = inf; @@ -212,7 +212,7 @@ class Line { U compute_backward_intersection(const K_critical_point &x) const { constexpr const U inf = std::numeric_limits::has_infinity ? std::numeric_limits::infinity() : std::numeric_limits::max(); - if (x.is_inf()) return inf; + if (x.is_plus_inf()) return inf; if (x.is_minus_inf() || x.is_nan()) return -inf; U t = -inf; for (const auto &y : x) { diff --git a/src/Multi_persistence/test/multipersistence_box_unit_test.cpp b/src/Multi_persistence/test/multipersistence_box_unit_test.cpp index 5bda24785..353df8aeb 100644 --- a/src/Multi_persistence/test/multipersistence_box_unit_test.cpp +++ b/src/Multi_persistence/test/multipersistence_box_unit_test.cpp @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(box_other, T, list_of_tested_variants) BOOST_CHECK_EQUAL(bottom[0], -4); BOOST_CHECK_EQUAL(bottom[1], -3); BOOST_CHECK_EQUAL(bottom[2], -2); - BOOST_CHECK(top.is_inf()); + BOOST_CHECK(top.is_plus_inf()); bottom = P::minus_inf(); top = {4,5,6}; @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(box_other, T, list_of_tested_variants) b.inflate(2); BOOST_CHECK(bottom.is_minus_inf()); - BOOST_CHECK(top.is_inf()); + BOOST_CHECK(top.is_plus_inf()); } diff --git a/src/Multi_persistence/test/multipersistence_line_unit_test.cpp b/src/Multi_persistence/test/multipersistence_line_unit_test.cpp index 8b8344337..6450fb385 100644 --- a/src/Multi_persistence/test/multipersistence_line_unit_test.cpp +++ b/src/Multi_persistence/test/multipersistence_line_unit_test.cpp @@ -100,8 +100,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(line_intersections, T, list_of_tested_variants) BOOST_CHECK_EQUAL(top[2], T(3. + T(7. / 6.) * 6.)); bounds = l.get_bounds({{-10, 0, 10}, {10, 1, 10}}); - BOOST_CHECK(bounds.first.is_inf()); - BOOST_CHECK(bounds.second.is_inf()); + BOOST_CHECK(bounds.first.is_plus_inf()); + BOOST_CHECK(bounds.second.is_plus_inf()); } BOOST_AUTO_TEST_CASE_TEMPLATE(line_other, T, list_of_tested_variants) diff --git a/src/Simplex_tree/test/simplex_tree_multi_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_multi_unit_test.cpp index 972b34037..09d21ca14 100644 --- a/src/Simplex_tree/test/simplex_tree_multi_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_multi_unit_test.cpp @@ -9,7 +9,6 @@ */ #include -#include #include #include #include // std::pair, std::make_pair @@ -932,7 +931,7 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing_on_multi_nan_values) { Stree_multi st; BOOST_CHECK(std::numeric_limits::quiet_NaN().is_nan()); - BOOST_CHECK(std::numeric_limits::infinity().is_inf()); + BOOST_CHECK(std::numeric_limits::infinity().is_plus_inf()); st.insert_simplex_and_subfaces({2, 1, 0}, {1.,2.,3.}); st.insert_simplex_and_subfaces({3, 0}, {1.,2.,3.}); @@ -976,7 +975,7 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing_on_multi_nan_values) { bool is_zero = dim == 0 && contains0; std::clog << "Filtration: " << filt << std::endl; if (is_zero) BOOST_CHECK(filt.is_nan()); - else if (contains3) BOOST_CHECK(filt.is_inf()); + else if (contains3) BOOST_CHECK(filt.is_plus_inf()); else BOOST_CHECK(filt == OneCriticalFiltration({1.,2.,3.})); } }