summaryrefslogtreecommitdiff
path: root/src/Persistence_representations/include/gudhi
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2020-05-20 08:42:23 +0200
committerGard Spreemann <gspr@nonempty.org>2020-05-20 08:42:23 +0200
commit9b3079646ee3f6a494b83e864b3e10b8a93597d0 (patch)
tree63ecae8cf0d09b72907805e68f19765c7dd9694a /src/Persistence_representations/include/gudhi
parent81816dae256a9f3c0653b1d21443c3c32da7a974 (diff)
parent97e889f34e929f3c2306803b6c37b57926bd1245 (diff)
Merge tag 'tags/gudhi-release-3.2.0' into dfsg/latest
Diffstat (limited to 'src/Persistence_representations/include/gudhi')
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_heat_maps.h66
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_intervals.h56
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_landscape.h222
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h122
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_vectors.h30
-rw-r--r--src/Persistence_representations/include/gudhi/read_persistence_from_file.h16
6 files changed, 256 insertions, 256 deletions
diff --git a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h
index b1af3503..fab88489 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h
@@ -55,9 +55,9 @@ std::vector<std::vector<double> > create_Gaussian_filter(size_t pixel_radius, do
}
if (dbg) {
- std::cerr << "Kernel initialize \n";
- std::cerr << "pixel_radius : " << pixel_radius << std::endl;
- std::cerr << "kernel.size() : " << kernel.size() << std::endl;
+ std::clog << "Kernel initialize \n";
+ std::clog << "pixel_radius : " << pixel_radius << std::endl;
+ std::clog << "kernel.size() : " << kernel.size() << std::endl;
getchar();
}
@@ -79,12 +79,12 @@ std::vector<std::vector<double> > create_Gaussian_filter(size_t pixel_radius, do
}
if (dbg) {
- std::cerr << "Here is the kernel : \n";
+ std::clog << "Here is the kernel : \n";
for (size_t i = 0; i != kernel.size(); ++i) {
for (size_t j = 0; j != kernel[i].size(); ++j) {
- std::cerr << kernel[i][j] << " ";
+ std::clog << kernel[i][j] << " ";
}
- std::cerr << std::endl;
+ std::clog << std::endl;
}
}
return kernel;
@@ -290,16 +290,16 @@ class Persistence_heat_maps {
bool dbg = false;
if (this->heat_map.size() != second.heat_map.size()) {
if (dbg)
- std::cerr << "this->heat_map.size() : " << this->heat_map.size()
+ std::clog << "this->heat_map.size() : " << this->heat_map.size()
<< " \n second.heat_map.size() : " << second.heat_map.size() << std::endl;
return false;
}
if (this->min_ != second.min_) {
- if (dbg) std::cerr << "this->min_ : " << this->min_ << ", second.min_ : " << second.min_ << std::endl;
+ if (dbg) std::clog << "this->min_ : " << this->min_ << ", second.min_ : " << second.min_ << std::endl;
return false;
}
if (this->max_ != second.max_) {
- if (dbg) std::cerr << "this->max_ : " << this->max_ << ", second.max_ : " << second.max_ << std::endl;
+ if (dbg) std::clog << "this->max_ : " << this->max_ << ", second.max_ : " << second.max_ << std::endl;
return false;
}
// in the other case we may assume that the persistence images are defined on the same domain.
@@ -322,15 +322,15 @@ class Persistence_heat_maps {
bool operator==(const Persistence_heat_maps& rhs) const {
bool dbg = false;
if (!this->check_if_the_same(rhs)) {
- if (dbg) std::cerr << "The domains are not the same \n";
+ if (dbg) std::clog << "The domains are not the same \n";
return false; // in this case, the domains are not the same, so the maps cannot be the same.
}
for (size_t i = 0; i != this->heat_map.size(); ++i) {
for (size_t j = 0; j != this->heat_map[i].size(); ++j) {
if (!almost_equal(this->heat_map[i][j], rhs.heat_map[i][j])) {
if (dbg) {
- std::cerr << "this->heat_map[" << i << "][" << j << "] = " << this->heat_map[i][j] << std::endl;
- std::cerr << "rhs.heat_map[" << i << "][" << j << "] = " << rhs.heat_map[i][j] << std::endl;
+ std::clog << "this->heat_map[" << i << "][" << j << "] = " << this->heat_map[i][j] << std::endl;
+ std::clog << "rhs.heat_map[" << i << "][" << j << "] = " << rhs.heat_map[i][j] << std::endl;
}
return false;
}
@@ -586,14 +586,14 @@ void Persistence_heat_maps<Scalling_of_kernels>::construct(const std::vector<std
bool erase_below_diagonal, size_t number_of_pixels,
double min_, double max_) {
bool dbg = false;
- if (dbg) std::cerr << "Entering construct procedure \n";
+ if (dbg) std::clog << "Entering construct procedure \n";
Scalling_of_kernels f;
this->f = f;
- if (dbg) std::cerr << "min and max passed to construct() procedure: " << min_ << " " << max_ << std::endl;
+ if (dbg) std::clog << "min and max passed to construct() procedure: " << min_ << " " << max_ << std::endl;
if (min_ == max_) {
- if (dbg) std::cerr << "min and max parameters will be determined based on intervals \n";
+ if (dbg) std::clog << "min and max parameters will be determined based on intervals \n";
// in this case, we want the program to set up the min_ and max_ values by itself.
min_ = std::numeric_limits<int>::max();
max_ = -std::numeric_limits<int>::max();
@@ -611,9 +611,9 @@ void Persistence_heat_maps<Scalling_of_kernels>::construct(const std::vector<std
}
if (dbg) {
- std::cerr << "min_ : " << min_ << std::endl;
- std::cerr << "max_ : " << max_ << std::endl;
- std::cerr << "number_of_pixels : " << number_of_pixels << std::endl;
+ std::clog << "min_ : " << min_ << std::endl;
+ std::clog << "max_ : " << max_ << std::endl;
+ std::clog << "number_of_pixels : " << number_of_pixels << std::endl;
getchar();
}
@@ -628,7 +628,7 @@ void Persistence_heat_maps<Scalling_of_kernels>::construct(const std::vector<std
}
this->heat_map = heat_map_;
- if (dbg) std::cerr << "Done creating of the heat map, now we will fill in the structure \n";
+ if (dbg) std::clog << "Done creating of the heat map, now we will fill in the structure \n";
for (size_t pt_nr = 0; pt_nr != intervals_.size(); ++pt_nr) {
// compute the value of intervals_[pt_nr] in the grid:
@@ -638,9 +638,9 @@ void Persistence_heat_maps<Scalling_of_kernels>::construct(const std::vector<std
static_cast<int>((intervals_[pt_nr].second - this->min_) / (this->max_ - this->min_) * number_of_pixels);
if (dbg) {
- std::cerr << "point : " << intervals_[pt_nr].first << " , " << intervals_[pt_nr].second << std::endl;
- std::cerr << "x_grid : " << x_grid << std::endl;
- std::cerr << "y_grid : " << y_grid << std::endl;
+ std::clog << "point : " << intervals_[pt_nr].first << " , " << intervals_[pt_nr].second << std::endl;
+ std::clog << "x_grid : " << x_grid << std::endl;
+ std::clog << "y_grid : " << y_grid << std::endl;
}
// x_grid and y_grid gives a center of the kernel. We want to have its lower left corner. To get this, we need to
@@ -650,9 +650,9 @@ void Persistence_heat_maps<Scalling_of_kernels>::construct(const std::vector<std
// note that the numbers x_grid and y_grid may be negative.
if (dbg) {
- std::cerr << "After shift : \n";
- std::cerr << "x_grid : " << x_grid << std::endl;
- std::cerr << "y_grid : " << y_grid << std::endl;
+ std::clog << "After shift : \n";
+ std::clog << "x_grid : " << x_grid << std::endl;
+ std::clog << "y_grid : " << y_grid << std::endl;
}
double scaling_value = this->f(intervals_[pt_nr]);
@@ -663,11 +663,11 @@ void Persistence_heat_maps<Scalling_of_kernels>::construct(const std::vector<std
if (((x_grid + i) >= 0) && (x_grid + i < this->heat_map.size()) && ((y_grid + j) >= 0) &&
(y_grid + j < this->heat_map.size())) {
if (dbg) {
- std::cerr << y_grid + j << " " << x_grid + i << std::endl;
+ std::clog << y_grid + j << " " << x_grid + i << std::endl;
}
this->heat_map[y_grid + j][x_grid + i] += scaling_value * filter[i][j];
if (dbg) {
- std::cerr << "Position : (" << x_grid + i << "," << y_grid + j
+ std::clog << "Position : (" << x_grid + i << "," << y_grid + j
<< ") got increased by the value : " << filter[i][j] << std::endl;
}
}
@@ -805,7 +805,7 @@ void Persistence_heat_maps<Scalling_of_kernels>::plot(const char* filename) cons
out << std::endl;
}
out.close();
- std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ std::clog << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
<< gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
@@ -842,7 +842,7 @@ void Persistence_heat_maps<Scalling_of_kernels>::load_from_file(const char* file
in >> this->min_ >> this->max_;
if (dbg) {
- std::cerr << "Reading the following values of min and max : " << this->min_ << " , " << this->max_ << std::endl;
+ std::clog << "Reading the following values of min and max : " << this->min_ << " , " << this->max_ << std::endl;
}
std::string temp;
@@ -859,18 +859,18 @@ void Persistence_heat_maps<Scalling_of_kernels>::load_from_file(const char* file
lineSS >> point;
line_of_heat_map.push_back(point);
if (dbg) {
- std::cout << point << " ";
+ std::clog << point << " ";
}
}
if (dbg) {
- std::cout << std::endl;
+ std::clog << std::endl;
getchar();
}
if (in.good()) this->heat_map.push_back(line_of_heat_map);
}
in.close();
- if (dbg) std::cout << "Done \n";
+ if (dbg) std::clog << "Done \n";
}
// Concretizations of virtual methods:
@@ -878,7 +878,7 @@ template <typename Scalling_of_kernels>
std::vector<double> Persistence_heat_maps<Scalling_of_kernels>::vectorize(int number_of_function) const {
std::vector<double> result;
if (!discrete) {
- std::cout << "No vectorize method in case of infinite dimensional vectorization" << std::endl;
+ std::cerr << "No vectorize method in case of infinite dimensional vectorization" << std::endl;
return result;
}
diff --git a/src/Persistence_representations/include/gudhi/Persistence_intervals.h b/src/Persistence_representations/include/gudhi/Persistence_intervals.h
index ea4220ea..a6c1d6f0 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_intervals.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_intervals.h
@@ -185,7 +185,7 @@ class Persistence_intervals {
out.close();
- std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ std::clog << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
<< gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
@@ -293,7 +293,7 @@ std::vector<std::pair<double, double> > Persistence_intervals::dominant_interval
for (size_t i = 0; i != std::min(where_to_cut, position_length_vector.size()); ++i) {
result.push_back(this->intervals[position_length_vector[i].first]);
if (dbg)
- std::cerr << "Position : " << position_length_vector[i].first << " length : " << position_length_vector[i].second
+ std::clog << "Position : " << position_length_vector[i].first << " length : " << position_length_vector[i].second
<< std::endl;
}
@@ -303,7 +303,7 @@ std::vector<std::pair<double, double> > Persistence_intervals::dominant_interval
std::vector<size_t> Persistence_intervals::histogram_of_lengths(size_t number_of_bins) const {
bool dbg = false;
- if (dbg) std::cerr << "this->intervals.size() : " << this->intervals.size() << std::endl;
+ if (dbg) std::clog << "this->intervals.size() : " << this->intervals.size() << std::endl;
// first find the length of the longest interval:
double lengthOfLongest = 0;
for (size_t i = 0; i != this->intervals.size(); ++i) {
@@ -313,7 +313,7 @@ std::vector<size_t> Persistence_intervals::histogram_of_lengths(size_t number_of
}
if (dbg) {
- std::cerr << "lengthOfLongest : " << lengthOfLongest << std::endl;
+ std::clog << "lengthOfLongest : " << lengthOfLongest << std::endl;
}
// this is a container we will use to store the resulting histogram
@@ -330,10 +330,10 @@ std::vector<size_t> Persistence_intervals::histogram_of_lengths(size_t number_of
++result[position];
if (dbg) {
- std::cerr << "i : " << i << std::endl;
- std::cerr << "Interval : [" << this->intervals[i].first << " , " << this->intervals[i].second << " ] \n";
- std::cerr << "relative_length_of_this_interval : " << relative_length_of_this_interval << std::endl;
- std::cerr << "position : " << position << std::endl;
+ std::clog << "i : " << i << std::endl;
+ std::clog << "Interval : [" << this->intervals[i].first << " , " << this->intervals[i].second << " ] \n";
+ std::clog << "relative_length_of_this_interval : " << relative_length_of_this_interval << std::endl;
+ std::clog << "position : " << position << std::endl;
getchar();
}
}
@@ -342,7 +342,7 @@ std::vector<size_t> Persistence_intervals::histogram_of_lengths(size_t number_of
result.resize(number_of_bins);
if (dbg) {
- for (size_t i = 0; i != result.size(); ++i) std::cerr << result[i] << std::endl;
+ for (size_t i = 0; i != result.size(); ++i) std::clog << result[i] << std::endl;
}
return result;
}
@@ -368,7 +368,7 @@ std::vector<double> Persistence_intervals::characteristic_function_of_diagram(do
for (size_t i = 0; i != this->intervals.size(); ++i) {
if (dbg) {
- std::cerr << "Interval : " << this->intervals[i].first << " , " << this->intervals[i].second << std::endl;
+ std::clog << "Interval : " << this->intervals[i].first << " , " << this->intervals[i].second << std::endl;
}
size_t beginIt = 0;
@@ -390,8 +390,8 @@ std::vector<double> Persistence_intervals::characteristic_function_of_diagram(do
}
if (dbg) {
- std::cerr << "beginIt : " << beginIt << std::endl;
- std::cerr << "endIt : " << endIt << std::endl;
+ std::clog << "beginIt : " << beginIt << std::endl;
+ std::clog << "endIt : " << endIt << std::endl;
}
for (size_t pos = beginIt; pos != endIt; ++pos) {
@@ -399,11 +399,11 @@ std::vector<double> Persistence_intervals::characteristic_function_of_diagram(do
(this->intervals[i].second - this->intervals[i].first);
}
if (dbg) {
- std::cerr << "Result at this stage \n";
+ std::clog << "Result at this stage \n";
for (size_t aa = 0; aa != result.size(); ++aa) {
- std::cerr << result[aa] << " ";
+ std::clog << result[aa] << " ";
}
- std::cerr << std::endl;
+ std::clog << std::endl;
}
}
return result;
@@ -455,9 +455,9 @@ inline double compute_euclidean_distance(const std::pair<double, double>& f, con
std::vector<double> Persistence_intervals::k_n_n(size_t k, size_t where_to_cut) const {
bool dbg = false;
if (dbg) {
- std::cerr << "Here are the intervals : \n";
+ std::clog << "Here are the intervals : \n";
for (size_t i = 0; i != this->intervals.size(); ++i) {
- std::cerr << "[ " << this->intervals[i].first << " , " << this->intervals[i].second << "] \n";
+ std::clog << "[ " << this->intervals[i].first << " , " << this->intervals[i].second << "] \n";
}
getchar();
}
@@ -486,12 +486,12 @@ std::vector<double> Persistence_intervals::k_n_n(size_t k, size_t where_to_cut)
distances_from_diagonal[i] = distanceToDiagonal;
if (dbg) {
- std::cerr << "Here are the distances form the point : [" << this->intervals[i].first << " , "
+ std::clog << "Here are the distances form the point : [" << this->intervals[i].first << " , "
<< this->intervals[i].second << "] in the diagram \n";
for (size_t aa = 0; aa != distancesFromI.size(); ++aa) {
- std::cerr << "To : " << i + aa << " : " << distancesFromI[aa] << " ";
+ std::clog << "To : " << i + aa << " : " << distancesFromI[aa] << " ";
}
- std::cerr << std::endl;
+ std::clog << std::endl;
getchar();
}
@@ -502,18 +502,18 @@ std::vector<double> Persistence_intervals::k_n_n(size_t k, size_t where_to_cut)
}
}
if (dbg) {
- std::cerr << "Here is the distance matrix : \n";
+ std::clog << "Here is the distance matrix : \n";
for (size_t i = 0; i != distances.size(); ++i) {
for (size_t j = 0; j != distances.size(); ++j) {
- std::cerr << distances[i][j] << " ";
+ std::clog << distances[i][j] << " ";
}
- std::cerr << std::endl;
+ std::clog << std::endl;
}
- std::cerr << std::endl << std::endl << "And here are the distances to the diagonal : " << std::endl;
+ std::clog << std::endl << std::endl << "And here are the distances to the diagonal : " << std::endl;
for (size_t i = 0; i != distances_from_diagonal.size(); ++i) {
- std::cerr << distances_from_diagonal[i] << " ";
+ std::clog << distances_from_diagonal[i] << " ";
}
- std::cerr << std::endl << std::endl;
+ std::clog << std::endl << std::endl;
getchar();
}
@@ -526,13 +526,13 @@ std::vector<double> Persistence_intervals::k_n_n(size_t k, size_t where_to_cut)
if (k > distancesFromI.size()) {
if (dbg) {
- std::cerr << "There are not enough neighbors in your set. We set the result to plus infty \n";
+ std::clog << "There are not enough neighbors in your set. We set the result to plus infty \n";
}
result.push_back(std::numeric_limits<double>::max());
} else {
if (distances_from_diagonal[i] > distancesFromI[k]) {
if (dbg) {
- std::cerr << "The k-th n.n. is on a diagonal. Therefore we set up a distance to diagonal \n";
+ std::clog << "The k-th n.n. is on a diagonal. Therefore we set up a distance to diagonal \n";
}
result.push_back(distances_from_diagonal[i]);
} else {
diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape.h b/src/Persistence_representations/include/gudhi/Persistence_landscape.h
index b819ccb6..ce4065b8 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_landscape.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_landscape.h
@@ -343,7 +343,7 @@ class Persistence_landscape {
bool dbg = false;
if (dbg) {
- std::cerr << "to_average.size() : " << to_average.size() << std::endl;
+ std::clog << "to_average.size() : " << to_average.size() << std::endl;
}
std::vector<Persistence_landscape*> nextLevelMerge(to_average.size());
@@ -357,13 +357,13 @@ class Persistence_landscape {
while (nextLevelMerge.size() != 1) {
if (dbg) {
- std::cerr << "nextLevelMerge.size() : " << nextLevelMerge.size() << std::endl;
+ std::clog << "nextLevelMerge.size() : " << nextLevelMerge.size() << std::endl;
}
std::vector<Persistence_landscape*> nextNextLevelMerge;
nextNextLevelMerge.reserve(to_average.size());
for (size_t i = 0; i < nextLevelMerge.size(); i = i + 2) {
if (dbg) {
- std::cerr << "i : " << i << std::endl;
+ std::clog << "i : " << i << std::endl;
}
Persistence_landscape* l = new Persistence_landscape;
if (i + 1 != nextLevelMerge.size()) {
@@ -374,7 +374,7 @@ class Persistence_landscape {
nextNextLevelMerge.push_back(l);
}
if (dbg) {
- std::cerr << "After this iteration \n";
+ std::clog << "After this iteration \n";
getchar();
}
@@ -471,25 +471,25 @@ Persistence_landscape::Persistence_landscape(const char* filename, size_t dimens
bool operatorEqualDbg = false;
bool Persistence_landscape::operator==(const Persistence_landscape& rhs) const {
if (this->land.size() != rhs.land.size()) {
- if (operatorEqualDbg) std::cerr << "1\n";
+ if (operatorEqualDbg) std::clog << "1\n";
return false;
}
for (size_t level = 0; level != this->land.size(); ++level) {
if (this->land[level].size() != rhs.land[level].size()) {
- if (operatorEqualDbg) std::cerr << "this->land[level].size() : " << this->land[level].size() << "\n";
- if (operatorEqualDbg) std::cerr << "rhs.land[level].size() : " << rhs.land[level].size() << "\n";
- if (operatorEqualDbg) std::cerr << "2\n";
+ if (operatorEqualDbg) std::clog << "this->land[level].size() : " << this->land[level].size() << "\n";
+ if (operatorEqualDbg) std::clog << "rhs.land[level].size() : " << rhs.land[level].size() << "\n";
+ if (operatorEqualDbg) std::clog << "2\n";
return false;
}
for (size_t i = 0; i != this->land[level].size(); ++i) {
if (!(almost_equal(this->land[level][i].first, rhs.land[level][i].first) &&
almost_equal(this->land[level][i].second, rhs.land[level][i].second))) {
if (operatorEqualDbg)
- std::cerr << "this->land[level][i] : " << this->land[level][i].first << " " << this->land[level][i].second
+ std::clog << "this->land[level][i] : " << this->land[level][i].first << " " << this->land[level][i].second
<< "\n";
if (operatorEqualDbg)
- std::cerr << "rhs.land[level][i] : " << rhs.land[level][i].first << " " << rhs.land[level][i].second << "\n";
- if (operatorEqualDbg) std::cerr << "3\n";
+ std::clog << "rhs.land[level][i] : " << rhs.land[level][i].first << " " << rhs.land[level][i].second << "\n";
+ if (operatorEqualDbg) std::clog << "3\n";
return false;
}
}
@@ -507,7 +507,7 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
const std::vector<std::pair<double, double> >& p, size_t number_of_levels) {
bool dbg = false;
if (dbg) {
- std::cerr << "Persistence_landscape::Persistence_landscape( const std::vector< std::pair< double , double > >& p )"
+ std::clog << "Persistence_landscape::Persistence_landscape( const std::vector< std::pair< double , double > >& p )"
<< std::endl;
}
@@ -517,9 +517,9 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
std::sort(bars.begin(), bars.end(), compare_points_sorting);
if (dbg) {
- std::cerr << "Bars : \n";
+ std::clog << "Bars : \n";
for (size_t i = 0; i != bars.size(); ++i) {
- std::cerr << bars[i].first << " " << bars[i].second << "\n";
+ std::clog << bars[i].first << " " << bars[i].second << "\n";
}
getchar();
}
@@ -534,7 +534,7 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
while (!characteristicPoints.empty()) {
if (dbg) {
for (size_t i = 0; i != characteristicPoints.size(); ++i) {
- std::cout << "(" << characteristicPoints[i].first << " " << characteristicPoints[i].second << ")\n";
+ std::clog << "(" << characteristicPoints[i].first << " " << characteristicPoints[i].second << ")\n";
}
std::cin.ignore();
}
@@ -545,7 +545,7 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
lambda_n.push_back(characteristicPoints[0]);
if (dbg) {
- std::cerr << "1 Adding to lambda_n : (" << -std::numeric_limits<int>::max() << " " << 0 << ") , ("
+ std::clog << "1 Adding to lambda_n : (" << -std::numeric_limits<int>::max() << " " << 0 << ") , ("
<< minus_length(characteristicPoints[0]) << " " << 0 << ") , (" << characteristicPoints[0].first << " "
<< characteristicPoints[0].second << ") \n";
}
@@ -562,13 +562,13 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
(birth_plus_deaths(lambda_n[lambda_n.size() - 1]) - minus_length(characteristicPoints[i])) / 2);
lambda_n.push_back(point);
if (dbg) {
- std::cerr << "2 Adding to lambda_n : (" << point.first << " " << point.second << ")\n";
+ std::clog << "2 Adding to lambda_n : (" << point.first << " " << point.second << ")\n";
}
if (dbg) {
- std::cerr << "characteristicPoints[i+p] : " << characteristicPoints[i + p].first << " "
+ std::clog << "characteristicPoints[i+p] : " << characteristicPoints[i + p].first << " "
<< characteristicPoints[i + p].second << "\n";
- std::cerr << "point : " << point.first << " " << point.second << "\n";
+ std::clog << "point : " << point.first << " " << point.second << "\n";
getchar();
}
@@ -577,7 +577,7 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
(birth_plus_deaths(point) <= birth_plus_deaths(characteristicPoints[i + p]))) {
newCharacteristicPoints.push_back(characteristicPoints[i + p]);
if (dbg) {
- std::cerr << "3.5 Adding to newCharacteristicPoints : (" << characteristicPoints[i + p].first << " "
+ std::clog << "3.5 Adding to newCharacteristicPoints : (" << characteristicPoints[i + p].first << " "
<< characteristicPoints[i + p].second << ")\n";
getchar();
}
@@ -586,7 +586,7 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
newCharacteristicPoints.push_back(point);
if (dbg) {
- std::cerr << "4 Adding to newCharacteristicPoints : (" << point.first << " " << point.second << ")\n";
+ std::clog << "4 Adding to newCharacteristicPoints : (" << point.first << " " << point.second << ")\n";
}
while ((i + p < characteristicPoints.size()) &&
@@ -594,15 +594,15 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
(birth_plus_deaths(point) >= birth_plus_deaths(characteristicPoints[i + p]))) {
newCharacteristicPoints.push_back(characteristicPoints[i + p]);
if (dbg) {
- std::cerr << "characteristicPoints[i+p] : " << characteristicPoints[i + p].first << " "
+ std::clog << "characteristicPoints[i+p] : " << characteristicPoints[i + p].first << " "
<< characteristicPoints[i + p].second << "\n";
- std::cerr << "point : " << point.first << " " << point.second << "\n";
- std::cerr << "characteristicPoints[i+p] birth and death : " << minus_length(characteristicPoints[i + p])
+ std::clog << "point : " << point.first << " " << point.second << "\n";
+ std::clog << "characteristicPoints[i+p] birth and death : " << minus_length(characteristicPoints[i + p])
<< " , " << birth_plus_deaths(characteristicPoints[i + p]) << "\n";
- std::cerr << "point birth and death : " << minus_length(point) << " , " << birth_plus_deaths(point)
+ std::clog << "point birth and death : " << minus_length(point) << " , " << birth_plus_deaths(point)
<< "\n";
- std::cerr << "3 Adding to newCharacteristicPoints : (" << characteristicPoints[i + p].first << " "
+ std::clog << "3 Adding to newCharacteristicPoints : (" << characteristicPoints[i + p].first << " "
<< characteristicPoints[i + p].second << ")\n";
getchar();
}
@@ -613,20 +613,20 @@ void Persistence_landscape::construct_persistence_landscape_from_barcode(
lambda_n.push_back(std::make_pair(birth_plus_deaths(lambda_n[lambda_n.size() - 1]), 0));
lambda_n.push_back(std::make_pair(minus_length(characteristicPoints[i]), 0));
if (dbg) {
- std::cerr << "5 Adding to lambda_n : (" << birth_plus_deaths(lambda_n[lambda_n.size() - 1]) << " " << 0
+ std::clog << "5 Adding to lambda_n : (" << birth_plus_deaths(lambda_n[lambda_n.size() - 1]) << " " << 0
<< ")\n";
- std::cerr << "5 Adding to lambda_n : (" << minus_length(characteristicPoints[i]) << " " << 0 << ")\n";
+ std::clog << "5 Adding to lambda_n : (" << minus_length(characteristicPoints[i]) << " " << 0 << ")\n";
}
}
lambda_n.push_back(characteristicPoints[i]);
if (dbg) {
- std::cerr << "6 Adding to lambda_n : (" << characteristicPoints[i].first << " "
+ std::clog << "6 Adding to lambda_n : (" << characteristicPoints[i].first << " "
<< characteristicPoints[i].second << ")\n";
}
} else {
newCharacteristicPoints.push_back(characteristicPoints[i]);
if (dbg) {
- std::cerr << "7 Adding to newCharacteristicPoints : (" << characteristicPoints[i].first << " "
+ std::clog << "7 Adding to newCharacteristicPoints : (" << characteristicPoints[i].first << " "
<< characteristicPoints[i].second << ")\n";
}
}
@@ -692,7 +692,7 @@ double Persistence_landscape::compute_integral_of_landscape(double p) const {
double result = 0;
for (size_t i = 0; i != this->land.size(); ++i) {
for (size_t nr = 2; nr != this->land[i].size() - 1; ++nr) {
- if (dbg) std::cout << "nr : " << nr << "\n";
+ if (dbg) std::clog << "nr : " << nr << "\n";
// In this interval, the landscape has a form f(x) = ax+b. We want to compute integral of (ax+b)^p = 1/a *
// (ax+b)^{p+1}/(p+1)
std::pair<double, double> coef = compute_parameters_of_a_line(this->land[i][nr], this->land[i][nr - 1]);
@@ -700,7 +700,7 @@ double Persistence_landscape::compute_integral_of_landscape(double p) const {
double b = coef.second;
if (dbg)
- std::cout << "(" << this->land[i][nr].first << "," << this->land[i][nr].second << ") , "
+ std::clog << "(" << this->land[i][nr].first << "," << this->land[i][nr].second << ") , "
<< this->land[i][nr - 1].first << "," << this->land[i][nr].second << ")" << std::endl;
if (this->land[i][nr].first == this->land[i][nr - 1].first) continue;
if (a != 0) {
@@ -710,8 +710,8 @@ double Persistence_landscape::compute_integral_of_landscape(double p) const {
result += (this->land[i][nr].first - this->land[i][nr - 1].first) * (pow(this->land[i][nr].second, p));
}
if (dbg) {
- std::cout << "a : " << a << " , b : " << b << std::endl;
- std::cout << "result : " << result << std::endl;
+ std::clog << "a : " << a << " , b : " << b << std::endl;
+ std::clog << "result : " << result << std::endl;
}
}
}
@@ -730,31 +730,31 @@ double Persistence_landscape::compute_value_at_a_given_point(unsigned level, dou
unsigned coordEnd = this->land[level].size() - 2;
if (compute_value_at_a_given_pointDbg) {
- std::cerr << "Here \n";
- std::cerr << "x : " << x << "\n";
- std::cerr << "this->land[level][coordBegin].first : " << this->land[level][coordBegin].first << "\n";
- std::cerr << "this->land[level][coordEnd].first : " << this->land[level][coordEnd].first << "\n";
+ std::clog << "Here \n";
+ std::clog << "x : " << x << "\n";
+ std::clog << "this->land[level][coordBegin].first : " << this->land[level][coordBegin].first << "\n";
+ std::clog << "this->land[level][coordEnd].first : " << this->land[level][coordEnd].first << "\n";
}
// in this case x is outside the support of the landscape, therefore the value of the landscape is 0.
if (x <= this->land[level][coordBegin].first) return 0;
if (x >= this->land[level][coordEnd].first) return 0;
- if (compute_value_at_a_given_pointDbg) std::cerr << "Entering to the while loop \n";
+ if (compute_value_at_a_given_pointDbg) std::clog << "Entering to the while loop \n";
while (coordBegin + 1 != coordEnd) {
if (compute_value_at_a_given_pointDbg) {
- std::cerr << "coordBegin : " << coordBegin << "\n";
- std::cerr << "coordEnd : " << coordEnd << "\n";
- std::cerr << "this->land[level][coordBegin].first : " << this->land[level][coordBegin].first << "\n";
- std::cerr << "this->land[level][coordEnd].first : " << this->land[level][coordEnd].first << "\n";
+ std::clog << "coordBegin : " << coordBegin << "\n";
+ std::clog << "coordEnd : " << coordEnd << "\n";
+ std::clog << "this->land[level][coordBegin].first : " << this->land[level][coordBegin].first << "\n";
+ std::clog << "this->land[level][coordEnd].first : " << this->land[level][coordEnd].first << "\n";
}
unsigned newCord = (unsigned)floor((coordEnd + coordBegin) / 2.0);
if (compute_value_at_a_given_pointDbg) {
- std::cerr << "newCord : " << newCord << "\n";
- std::cerr << "this->land[level][newCord].first : " << this->land[level][newCord].first << "\n";
+ std::clog << "newCord : " << newCord << "\n";
+ std::clog << "this->land[level][newCord].first : " << this->land[level][newCord].first << "\n";
std::cin.ignore();
}
@@ -767,12 +767,12 @@ double Persistence_landscape::compute_value_at_a_given_point(unsigned level, dou
}
if (compute_value_at_a_given_pointDbg) {
- std::cout << "x : " << x << " is between : " << this->land[level][coordBegin].first << " a "
+ std::clog << "x : " << x << " is between : " << this->land[level][coordBegin].first << " a "
<< this->land[level][coordEnd].first << "\n";
- std::cout << "the y coords are : " << this->land[level][coordBegin].second << " a "
+ std::clog << "the y coords are : " << this->land[level][coordBegin].second << " a "
<< this->land[level][coordEnd].second << "\n";
- std::cerr << "coordBegin : " << coordBegin << "\n";
- std::cerr << "coordEnd : " << coordEnd << "\n";
+ std::clog << "coordBegin : " << coordBegin << "\n";
+ std::clog << "coordEnd : " << coordEnd << "\n";
std::cin.ignore();
}
return function_value(this->land[level][coordBegin], this->land[level][coordEnd], x);
@@ -810,13 +810,13 @@ Persistence_landscape Persistence_landscape::abs() {
Persistence_landscape result;
for (size_t level = 0; level != this->land.size(); ++level) {
if (AbsDbg) {
- std::cout << "level: " << level << std::endl;
+ std::clog << "level: " << level << std::endl;
}
std::vector<std::pair<double, double> > lambda_n;
lambda_n.push_back(std::make_pair(-std::numeric_limits<int>::max(), 0));
for (size_t i = 1; i != this->land[level].size(); ++i) {
if (AbsDbg) {
- std::cout << "this->land[" << level << "][" << i << "] : " << this->land[level][i].first << " "
+ std::clog << "this->land[" << level << "][" << i << "] : " << this->land[level][i].first << " "
<< this->land[level][i].second << std::endl;
}
// if a line segment between this->land[level][i-1] and this->land[level][i] crosses the x-axis, then we have to
@@ -828,15 +828,15 @@ Persistence_landscape Persistence_landscape::abs() {
lambda_n.push_back(std::make_pair(zero, 0));
lambda_n.push_back(std::make_pair(this->land[level][i].first, fabs(this->land[level][i].second)));
if (AbsDbg) {
- std::cout << "Adding pair : (" << zero << ",0)" << std::endl;
- std::cout << "In the same step adding pair : (" << this->land[level][i].first << ","
+ std::clog << "Adding pair : (" << zero << ",0)" << std::endl;
+ std::clog << "In the same step adding pair : (" << this->land[level][i].first << ","
<< fabs(this->land[level][i].second) << ") " << std::endl;
std::cin.ignore();
}
} else {
lambda_n.push_back(std::make_pair(this->land[level][i].first, fabs(this->land[level][i].second)));
if (AbsDbg) {
- std::cout << "Adding pair : (" << this->land[level][i].first << "," << fabs(this->land[level][i].second)
+ std::clog << "Adding pair : (" << this->land[level][i].first << "," << fabs(this->land[level][i].second)
<< ") " << std::endl;
std::cin.ignore();
}
@@ -851,13 +851,13 @@ Persistence_landscape* Persistence_landscape::new_abs() {
Persistence_landscape* result = new Persistence_landscape(*this);
for (size_t level = 0; level != this->land.size(); ++level) {
if (AbsDbg) {
- std::cout << "level: " << level << std::endl;
+ std::clog << "level: " << level << std::endl;
}
std::vector<std::pair<double, double> > lambda_n;
lambda_n.push_back(std::make_pair(-std::numeric_limits<int>::max(), 0));
for (size_t i = 1; i != this->land[level].size(); ++i) {
if (AbsDbg) {
- std::cout << "this->land[" << level << "][" << i << "] : " << this->land[level][i].first << " "
+ std::clog << "this->land[" << level << "][" << i << "] : " << this->land[level][i].first << " "
<< this->land[level][i].second << std::endl;
}
// if a line segment between this->land[level][i-1] and this->land[level][i] crosses the x-axis, then we have to
@@ -869,15 +869,15 @@ Persistence_landscape* Persistence_landscape::new_abs() {
lambda_n.push_back(std::make_pair(zero, 0));
lambda_n.push_back(std::make_pair(this->land[level][i].first, fabs(this->land[level][i].second)));
if (AbsDbg) {
- std::cout << "Adding pair : (" << zero << ",0)" << std::endl;
- std::cout << "In the same step adding pair : (" << this->land[level][i].first << ","
+ std::clog << "Adding pair : (" << zero << ",0)" << std::endl;
+ std::clog << "In the same step adding pair : (" << this->land[level][i].first << ","
<< fabs(this->land[level][i].second) << ") " << std::endl;
std::cin.ignore();
}
} else {
lambda_n.push_back(std::make_pair(this->land[level][i].first, fabs(this->land[level][i].second)));
if (AbsDbg) {
- std::cout << "Adding pair : (" << this->land[level][i].first << "," << fabs(this->land[level][i].second)
+ std::clog << "Adding pair : (" << this->land[level][i].first << "," << fabs(this->land[level][i].second)
<< ") " << std::endl;
std::cin.ignore();
}
@@ -943,11 +943,11 @@ void Persistence_landscape::load_landscape_from_file(const char* filename) {
lineSS >> endd;
landscapeAtThisLevel.push_back(std::make_pair(beginn, endd));
if (dbg) {
- std::cerr << "Reading a point : " << beginn << " , " << endd << std::endl;
+ std::clog << "Reading a point : " << beginn << " , " << endd << std::endl;
}
} else {
if (dbg) {
- std::cout << "IGNORE LINE\n";
+ std::clog << "IGNORE LINE\n";
getchar();
}
if (!isThisAFirsLine) {
@@ -975,7 +975,7 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
const Persistence_landscape& land2) {
bool operation_on_pair_of_landscapesDBG = false;
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "operation_on_pair_of_landscapes\n";
+ std::clog << "operation_on_pair_of_landscapes\n";
std::cin.ignore();
}
Persistence_landscape result;
@@ -985,8 +985,8 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
if (operation_on_pair_of_landscapesDBG) {
for (size_t i = 0; i != std::min(land1.land.size(), land2.land.size()); ++i) {
- std::cerr << "land1.land[" << i << "].size() : " << land1.land[i].size() << std::endl;
- std::cerr << "land2.land[" << i << "].size() : " << land2.land[i].size() << std::endl;
+ std::clog << "land1.land[" << i << "].size() : " << land1.land[i].size() << std::endl;
+ std::clog << "land2.land[" << i << "].size() : " << land2.land[i].size() << std::endl;
}
getchar();
}
@@ -997,20 +997,20 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
size_t q = 0;
while ((p + 1 < land1.land[i].size()) && (q + 1 < land2.land[i].size())) {
if (operation_on_pair_of_landscapesDBG) {
- std::cerr << "p : " << p << "\n";
- std::cerr << "q : " << q << "\n";
- std::cerr << "land1.land.size() : " << land1.land.size() << std::endl;
- std::cerr << "land2.land.size() : " << land2.land.size() << std::endl;
- std::cerr << "land1.land[" << i << "].size() : " << land1.land[i].size() << std::endl;
- std::cerr << "land2.land[" << i << "].size() : " << land2.land[i].size() << std::endl;
- std::cout << "land1.land[i][p].first : " << land1.land[i][p].first << "\n";
- std::cout << "land2.land[i][q].first : " << land2.land[i][q].first << "\n";
+ std::clog << "p : " << p << "\n";
+ std::clog << "q : " << q << "\n";
+ std::clog << "land1.land.size() : " << land1.land.size() << std::endl;
+ std::clog << "land2.land.size() : " << land2.land.size() << std::endl;
+ std::clog << "land1.land[" << i << "].size() : " << land1.land[i].size() << std::endl;
+ std::clog << "land2.land[" << i << "].size() : " << land2.land[i].size() << std::endl;
+ std::clog << "land1.land[i][p].first : " << land1.land[i][p].first << "\n";
+ std::clog << "land2.land[i][q].first : " << land2.land[i][q].first << "\n";
}
if (land1.land[i][p].first < land2.land[i][q].first) {
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "first \n";
- std::cout << " function_value(land2.land[i][q-1],land2.land[i][q],land1.land[i][p].first) : "
+ std::clog << "first \n";
+ std::clog << " function_value(land2.land[i][q-1],land2.land[i][q],land1.land[i][p].first) : "
<< function_value(land2.land[i][q - 1], land2.land[i][q], land1.land[i][p].first) << "\n";
}
lambda_n.push_back(
@@ -1022,12 +1022,12 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
}
if (land1.land[i][p].first > land2.land[i][q].first) {
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "Second \n";
- std::cout << "function_value(" << land1.land[i][p - 1].first << " " << land1.land[i][p - 1].second << " ,"
+ std::clog << "Second \n";
+ std::clog << "function_value(" << land1.land[i][p - 1].first << " " << land1.land[i][p - 1].second << " ,"
<< land1.land[i][p].first << " " << land1.land[i][p].second << ", " << land2.land[i][q].first
<< " ) : " << function_value(land1.land[i][p - 1], land1.land[i][p - 1], land2.land[i][q].first)
<< "\n";
- std::cout << "oper( " << function_value(land1.land[i][p], land1.land[i][p - 1], land2.land[i][q].first) << ","
+ std::clog << "oper( " << function_value(land1.land[i][p], land1.land[i][p - 1], land2.land[i][q].first) << ","
<< land2.land[i][q].second << " : "
<< oper(land2.land[i][q].second,
function_value(land1.land[i][p], land1.land[i][p - 1], land2.land[i][q].first))
@@ -1040,19 +1040,19 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
continue;
}
if (land1.land[i][p].first == land2.land[i][q].first) {
- if (operation_on_pair_of_landscapesDBG) std::cout << "Third \n";
+ if (operation_on_pair_of_landscapesDBG) std::clog << "Third \n";
lambda_n.push_back(
std::make_pair(land2.land[i][q].first, oper(land1.land[i][p].second, land2.land[i][q].second)));
++p;
++q;
}
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "Next iteration \n";
+ std::clog << "Next iteration \n";
}
}
while ((p + 1 < land1.land[i].size()) && (q + 1 >= land2.land[i].size())) {
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "New point : " << land1.land[i][p].first
+ std::clog << "New point : " << land1.land[i][p].first
<< " oper(land1.land[i][p].second,0) : " << oper(land1.land[i][p].second, 0) << std::endl;
}
lambda_n.push_back(std::make_pair(land1.land[i][p].first, oper(land1.land[i][p].second, 0)));
@@ -1060,7 +1060,7 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
}
while ((p + 1 >= land1.land[i].size()) && (q + 1 < land2.land[i].size())) {
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "New point : " << land2.land[i][q].first
+ std::clog << "New point : " << land2.land[i][q].first
<< " oper(0,land2.land[i][q].second) : " << oper(0, land2.land[i][q].second) << std::endl;
}
lambda_n.push_back(std::make_pair(land2.land[i][q].first, oper(0, land2.land[i][q].second)));
@@ -1073,7 +1073,7 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
}
if (land1.land.size() > std::min(land1.land.size(), land2.land.size())) {
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "land1.land.size() > std::min( land1.land.size() , land2.land.size() )" << std::endl;
+ std::clog << "land1.land.size() > std::min( land1.land.size() , land2.land.size() )" << std::endl;
}
for (size_t i = std::min(land1.land.size(), land2.land.size()); i != std::max(land1.land.size(), land2.land.size());
++i) {
@@ -1088,7 +1088,7 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
}
if (land2.land.size() > std::min(land1.land.size(), land2.land.size())) {
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "( land2.land.size() > std::min( land1.land.size() , land2.land.size() ) ) " << std::endl;
+ std::clog << "( land2.land.size() > std::min( land1.land.size() , land2.land.size() ) ) " << std::endl;
}
for (size_t i = std::min(land1.land.size(), land2.land.size()); i != std::max(land1.land.size(), land2.land.size());
++i) {
@@ -1102,7 +1102,7 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
}
}
if (operation_on_pair_of_landscapesDBG) {
- std::cout << "operation_on_pair_of_landscapes END\n";
+ std::clog << "operation_on_pair_of_landscapes END\n";
std::cin.ignore();
}
return result;
@@ -1110,20 +1110,20 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap
double compute_maximal_distance_non_symmetric(const Persistence_landscape& pl1, const Persistence_landscape& pl2) {
bool dbg = false;
- if (dbg) std::cerr << " compute_maximal_distance_non_symmetric \n";
+ if (dbg) std::clog << " compute_maximal_distance_non_symmetric \n";
// this distance is not symmetric. It compute ONLY distance between inflection points of pl1 and pl2.
double maxDist = 0;
size_t minimalNumberOfLevels = std::min(pl1.land.size(), pl2.land.size());
for (size_t level = 0; level != minimalNumberOfLevels; ++level) {
if (dbg) {
- std::cerr << "Level : " << level << std::endl;
- std::cerr << "PL1 : \n";
+ std::clog << "Level : " << level << std::endl;
+ std::clog << "PL1 : \n";
for (size_t i = 0; i != pl1.land[level].size(); ++i) {
- std::cerr << "(" << pl1.land[level][i].first << "," << pl1.land[level][i].second << ") \n";
+ std::clog << "(" << pl1.land[level][i].first << "," << pl1.land[level][i].second << ") \n";
}
- std::cerr << "PL2 : \n";
+ std::clog << "PL2 : \n";
for (size_t i = 0; i != pl2.land[level].size(); ++i) {
- std::cerr << "(" << pl2.land[level][i].first << "," << pl2.land[level][i].second << ") \n";
+ std::clog << "(" << pl2.land[level][i].first << "," << pl2.land[level][i].second << ") \n";
}
std::cin.ignore();
}
@@ -1143,24 +1143,24 @@ double compute_maximal_distance_non_symmetric(const Persistence_landscape& pl1,
if (maxDist <= val) maxDist = val;
if (dbg) {
- std::cerr << pl1.land[level][i].first << "in [" << pl2.land[level][p2Count].first << ","
+ std::clog << pl1.land[level][i].first << "in [" << pl2.land[level][p2Count].first << ","
<< pl2.land[level][p2Count + 1].first << "] \n";
- std::cerr << "pl1[level][i].second : " << pl1.land[level][i].second << std::endl;
- std::cerr << "function_value( pl2[level][p2Count] , pl2[level][p2Count+1] , pl1[level][i].first ) : "
+ std::clog << "pl1[level][i].second : " << pl1.land[level][i].second << std::endl;
+ std::clog << "function_value( pl2[level][p2Count] , pl2[level][p2Count+1] , pl1[level][i].first ) : "
<< function_value(pl2.land[level][p2Count], pl2.land[level][p2Count + 1], pl1.land[level][i].first)
<< std::endl;
- std::cerr << "val : " << val << std::endl;
+ std::clog << "val : " << val << std::endl;
std::cin.ignore();
}
}
}
- if (dbg) std::cerr << "minimalNumberOfLevels : " << minimalNumberOfLevels << std::endl;
+ if (dbg) std::clog << "minimalNumberOfLevels : " << minimalNumberOfLevels << std::endl;
if (minimalNumberOfLevels < pl1.land.size()) {
for (size_t level = minimalNumberOfLevels; level != pl1.land.size(); ++level) {
for (size_t i = 0; i != pl1.land[level].size(); ++i) {
- if (dbg) std::cerr << "pl1[level][i].second : " << pl1.land[level][i].second << std::endl;
+ if (dbg) std::clog << "pl1[level][i].second : " << pl1.land[level][i].second << std::endl;
if (maxDist < pl1.land[level][i].second) maxDist = pl1.land[level][i].second;
}
}
@@ -1181,7 +1181,7 @@ double compute_distance_of_landscapes(const Persistence_landscape& first, const
lan = lan.abs();
if (dbg) {
- std::cerr << "Abs of difference ; " << lan << std::endl;
+ std::clog << "Abs of difference ; " << lan << std::endl;
getchar();
}
@@ -1189,17 +1189,17 @@ double compute_distance_of_landscapes(const Persistence_landscape& first, const
// \int_{- \infty}^{+\infty}| first-second |^p
double result;
if (p != 1) {
- if (dbg) std::cerr << "Power != 1, compute integral to the power p\n";
+ if (dbg) std::clog << "Power != 1, compute integral to the power p\n";
result = lan.compute_integral_of_landscape(p);
} else {
- if (dbg) std::cerr << "Power = 1, compute integral \n";
+ if (dbg) std::clog << "Power = 1, compute integral \n";
result = lan.compute_integral_of_landscape();
}
// (\int_{- \infty}^{+\infty}| first-second |^p)^(1/p)
return pow(result, 1.0 / p);
} else {
// p == infty
- if (dbg) std::cerr << "Power = infty, compute maximum \n";
+ if (dbg) std::clog << "Power = infty, compute maximum \n";
return lan.compute_maximum();
}
}
@@ -1220,7 +1220,7 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
for (size_t level = 0; level != std::min(l1.size(), l2.size()); ++level) {
if (dbg) {
- std::cerr << "Computing inner product for a level : " << level << std::endl;
+ std::clog << "Computing inner product for a level : " << level << std::endl;
getchar();
}
auto&& l1_land_level = l1.land[level];
@@ -1267,14 +1267,14 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
result += contributionFromThisPart;
if (dbg) {
- std::cerr << "[l1_land_level[l1It].first,l1_land_level[l1It+1].first] : " << l1_land_level[l1It].first
+ std::clog << "[l1_land_level[l1It].first,l1_land_level[l1It+1].first] : " << l1_land_level[l1It].first
<< " , " << l1_land_level[l1It + 1].first << std::endl;
- std::cerr << "[l2_land_level[l2It].first,l2_land_level[l2It+1].first] : " << l2_land_level[l2It].first
+ std::clog << "[l2_land_level[l2It].first,l2_land_level[l2It+1].first] : " << l2_land_level[l2It].first
<< " , " << l2_land_level[l2It + 1].first << std::endl;
- std::cerr << "a : " << a << ", b : " << b << " , c: " << c << ", d : " << d << std::endl;
- std::cerr << "x1 : " << x1 << " , x2 : " << x2 << std::endl;
- std::cerr << "contributionFromThisPart : " << contributionFromThisPart << std::endl;
- std::cerr << "result : " << result << std::endl;
+ std::clog << "a : " << a << ", b : " << b << " , c: " << c << ", d : " << d << std::endl;
+ std::clog << "x1 : " << x1 << " , x2 : " << x2 << std::endl;
+ std::clog << "contributionFromThisPart : " << contributionFromThisPart << std::endl;
+ std::clog << "result : " << result << std::endl;
getchar();
}
@@ -1290,11 +1290,11 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
// in this case, we increment both:
++l2It;
if (dbg) {
- std::cerr << "Incrementing both \n";
+ std::clog << "Incrementing both \n";
}
} else {
if (dbg) {
- std::cerr << "Incrementing first \n";
+ std::clog << "Incrementing first \n";
}
}
++l1It;
@@ -1302,7 +1302,7 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_
// in this case we increment l2It
++l2It;
if (dbg) {
- std::cerr << "Incrementing second \n";
+ std::clog << "Incrementing second \n";
}
}
@@ -1361,7 +1361,7 @@ void Persistence_landscape::plot(const char* filename, double xRangeBegin, doubl
}
out << "EOF" << std::endl;
}
- std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ std::clog << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
<< gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h
index 68bce336..537131da 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h
@@ -155,9 +155,9 @@ class Persistence_landscape_on_grid {
double dx = (this->grid_max - this->grid_min) / static_cast<double>(this->values_of_landscapes.size() - 1);
if (dbg) {
- std::cerr << "this->grid_max : " << this->grid_max << std::endl;
- std::cerr << "this->grid_min : " << this->grid_min << std::endl;
- std::cerr << "this->values_of_landscapes.size() : " << this->values_of_landscapes.size() << std::endl;
+ std::clog << "this->grid_max : " << this->grid_max << std::endl;
+ std::clog << "this->grid_min : " << this->grid_min << std::endl;
+ std::clog << "this->values_of_landscapes.size() : " << this->values_of_landscapes.size() << std::endl;
getchar();
}
@@ -169,14 +169,14 @@ class Persistence_landscape_on_grid {
if (this->values_of_landscapes[i].size() > level) current_y = this->values_of_landscapes[i][level];
if (dbg) {
- std::cerr << "this->values_of_landscapes[i].size() : " << this->values_of_landscapes[i].size()
+ std::clog << "this->values_of_landscapes[i].size() : " << this->values_of_landscapes[i].size()
<< " , level : " << level << std::endl;
if (this->values_of_landscapes[i].size() > level)
- std::cerr << "this->values_of_landscapes[i][level] : " << this->values_of_landscapes[i][level] << std::endl;
- std::cerr << "previous_y : " << previous_y << std::endl;
- std::cerr << "current_y : " << current_y << std::endl;
- std::cerr << "dx : " << dx << std::endl;
- std::cerr << "0.5*dx*( previous_y + current_y ); " << 0.5 * dx * (previous_y + current_y) << std::endl;
+ std::clog << "this->values_of_landscapes[i][level] : " << this->values_of_landscapes[i][level] << std::endl;
+ std::clog << "previous_y : " << previous_y << std::endl;
+ std::clog << "current_y : " << current_y << std::endl;
+ std::clog << "dx : " << dx << std::endl;
+ std::clog << "0.5*dx*( previous_y + current_y ); " << 0.5 * dx * (previous_y + current_y) << std::endl;
}
result += 0.5 * dx * (previous_y + current_y);
@@ -213,10 +213,10 @@ class Persistence_landscape_on_grid {
if (this->values_of_landscapes[0].size() > level) previous_y = this->values_of_landscapes[0][level];
if (dbg) {
- std::cerr << "dx : " << dx << std::endl;
- std::cerr << "previous_x : " << previous_x << std::endl;
- std::cerr << "previous_y : " << previous_y << std::endl;
- std::cerr << "power : " << p << std::endl;
+ std::clog << "dx : " << dx << std::endl;
+ std::clog << "previous_x : " << previous_x << std::endl;
+ std::clog << "previous_y : " << previous_y << std::endl;
+ std::clog << "power : " << p << std::endl;
getchar();
}
@@ -225,7 +225,7 @@ class Persistence_landscape_on_grid {
double current_y = 0;
if (this->values_of_landscapes[i].size() > level) current_y = this->values_of_landscapes[i][level];
- if (dbg) std::cerr << "current_y : " << current_y << std::endl;
+ if (dbg) std::clog << "current_y : " << current_y << std::endl;
if (current_y == previous_y) continue;
@@ -235,7 +235,7 @@ class Persistence_landscape_on_grid {
double b = coef.second;
if (dbg) {
- std::cerr << "A line passing through points : (" << previous_x << "," << previous_y << ") and (" << current_x
+ std::clog << "A line passing through points : (" << previous_x << "," << previous_y << ") and (" << current_x
<< "," << current_y << ") is : " << a << "x+" << b << std::endl;
}
@@ -249,14 +249,14 @@ class Persistence_landscape_on_grid {
}
result += value_to_add;
if (dbg) {
- std::cerr << "Increasing result by : " << value_to_add << std::endl;
- std::cerr << "result : " << result << std::endl;
+ std::clog << "Increasing result by : " << value_to_add << std::endl;
+ std::clog << "result : " << result << std::endl;
getchar();
}
previous_x = current_x;
previous_y = current_y;
}
- if (dbg) std::cerr << "The total result is : " << result << std::endl;
+ if (dbg) std::clog << "The total result is : " << result << std::endl;
return result;
}
@@ -297,10 +297,10 @@ class Persistence_landscape_on_grid {
size_t position = size_t((x - this->grid_min) / dx);
if (dbg) {
- std::cerr << "This is a procedure compute_value_at_a_given_point \n";
- std::cerr << "level : " << level << std::endl;
- std::cerr << "x : " << x << std::endl;
- std::cerr << "position : " << position << std::endl;
+ std::clog << "This is a procedure compute_value_at_a_given_point \n";
+ std::clog << "level : " << level << std::endl;
+ std::clog << "x : " << x << std::endl;
+ std::clog << "position : " << position << std::endl;
}
// check if we are not exactly in the grid point:
if (almost_equal(position * dx + this->grid_min, x)) {
@@ -432,23 +432,23 @@ class Persistence_landscape_on_grid {
bool operator==(const Persistence_landscape_on_grid& rhs) const {
bool dbg = true;
if (this->values_of_landscapes.size() != rhs.values_of_landscapes.size()) {
- if (dbg) std::cerr << "values_of_landscapes of incompatible sizes\n";
+ if (dbg) std::clog << "values_of_landscapes of incompatible sizes\n";
return false;
}
if (!almost_equal(this->grid_min, rhs.grid_min)) {
- if (dbg) std::cerr << "grid_min not equal\n";
+ if (dbg) std::clog << "grid_min not equal\n";
return false;
}
if (!almost_equal(this->grid_max, rhs.grid_max)) {
- if (dbg) std::cerr << "grid_max not equal\n";
+ if (dbg) std::clog << "grid_max not equal\n";
return false;
}
for (size_t i = 0; i != this->values_of_landscapes.size(); ++i) {
for (size_t aa = 0; aa != this->values_of_landscapes[i].size(); ++aa) {
if (!almost_equal(this->values_of_landscapes[i][aa], rhs.values_of_landscapes[i][aa])) {
if (dbg) {
- std::cerr << "Problem in the position : " << i << " of values_of_landscapes. \n";
- std::cerr << this->values_of_landscapes[i][aa] << " " << rhs.values_of_landscapes[i][aa] << std::endl;
+ std::clog << "Problem in the position : " << i << " of values_of_landscapes. \n";
+ std::clog << this->values_of_landscapes[i][aa] << " " << rhs.values_of_landscapes[i][aa] << std::endl;
}
return false;
}
@@ -615,7 +615,7 @@ class Persistence_landscape_on_grid {
double previous_y_l1 = 0;
double previous_y_l2 = 0;
for (size_t i = 0; i != l1.values_of_landscapes.size(); ++i) {
- if (dbg) std::cerr << "i : " << i << std::endl;
+ if (dbg) std::clog << "i : " << i << std::endl;
double current_x = previous_x + dx;
double current_y_l1 = 0;
@@ -625,11 +625,11 @@ class Persistence_landscape_on_grid {
if (l2.values_of_landscapes[i].size() > level) current_y_l2 = l2.values_of_landscapes[i][level];
if (dbg) {
- std::cerr << "previous_x : " << previous_x << std::endl;
- std::cerr << "previous_y_l1 : " << previous_y_l1 << std::endl;
- std::cerr << "current_y_l1 : " << current_y_l1 << std::endl;
- std::cerr << "previous_y_l2 : " << previous_y_l2 << std::endl;
- std::cerr << "current_y_l2 : " << current_y_l2 << std::endl;
+ std::clog << "previous_x : " << previous_x << std::endl;
+ std::clog << "previous_y_l1 : " << previous_y_l1 << std::endl;
+ std::clog << "current_y_l1 : " << current_y_l1 << std::endl;
+ std::clog << "previous_y_l2 : " << previous_y_l2 << std::endl;
+ std::clog << "current_y_l2 : " << current_y_l2 << std::endl;
}
std::pair<double, double> l1_coords = compute_parameters_of_a_line(std::make_pair(previous_x, previous_y_l1),
@@ -646,11 +646,11 @@ class Persistence_landscape_on_grid {
double d = l2_coords.second;
if (dbg) {
- std::cerr << "Here are the formulas for a line: \n";
- std::cerr << "a : " << a << std::endl;
- std::cerr << "b : " << b << std::endl;
- std::cerr << "c : " << c << std::endl;
- std::cerr << "d : " << d << std::endl;
+ std::clog << "Here are the formulas for a line: \n";
+ std::clog << "a : " << a << std::endl;
+ std::clog << "b : " << b << std::endl;
+ std::clog << "c : " << c << std::endl;
+ std::clog << "d : " << d << std::endl;
}
// now, to compute the inner product in this interval we need to compute the integral of (ax+b)(cx+d) = acx^2 +
@@ -663,11 +663,11 @@ class Persistence_landscape_on_grid {
(a * d + b * c) / 2 * previous_x * previous_x + b * d * previous_x);
if (dbg) {
- std::cerr << "Value of the integral on the left end i.e. : " << previous_x << " is : "
+ std::clog << "Value of the integral on the left end i.e. : " << previous_x << " is : "
<< a * c / 3 * previous_x * previous_x * previous_x + (a * d + b * c) / 2 * previous_x * previous_x +
b * d * previous_x
<< std::endl;
- std::cerr << "Value of the integral on the right end i.e. : " << current_x << " is "
+ std::clog << "Value of the integral on the right end i.e. : " << current_x << " is "
<< a * c / 3 * current_x * current_x * current_x + (a * d + b * c) / 2 * current_x * current_x +
b * d * current_x
<< std::endl;
@@ -676,8 +676,8 @@ class Persistence_landscape_on_grid {
result += added_value;
if (dbg) {
- std::cerr << "added_value : " << added_value << std::endl;
- std::cerr << "result : " << result << std::endl;
+ std::clog << "added_value : " << added_value << std::endl;
+ std::clog << "result : " << result << std::endl;
getchar();
}
@@ -703,8 +703,8 @@ class Persistence_landscape_on_grid {
// time:
if (dbg) {
- std::cerr << "first : " << first << std::endl;
- std::cerr << "second : " << second << std::endl;
+ std::clog << "first : " << first << std::endl;
+ std::clog << "second : " << second << std::endl;
getchar();
}
@@ -712,14 +712,14 @@ class Persistence_landscape_on_grid {
Persistence_landscape_on_grid lan = first - second;
if (dbg) {
- std::cerr << "Difference : " << lan << std::endl;
+ std::clog << "Difference : " << lan << std::endl;
}
//| first-second |:
lan.abs();
if (dbg) {
- std::cerr << "Abs : " << lan << std::endl;
+ std::clog << "Abs : " << lan << std::endl;
}
if (p < std::numeric_limits<double>::max()) {
@@ -727,18 +727,18 @@ class Persistence_landscape_on_grid {
double result;
if (p != 1) {
if (dbg) {
- std::cerr << "p : " << p << std::endl;
+ std::clog << "p : " << p << std::endl;
getchar();
}
result = lan.compute_integral_of_landscape(p);
if (dbg) {
- std::cerr << "integral : " << result << std::endl;
+ std::clog << "integral : " << result << std::endl;
getchar();
}
} else {
result = lan.compute_integral_of_landscape();
if (dbg) {
- std::cerr << "integral, without power : " << result << std::endl;
+ std::clog << "integral, without power : " << result << std::endl;
getchar();
}
}
@@ -820,7 +820,7 @@ class Persistence_landscape_on_grid {
this->grid_max = (to_average[0])->grid_max;
if (dbg) {
- std::cerr << "Computations of average. The data from the current landscape have been cleared. We are ready to do "
+ std::clog << "Computations of average. The data from the current landscape have been cleared. We are ready to do "
"the computations. \n";
}
@@ -835,7 +835,7 @@ class Persistence_landscape_on_grid {
this->values_of_landscapes[grid_point] = std::vector<double>(maximal_size_of_vector);
if (dbg) {
- std::cerr << "We are considering the point : " << grid_point
+ std::clog << "We are considering the point : " << grid_point
<< " of the grid. In this point, there are at most : " << maximal_size_of_vector
<< " nonzero landscape functions \n";
}
@@ -931,12 +931,12 @@ void Persistence_landscape_on_grid::set_up_values_of_landscapes(const std::vecto
size_t number_of_points_, unsigned number_of_levels) {
bool dbg = false;
if (dbg) {
- std::cerr << "Here is the procedure : set_up_values_of_landscapes. The parameters are : grid_min_ : " << grid_min_
+ std::clog << "Here is the procedure : set_up_values_of_landscapes. The parameters are : grid_min_ : " << grid_min_
<< ", grid_max_ : " << grid_max_ << ", number_of_points_ : " << number_of_points_
<< ", number_of_levels: " << number_of_levels << std::endl;
- std::cerr << "Here are the intervals at our disposal : \n";
+ std::clog << "Here are the intervals at our disposal : \n";
for (size_t i = 0; i != p.size(); ++i) {
- std::cerr << p[i].first << " , " << p[i].second << std::endl;
+ std::clog << p[i].first << " , " << p[i].second << std::endl;
}
}
@@ -976,17 +976,17 @@ void Persistence_landscape_on_grid::set_up_values_of_landscapes(const std::vecto
size_t grid_interval_midpoint = (size_t)(0.5 * (grid_interval_begin + grid_interval_end));
if (dbg) {
- std::cerr << "Considering an interval : " << p[int_no].first << "," << p[int_no].second << std::endl;
+ std::clog << "Considering an interval : " << p[int_no].first << "," << p[int_no].second << std::endl;
- std::cerr << "grid_interval_begin : " << grid_interval_begin << std::endl;
- std::cerr << "grid_interval_end : " << grid_interval_end << std::endl;
- std::cerr << "grid_interval_midpoint : " << grid_interval_midpoint << std::endl;
+ std::clog << "grid_interval_begin : " << grid_interval_begin << std::endl;
+ std::clog << "grid_interval_end : " << grid_interval_end << std::endl;
+ std::clog << "grid_interval_midpoint : " << grid_interval_midpoint << std::endl;
}
double landscape_value = dx;
for (size_t i = grid_interval_begin + 1; i < grid_interval_midpoint; ++i) {
if (dbg) {
- std::cerr << "Adding landscape value (going up) for a point : " << i << " equal : " << landscape_value
+ std::clog << "Adding landscape value (going up) for a point : " << i << " equal : " << landscape_value
<< std::endl;
}
if (number_of_levels != std::numeric_limits<unsigned>::max()) {
@@ -1044,7 +1044,7 @@ void Persistence_landscape_on_grid::set_up_values_of_landscapes(const std::vecto
}
if (dbg) {
- std::cerr << "Adding landscape value (going down) for a point : " << i << " equal : " << landscape_value
+ std::clog << "Adding landscape value (going down) for a point : " << i << " equal : " << landscape_value
<< std::endl;
}
}
@@ -1246,7 +1246,7 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou
}
out << "EOF" << std::endl;
}
- std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ std::clog << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
<< gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
diff --git a/src/Persistence_representations/include/gudhi/Persistence_vectors.h b/src/Persistence_representations/include/gudhi/Persistence_vectors.h
index 6776f4a3..fab96900 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_vectors.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_vectors.h
@@ -189,7 +189,7 @@ class Vector_distances_in_diagram {
}
out << std::endl;
out.close();
- std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
+ std::clog << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'"
<< gnuplot_script.str().c_str() << "\'\"" << std::endl;
}
@@ -360,9 +360,9 @@ template <typename F>
void Vector_distances_in_diagram<F>::compute_sorted_vector_of_distances_via_heap(size_t where_to_cut) {
bool dbg = false;
if (dbg) {
- std::cerr << "Here are the intervals : \n";
+ std::clog << "Here are the intervals : \n";
for (size_t i = 0; i != this->intervals.size(); ++i) {
- std::cerr << this->intervals[i].first << " , " << this->intervals[i].second << std::endl;
+ std::clog << this->intervals[i].first << " , " << this->intervals[i].second << std::endl;
}
}
where_to_cut = std::min(
@@ -385,14 +385,14 @@ void Vector_distances_in_diagram<F>::compute_sorted_vector_of_distances_via_heap
0.5 * (this->intervals[j].first + this->intervals[j].second)))));
if (dbg) {
- std::cerr << "Value : " << value << std::endl;
- std::cerr << "heap.front() : " << heap.front() << std::endl;
+ std::clog << "Value : " << value << std::endl;
+ std::clog << "heap.front() : " << heap.front() << std::endl;
getchar();
}
if (-value < heap.front()) {
if (dbg) {
- std::cerr << "Replacing : " << heap.front() << " with : " << -value << std::endl;
+ std::clog << "Replacing : " << heap.front() << " with : " << -value << std::endl;
getchar();
}
// remove the first element from the heap
@@ -431,11 +431,11 @@ void Vector_distances_in_diagram<F>::compute_sorted_vector_of_distances_via_heap
}
if (dbg) {
- std::cerr << "This is the heap after all the operations :\n";
+ std::clog << "This is the heap after all the operations :\n";
for (size_t i = 0; i != heap.size(); ++i) {
- std::cout << heap[i] << " ";
+ std::clog << heap[i] << " ";
}
- std::cout << std::endl;
+ std::clog << std::endl;
}
this->sorted_vector_of_distances = heap;
@@ -519,11 +519,11 @@ double Vector_distances_in_diagram<F>::distance(const Vector_distances_in_diagra
bool dbg = false;
if (dbg) {
- std::cerr << "Entering double Vector_distances_in_diagram<F>::distance( const Abs_Topological_data_with_distances* "
+ std::clog << "Entering double Vector_distances_in_diagram<F>::distance( const Abs_Topological_data_with_distances* "
"second , double power ) procedure \n";
- std::cerr << "Power : " << power << std::endl;
- std::cerr << "This : " << *this << std::endl;
- std::cerr << "second : " << second_ << std::endl;
+ std::clog << "Power : " << power << std::endl;
+ std::clog << "This : " << *this << std::endl;
+ std::clog << "second : " << second_ << std::endl;
}
double result = 0;
@@ -531,7 +531,7 @@ double Vector_distances_in_diagram<F>::distance(const Vector_distances_in_diagra
++i) {
if (power == 1) {
if (dbg) {
- std::cerr << "|" << this->sorted_vector_of_distances[i] << " - " << second_.sorted_vector_of_distances[i]
+ std::clog << "|" << this->sorted_vector_of_distances[i] << " - " << second_.sorted_vector_of_distances[i]
<< " | : " << fabs(this->sorted_vector_of_distances[i] - second_.sorted_vector_of_distances[i])
<< std::endl;
}
@@ -545,7 +545,7 @@ double Vector_distances_in_diagram<F>::distance(const Vector_distances_in_diagra
result = fabs(this->sorted_vector_of_distances[i] - second_.sorted_vector_of_distances[i]);
}
if (dbg) {
- std::cerr << "| " << this->sorted_vector_of_distances[i] << " - " << second_.sorted_vector_of_distances[i]
+ std::clog << "| " << this->sorted_vector_of_distances[i] << " - " << second_.sorted_vector_of_distances[i]
<< " : " << fabs(this->sorted_vector_of_distances[i] - second_.sorted_vector_of_distances[i])
<< std::endl;
}
diff --git a/src/Persistence_representations/include/gudhi/read_persistence_from_file.h b/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
index 5c2d2038..a5bc1bca 100644
--- a/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
+++ b/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
@@ -50,28 +50,28 @@ std::vector<std::pair<double, double> > read_persistence_intervals_in_one_dimens
final_barcode.reserve(barcode_initial.size());
if (dbg) {
- std::cerr << "Here are the intervals that we read from the file : \n";
+ std::clog << "Here are the intervals that we read from the file : \n";
for (size_t i = 0; i != barcode_initial.size(); ++i) {
- std::cout << barcode_initial[i].first << " " << barcode_initial[i].second << std::endl;
+ std::clog << barcode_initial[i].first << " " << barcode_initial[i].second << std::endl;
}
getchar();
}
for (size_t i = 0; i != barcode_initial.size(); ++i) {
if (dbg) {
- std::cout << "COnsidering interval : " << barcode_initial[i].first << " " << barcode_initial[i].second
+ std::clog << "Considering interval : " << barcode_initial[i].first << " " << barcode_initial[i].second
<< std::endl;
}
if (barcode_initial[i].first > barcode_initial[i].second) {
// note that in this case barcode_initial[i].second != std::numeric_limits<double>::infinity()
- if (dbg) std::cout << "Swap and enter \n";
+ if (dbg) std::clog << "Swap and enter \n";
// swap them to make sure that birth < death
final_barcode.push_back(std::pair<double, double>(barcode_initial[i].second, barcode_initial[i].first));
continue;
} else {
if (barcode_initial[i].second != std::numeric_limits<double>::infinity()) {
- if (dbg) std::cout << "Simply enters\n";
+ if (dbg) std::clog << "Simply enters\n";
// in this case, due to the previous conditions we know that barcode_initial[i].first <
// barcode_initial[i].second, so we put them as they are
final_barcode.push_back(std::pair<double, double>(barcode_initial[i].first, barcode_initial[i].second));
@@ -91,11 +91,11 @@ std::vector<std::pair<double, double> > read_persistence_intervals_in_one_dimens
}
if (dbg) {
- std::cerr << "Here are the final bars that we are sending further : \n";
+ std::clog << "Here are the final bars that we are sending further : \n";
for (size_t i = 0; i != final_barcode.size(); ++i) {
- std::cout << final_barcode[i].first << " " << final_barcode[i].second << std::endl;
+ std::clog << final_barcode[i].first << " " << final_barcode[i].second << std::endl;
}
- std::cerr << "final_barcode.size() : " << final_barcode.size() << std::endl;
+ std::clog << "final_barcode.size() : " << final_barcode.size() << std::endl;
getchar();
}