18#ifndef COMMON_PERSISTENCE_REPRESENTATIONS_H_
19#define COMMON_PERSISTENCE_REPRESENTATIONS_H_
27#include <boost/math/constants/constants.hpp>
30namespace Persistence_representations {
45inline constexpr double pi = boost::math::constants::pi<double>();
56inline double epsi = 0.000005;
67 if (std::fabs(a - b) <
epsi)
return true;
77inline constexpr double minus_length(
const std::pair<double, double>& a) {
return a.first - a.second; }
84inline constexpr double birth_plus_deaths(
const std::pair<double, double>& a) {
return a.first + a.second; }
94inline constexpr bool compare_points_sorting(
const std::pair<double, double>& f,
const std::pair<double, double>& s)
96 if (f.first < s.first) {
99 if (f.first > s.first) {
102 if (f.second > s.second) {
122 const std::pair<double, double>& p2)
124 const double a = (p2.second - p1.second) / (p2.first - p1.first);
125 const double b = p1.second - a * p1.first;
126 return std::make_pair(a, b);
135 const std::pair<double, double>& p2)
137 if (p1.first == p2.first)
return p1.first;
138 if (p1.second * p2.second > 0) {
139 std::ostringstream errMessage;
140 errMessage <<
"In function find_zero_of_a_line_segment_between_those_two_points the arguments are: (" << p1.first
141 <<
"," << p1.second <<
") and (" << p2.first <<
"," << p2.second
142 <<
"). There is no zero in line between those two points. Program terminated.";
143 throw std::invalid_argument(errMessage.str());
158inline double function_value(
const std::pair<double, double>& p1,
const std::pair<double, double>& p2,
double x)
double find_zero_of_a_line_segment_between_those_two_points(const std::pair< double, double > &p1, const std::pair< double, double > &p2)
Definition common_persistence_representations.h:134
std::pair< double, double > compute_parameters_of_a_line(const std::pair< double, double > &p1, const std::pair< double, double > &p2)
Definition common_persistence_representations.h:121
constexpr double pi
Definition common_persistence_representations.h:45
std::vector< std::pair< double, double > > Persistence_diagram
Definition common_persistence_representations.h:38
double function_value(const std::pair< double, double > &p1, const std::pair< double, double > &p2, double x)
Definition common_persistence_representations.h:158
bool almost_equal(double a, double b)
Definition common_persistence_representations.h:65
double epsi
Definition common_persistence_representations.h:56
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14