summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-13 11:14:37 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-13 11:14:37 +0100
commit23ccc50ab3608202452e44f287e4817ffa98227c (patch)
tree7a7cdb776cf054272a59d5bc962801d17343013b
parentf61d7c2c9f1148ee1bc749d1f7007f5c01f4ffb4 (diff)
Review all cout and cerr. cerr is reserved for warnings/error and cout for traces
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h56
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h34
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h15
-rw-r--r--src/GudhUI/model/Model.h2
-rw-r--r--src/Nerve_GIC/include/gudhi/GIC.h20
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_heat_maps.h58
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_intervals.h54
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_landscape.h154
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h120
-rw-r--r--src/Persistence_representations/include/gudhi/Persistence_vectors.h24
-rw-r--r--src/Persistence_representations/include/gudhi/read_persistence_from_file.h8
-rw-r--r--src/common/include/gudhi/Debug_utils.h2
-rw-r--r--src/common/include/gudhi/reader_utils.h6
13 files changed, 274 insertions, 279 deletions
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
index 37514dee..2f95dff3 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h
@@ -69,7 +69,7 @@ class Bitmap_cubical_complex : public T {
Bitmap_cubical_complex(const char* perseus_style_file)
: T(perseus_style_file), key_associated_to_simplex(this->total_number_of_cells + 1) {
if (globalDbg) {
- std::cerr << "Bitmap_cubical_complex( const char* perseus_style_file )\n";
+ std::cout << "Bitmap_cubical_complex( const char* perseus_style_file )\n";
}
for (std::size_t i = 0; i != this->total_number_of_cells; ++i) {
this->key_associated_to_simplex[i] = i;
@@ -137,7 +137,7 @@ class Bitmap_cubical_complex : public T {
**/
static Simplex_handle null_simplex() {
if (globalDbg) {
- std::cerr << "Simplex_handle null_simplex()\n";
+ std::cout << "Simplex_handle null_simplex()\n";
}
return std::numeric_limits<Simplex_handle>::max();
}
@@ -152,7 +152,7 @@ class Bitmap_cubical_complex : public T {
**/
inline unsigned dimension(Simplex_handle sh) const {
if (globalDbg) {
- std::cerr << "unsigned dimension(const Simplex_handle& sh)\n";
+ std::cout << "unsigned dimension(const Simplex_handle& sh)\n";
}
if (sh != null_simplex()) return this->get_dimension_of_a_cell(sh);
return -1;
@@ -163,7 +163,7 @@ class Bitmap_cubical_complex : public T {
**/
Filtration_value filtration(Simplex_handle sh) {
if (globalDbg) {
- std::cerr << "Filtration_value filtration(const Simplex_handle& sh)\n";
+ std::cout << "Filtration_value filtration(const Simplex_handle& sh)\n";
}
// Returns the filtration value of a simplex.
if (sh != null_simplex()) return this->data[sh];
@@ -175,7 +175,7 @@ class Bitmap_cubical_complex : public T {
**/
static Simplex_key null_key() {
if (globalDbg) {
- std::cerr << "Simplex_key null_key()\n";
+ std::cout << "Simplex_key null_key()\n";
}
return std::numeric_limits<Simplex_handle>::max();
}
@@ -185,7 +185,7 @@ class Bitmap_cubical_complex : public T {
**/
Simplex_key key(Simplex_handle sh) const {
if (globalDbg) {
- std::cerr << "Simplex_key key(const Simplex_handle& sh)\n";
+ std::cout << "Simplex_key key(const Simplex_handle& sh)\n";
}
if (sh != null_simplex()) {
return this->key_associated_to_simplex[sh];
@@ -198,7 +198,7 @@ class Bitmap_cubical_complex : public T {
**/
Simplex_handle simplex(Simplex_key key) {
if (globalDbg) {
- std::cerr << "Simplex_handle simplex(Simplex_key key)\n";
+ std::cout << "Simplex_handle simplex(Simplex_key key)\n";
}
if (key != null_key()) {
return this->simplex_associated_to_key[key];
@@ -211,7 +211,7 @@ class Bitmap_cubical_complex : public T {
**/
void assign_key(Simplex_handle sh, Simplex_key key) {
if (globalDbg) {
- std::cerr << "void assign_key(Simplex_handle& sh, Simplex_key key)\n";
+ std::cout << "void assign_key(Simplex_handle& sh, Simplex_key key)\n";
}
if (key == null_key()) return;
this->key_associated_to_simplex[sh] = key;
@@ -251,7 +251,7 @@ class Bitmap_cubical_complex : public T {
Filtration_simplex_iterator operator++() {
if (globalDbg) {
- std::cerr << "Filtration_simplex_iterator operator++\n";
+ std::cout << "Filtration_simplex_iterator operator++\n";
}
++this->position;
return (*this);
@@ -265,7 +265,7 @@ class Bitmap_cubical_complex : public T {
Filtration_simplex_iterator& operator=(const Filtration_simplex_iterator& rhs) {
if (globalDbg) {
- std::cerr << "Filtration_simplex_iterator operator =\n";
+ std::cout << "Filtration_simplex_iterator operator =\n";
}
this->b = rhs.b;
this->position = rhs.position;
@@ -274,21 +274,21 @@ class Bitmap_cubical_complex : public T {
bool operator==(const Filtration_simplex_iterator& rhs) const {
if (globalDbg) {
- std::cerr << "bool operator == ( const Filtration_simplex_iterator& rhs )\n";
+ std::cout << "bool operator == ( const Filtration_simplex_iterator& rhs )\n";
}
return (this->position == rhs.position);
}
bool operator!=(const Filtration_simplex_iterator& rhs) const {
if (globalDbg) {
- std::cerr << "bool operator != ( const Filtration_simplex_iterator& rhs )\n";
+ std::cout << "bool operator != ( const Filtration_simplex_iterator& rhs )\n";
}
return !(*this == rhs);
}
Simplex_handle operator*() {
if (globalDbg) {
- std::cerr << "Simplex_handle operator*()\n";
+ std::cout << "Simplex_handle operator*()\n";
}
return this->b->simplex_associated_to_key[this->position];
}
@@ -314,14 +314,14 @@ class Bitmap_cubical_complex : public T {
Filtration_simplex_iterator begin() {
if (globalDbg) {
- std::cerr << "Filtration_simplex_iterator begin() \n";
+ std::cout << "Filtration_simplex_iterator begin() \n";
}
return Filtration_simplex_iterator(this->b);
}
Filtration_simplex_iterator end() {
if (globalDbg) {
- std::cerr << "Filtration_simplex_iterator end()\n";
+ std::cout << "Filtration_simplex_iterator end()\n";
}
Filtration_simplex_iterator it(this->b);
it.position = this->b->simplex_associated_to_key.size();
@@ -347,7 +347,7 @@ class Bitmap_cubical_complex : public T {
**/
Filtration_simplex_range filtration_simplex_range() {
if (globalDbg) {
- std::cerr << "Filtration_simplex_range filtration_simplex_range()\n";
+ std::cout << "Filtration_simplex_range filtration_simplex_range()\n";
}
// Returns a range over the simplices of the complex in the order of the filtration
return Filtration_simplex_range(this);
@@ -370,8 +370,8 @@ class Bitmap_cubical_complex : public T {
std::pair<Simplex_handle, Simplex_handle> endpoints(Simplex_handle sh) {
std::vector<std::size_t> bdry = this->get_boundary_of_a_cell(sh);
if (globalDbg) {
- std::cerr << "std::pair<Simplex_handle, Simplex_handle> endpoints( Simplex_handle sh )\n";
- std::cerr << "bdry.size() : " << bdry.size() << "\n";
+ std::cout << "std::pair<Simplex_handle, Simplex_handle> endpoints( Simplex_handle sh )\n";
+ std::cout << "bdry.size() : " << bdry.size() << "\n";
}
// this method returns two first elements from the boundary of sh.
if (bdry.size() < 2)
@@ -392,7 +392,7 @@ class Bitmap_cubical_complex : public T {
public:
Skeleton_simplex_iterator(Bitmap_cubical_complex* b, std::size_t d) : b(b), dimension(d) {
if (globalDbg) {
- std::cerr << "Skeleton_simplex_iterator ( Bitmap_cubical_complex* b , std::size_t d )\n";
+ std::cout << "Skeleton_simplex_iterator ( Bitmap_cubical_complex* b , std::size_t d )\n";
}
// find the position of the first simplex of a dimension d
this->position = 0;
@@ -406,7 +406,7 @@ class Bitmap_cubical_complex : public T {
Skeleton_simplex_iterator operator++() {
if (globalDbg) {
- std::cerr << "Skeleton_simplex_iterator operator++()\n";
+ std::cout << "Skeleton_simplex_iterator operator++()\n";
}
// increment the position as long as you did not get to the next element of the dimension dimension.
++this->position;
@@ -425,7 +425,7 @@ class Bitmap_cubical_complex : public T {
Skeleton_simplex_iterator& operator=(const Skeleton_simplex_iterator& rhs) {
if (globalDbg) {
- std::cerr << "Skeleton_simplex_iterator operator =\n";
+ std::cout << "Skeleton_simplex_iterator operator =\n";
}
this->b = rhs.b;
this->position = rhs.position;
@@ -435,21 +435,21 @@ class Bitmap_cubical_complex : public T {
bool operator==(const Skeleton_simplex_iterator& rhs) const {
if (globalDbg) {
- std::cerr << "bool operator ==\n";
+ std::cout << "bool operator ==\n";
}
return (this->position == rhs.position);
}
bool operator!=(const Skeleton_simplex_iterator& rhs) const {
if (globalDbg) {
- std::cerr << "bool operator != ( const Skeleton_simplex_iterator& rhs )\n";
+ std::cout << "bool operator != ( const Skeleton_simplex_iterator& rhs )\n";
}
return !(*this == rhs);
}
Simplex_handle operator*() {
if (globalDbg) {
- std::cerr << "Simplex_handle operator*() \n";
+ std::cout << "Simplex_handle operator*() \n";
}
return this->position;
}
@@ -476,14 +476,14 @@ class Bitmap_cubical_complex : public T {
Skeleton_simplex_iterator begin() {
if (globalDbg) {
- std::cerr << "Skeleton_simplex_iterator begin()\n";
+ std::cout << "Skeleton_simplex_iterator begin()\n";
}
return Skeleton_simplex_iterator(this->b, this->dimension);
}
Skeleton_simplex_iterator end() {
if (globalDbg) {
- std::cerr << "Skeleton_simplex_iterator end()\n";
+ std::cout << "Skeleton_simplex_iterator end()\n";
}
Skeleton_simplex_iterator it(this->b, this->dimension);
it.position = this->b->data.size();
@@ -500,7 +500,7 @@ class Bitmap_cubical_complex : public T {
**/
Skeleton_simplex_range skeleton_simplex_range(unsigned dimension) {
if (globalDbg) {
- std::cerr << "Skeleton_simplex_range skeleton_simplex_range( unsigned dimension )\n";
+ std::cout << "Skeleton_simplex_range skeleton_simplex_range( unsigned dimension )\n";
}
return Skeleton_simplex_range(this, dimension);
}
@@ -515,7 +515,7 @@ class Bitmap_cubical_complex : public T {
template <typename T>
void Bitmap_cubical_complex<T>::initialize_simplex_associated_to_key() {
if (globalDbg) {
- std::cerr << "void Bitmap_cubical_complex<T>::initialize_elements_ordered_according_to_filtration() \n";
+ std::cout << "void Bitmap_cubical_complex<T>::initialize_elements_ordered_according_to_filtration() \n";
}
this->simplex_associated_to_key = std::vector<std::size_t>(this->data.size());
std::iota(std::begin(simplex_associated_to_key), std::end(simplex_associated_to_key), 0);
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
index 0d6299d2..96036fd4 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
@@ -142,7 +142,7 @@ class Bitmap_cubical_complex_base {
}
if (coface_counter[i] != face_counter[i]) {
if (number_of_position_in_which_counters_do_not_agree != -1) {
- std::cout << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
+ std::cerr << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
throw std::logic_error(
"Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
}
@@ -521,11 +521,11 @@ void Bitmap_cubical_complex_base<T>::put_data_to_bins(std::size_t number_of_bins
// now put the data into the appropriate bins:
for (std::size_t i = 0; i != this->data.size(); ++i) {
if (dbg) {
- std::cerr << "Before binning : " << this->data[i] << std::endl;
+ std::cout << "Before binning : " << this->data[i] << std::endl;
}
this->data[i] = min_max.first + dx * (this->data[i] - min_max.first) / number_of_bins;
if (dbg) {
- std::cerr << "After binning : " << this->data[i] << std::endl;
+ std::cout << "After binning : " << this->data[i] << std::endl;
}
}
}
@@ -539,11 +539,11 @@ void Bitmap_cubical_complex_base<T>::put_data_to_bins(T diameter_of_bin) {
// now put the data into the appropriate bins:
for (std::size_t i = 0; i != this->data.size(); ++i) {
if (dbg) {
- std::cerr << "Before binning : " << this->data[i] << std::endl;
+ std::cout << "Before binning : " << this->data[i] << std::endl;
}
this->data[i] = min_max.first + diameter_of_bin * (this->data[i] - min_max.first) / number_of_bins;
if (dbg) {
- std::cerr << "After binning : " << this->data[i] << std::endl;
+ std::cout << "After binning : " << this->data[i] << std::endl;
}
}
}
@@ -617,7 +617,7 @@ void Bitmap_cubical_complex_base<T>::read_perseus_style_file(const char* perseus
inFiltration >> dimensionOfData;
if (dbg) {
- std::cerr << "dimensionOfData : " << dimensionOfData << std::endl;
+ std::cout << "dimensionOfData : " << dimensionOfData << std::endl;
}
std::vector<unsigned> sizes;
@@ -630,7 +630,7 @@ void Bitmap_cubical_complex_base<T>::read_perseus_style_file(const char* perseus
sizes.push_back(size_in_this_dimension);
dimensions *= size_in_this_dimension;
if (dbg) {
- std::cerr << "size_in_this_dimension : " << size_in_this_dimension << std::endl;
+ std::cout << "size_in_this_dimension : " << size_in_this_dimension << std::endl;
}
}
this->set_up_containers(sizes);
@@ -651,7 +651,7 @@ void Bitmap_cubical_complex_base<T>::read_perseus_style_file(const char* perseus
}
if (dbg) {
- std::cerr << "Cell of an index : " << it.compute_index_in_bitmap()
+ std::cout << "Cell of an index : " << it.compute_index_in_bitmap()
<< " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
<< " get the value : " << filtrationLevel << std::endl;
}
@@ -754,20 +754,20 @@ std::vector<std::size_t> Bitmap_cubical_complex_base<T>::get_coboundary_of_a_cel
template <typename T>
unsigned Bitmap_cubical_complex_base<T>::get_dimension_of_a_cell(std::size_t cell) const {
bool dbg = false;
- if (dbg) std::cerr << "\n\n\n Computing position o a cell of an index : " << cell << std::endl;
+ if (dbg) std::cout << "\n\n\n Computing position o a cell of an index : " << cell << std::endl;
unsigned dimension = 0;
for (std::size_t i = this->multipliers.size(); i != 0; --i) {
unsigned position = cell / this->multipliers[i - 1];
if (dbg) {
- std::cerr << "i-1 :" << i - 1 << std::endl;
- std::cerr << "cell : " << cell << std::endl;
- std::cerr << "position : " << position << std::endl;
- std::cerr << "multipliers[" << i - 1 << "] = " << this->multipliers[i - 1] << std::endl;
+ std::cout << "i-1 :" << i - 1 << std::endl;
+ std::cout << "cell : " << cell << std::endl;
+ std::cout << "position : " << position << std::endl;
+ std::cout << "multipliers[" << i - 1 << "] = " << this->multipliers[i - 1] << std::endl;
}
if (position % 2 == 1) {
- if (dbg) std::cerr << "Nonzero length in this direction \n";
+ if (dbg) std::cout << "Nonzero length in this direction \n";
dimension++;
}
cell = cell % this->multipliers[i - 1];
@@ -803,7 +803,7 @@ void Bitmap_cubical_complex_base<T>::impose_lower_star_filtration() {
while (indices_to_consider.size()) {
if (dbg) {
- std::cerr << "indices_to_consider in this iteration \n";
+ std::cout << "indices_to_consider in this iteration \n";
for (std::size_t i = 0; i != indices_to_consider.size(); ++i) {
std::cout << indices_to_consider[i] << " ";
}
@@ -813,14 +813,14 @@ void Bitmap_cubical_complex_base<T>::impose_lower_star_filtration() {
std::vector<std::size_t> bd = this->get_boundary_of_a_cell(indices_to_consider[i]);
for (std::size_t boundaryIt = 0; boundaryIt != bd.size(); ++boundaryIt) {
if (dbg) {
- std::cerr << "filtration of a cell : " << bd[boundaryIt] << " is : " << this->data[bd[boundaryIt]]
+ std::cout << "filtration of a cell : " << bd[boundaryIt] << " is : " << this->data[bd[boundaryIt]]
<< " while of a cell: " << indices_to_consider[i] << " is: " << this->data[indices_to_consider[i]]
<< std::endl;
}
if (this->data[bd[boundaryIt]] > this->data[indices_to_consider[i]]) {
this->data[bd[boundaryIt]] = this->data[indices_to_consider[i]];
if (dbg) {
- std::cerr << "Setting the value of a cell : " << bd[boundaryIt]
+ std::cout << "Setting the value of a cell : " << bd[boundaryIt]
<< " to : " << this->data[indices_to_consider[i]] << std::endl;
}
}
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h
index edd794fe..3942dc34 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h
@@ -128,7 +128,7 @@ class Bitmap_cubical_complex_periodic_boundary_conditions_base : public Bitmap_c
}
if (coface_counter[i] != face_counter[i]) {
if (number_of_position_in_which_counters_do_not_agree != -1) {
- std::cout << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
+ std::cerr << "Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.\n";
throw std::logic_error(
"Cells given to compute_incidence_between_cells procedure do not form a pair of coface-face.");
}
@@ -237,7 +237,7 @@ Bitmap_cubical_complex_periodic_boundary_conditions_base<T>::Bitmap_cubical_comp
if (inFiltration.eof()) break;
if (dbg) {
- std::cerr << "Cell of an index : " << it.compute_index_in_bitmap()
+ std::cout << "Cell of an index : " << it.compute_index_in_bitmap()
<< " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap())
<< " get the value : " << filtrationLevel << std::endl;
}
@@ -278,7 +278,7 @@ std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_bas
std::size_t cell) const {
bool dbg = false;
if (dbg) {
- std::cerr << "Computations of boundary of a cell : " << cell << std::endl;
+ std::cout << "Computations of boundary of a cell : " << cell << std::endl;
}
std::vector<std::size_t> boundary_elements;
@@ -292,7 +292,6 @@ std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_bas
if (position % 2 == 1) {
// if there are no periodic boundary conditions in this direction, we do not have to do anything.
if (!directions_in_which_periodic_b_cond_are_to_be_imposed[i - 1]) {
- // std::cerr << "A\n";
if (sum_of_dimensions % 2) {
boundary_elements.push_back(cell - this->multipliers[i - 1]);
boundary_elements.push_back(cell + this->multipliers[i - 1]);
@@ -301,12 +300,11 @@ std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_bas
boundary_elements.push_back(cell - this->multipliers[i - 1]);
}
if (dbg) {
- std::cerr << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
+ std::cout << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
}
} else {
// in this direction we have to do boundary conditions. Therefore, we need to check if we are not at the end.
if (position != 2 * this->sizes[i - 1] - 1) {
- // std::cerr << "B\n";
if (sum_of_dimensions % 2) {
boundary_elements.push_back(cell - this->multipliers[i - 1]);
boundary_elements.push_back(cell + this->multipliers[i - 1]);
@@ -315,10 +313,9 @@ std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_bas
boundary_elements.push_back(cell - this->multipliers[i - 1]);
}
if (dbg) {
- std::cerr << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
+ std::cout << cell - this->multipliers[i - 1] << " " << cell + this->multipliers[i - 1] << " ";
}
} else {
- // std::cerr << "C\n";
if (sum_of_dimensions % 2) {
boundary_elements.push_back(cell - this->multipliers[i - 1]);
boundary_elements.push_back(cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1]);
@@ -327,7 +324,7 @@ std::vector<std::size_t> Bitmap_cubical_complex_periodic_boundary_conditions_bas
boundary_elements.push_back(cell - this->multipliers[i - 1]);
}
if (dbg) {
- std::cerr << cell - this->multipliers[i - 1] << " "
+ std::cout << cell - this->multipliers[i - 1] << " "
<< cell - (2 * this->sizes[i - 1] - 1) * this->multipliers[i - 1] << " ";
}
}
diff --git a/src/GudhUI/model/Model.h b/src/GudhUI/model/Model.h
index dd9bdaab..f2be944f 100644
--- a/src/GudhUI/model/Model.h
+++ b/src/GudhUI/model/Model.h
@@ -312,7 +312,7 @@ class Model {
std::cout << "Call CHOMP library\n";
int returnValue = system("homsimpl chomp.sim");
if (returnValue != 0) {
- std::cout << "homsimpl (from CHOMP) failed. Please check it is installed or available in the PATH."
+ std::cerr << "homsimpl (from CHOMP) failed. Please check it is installed or available in the PATH."
<< std::endl;
}
}
diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h
index b8169c59..7a08b66f 100644
--- a/src/Nerve_GIC/include/gudhi/GIC.h
+++ b/src/Nerve_GIC/include/gudhi/GIC.h
@@ -344,7 +344,7 @@ class Cover_complex {
if (num_edges(one_skeleton_OFF))
one_skeleton = one_skeleton_OFF;
else
- std::cout << "No triangulation read in OFF file!" << std::endl;
+ std::cerr << "No triangulation read in OFF file!" << std::endl;
}
public: // Set graph from Rips complex.
@@ -530,7 +530,7 @@ class Cover_complex {
cover_name = "coordinate " + std::to_string(k);
}
else{
- std::cout << "Only pairwise distances provided---cannot access " << k << "th coordinate; returning null vector instead" << std::endl;
+ std::cerr << "Only pairwise distances provided---cannot access " << k << "th coordinate; returning null vector instead" << std::endl;
for (int i = 0; i < n; i++) func.push_back(0.0);
functional_cover = true;
cover_name = "null";
@@ -563,11 +563,11 @@ class Cover_complex {
*/
double set_automatic_resolution() {
if (!functional_cover) {
- std::cout << "Cover needs to come from the preimages of a function." << std::endl;
+ std::cerr << "Cover needs to come from the preimages of a function." << std::endl;
return 0;
}
if (type != "Nerve" && type != "GIC") {
- std::cout << "Type of complex needs to be specified." << std::endl;
+ std::cerr << "Type of complex needs to be specified." << std::endl;
return 0;
}
@@ -622,11 +622,11 @@ class Cover_complex {
*/
void set_cover_from_function() {
if (resolution_double == -1 && resolution_int == -1) {
- std::cout << "Number and/or length of intervals not specified" << std::endl;
+ std::cerr << "Number and/or length of intervals not specified" << std::endl;
return;
}
if (gain == -1) {
- std::cout << "Gain not specified" << std::endl;
+ std::cerr << "Gain not specified" << std::endl;
return;
}
@@ -991,7 +991,7 @@ class Cover_complex {
color_name.append(std::to_string(k));
}
else{
- std::cout << "Only pairwise distances provided---cannot access " << k << "th coordinate; returning null vector instead" << std::endl;
+ std::cerr << "Only pairwise distances provided---cannot access " << k << "th coordinate; returning null vector instead" << std::endl;
for (int i = 0; i < n; i++) func.push_back(0.0);
functional_cover = true;
cover_name = "null";
@@ -1213,9 +1213,7 @@ class Cover_complex {
*/
void compute_distribution(unsigned int N = 100) {
unsigned int sz = distribution.size();
- if (sz >= N) {
- std::cout << "Already done!" << std::endl;
- } else {
+ if (sz < N) {
for (unsigned int i = 0; i < N - sz; i++) {
if (verbose) std::cout << "Computing " << i << "th bootstrap, bottleneck distance = ";
@@ -1319,7 +1317,7 @@ class Cover_complex {
*/
void find_simplices() {
if (type != "Nerve" && type != "GIC") {
- std::cout << "Type of complex needs to be specified." << std::endl;
+ std::cerr << "Type of complex needs to be specified." << std::endl;
return;
}
diff --git a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h
index b1af3503..c0aee9d0 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::cout << "Kernel initialize \n";
+ std::cout << "pixel_radius : " << pixel_radius << std::endl;
+ std::cout << "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::cout << "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::cout << kernel[i][j] << " ";
}
- std::cerr << std::endl;
+ std::cout << 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::cout << "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::cout << "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::cout << "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::cout << "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::cout << "this->heat_map[" << i << "][" << j << "] = " << this->heat_map[i][j] << std::endl;
+ std::cout << "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::cout << "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::cout << "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::cout << "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::cout << "min_ : " << min_ << std::endl;
+ std::cout << "max_ : " << max_ << std::endl;
+ std::cout << "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::cout << "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::cout << "point : " << intervals_[pt_nr].first << " , " << intervals_[pt_nr].second << std::endl;
+ std::cout << "x_grid : " << x_grid << std::endl;
+ std::cout << "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::cout << "After shift : \n";
+ std::cout << "x_grid : " << x_grid << std::endl;
+ std::cout << "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::cout << 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::cout << "Position : (" << x_grid + i << "," << y_grid + j
<< ") got increased by the value : " << filter[i][j] << 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::cout << "Reading the following values of min and max : " << this->min_ << " , " << this->max_ << std::endl;
}
std::string temp;
@@ -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..f02e930e 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_intervals.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_intervals.h
@@ -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::cout << "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::cout << "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::cout << "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::cout << "i : " << i << std::endl;
+ std::cout << "Interval : [" << this->intervals[i].first << " , " << this->intervals[i].second << " ] \n";
+ std::cout << "relative_length_of_this_interval : " << relative_length_of_this_interval << std::endl;
+ std::cout << "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::cout << 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::cout << "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::cout << "beginIt : " << beginIt << std::endl;
+ std::cout << "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::cout << "Result at this stage \n";
for (size_t aa = 0; aa != result.size(); ++aa) {
- std::cerr << result[aa] << " ";
+ std::cout << result[aa] << " ";
}
- std::cerr << std::endl;
+ std::cout << 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::cout << "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::cout << "[ " << 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::cout << "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::cout << "To : " << i + aa << " : " << distancesFromI[aa] << " ";
}
- std::cerr << std::endl;
+ std::cout << 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::cout << "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::cout << distances[i][j] << " ";
}
- std::cerr << std::endl;
+ std::cout << std::endl;
}
- std::cerr << std::endl << std::endl << "And here are the distances to the diagonal : " << std::endl;
+ std::cout << 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::cout << distances_from_diagonal[i] << " ";
}
- std::cerr << std::endl << std::endl;
+ std::cout << 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::cout << "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::cout << "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..dc93bb49 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::cout << "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::cout << "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::cout << "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::cout << "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::cout << "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::cout << "this->land[level].size() : " << this->land[level].size() << "\n";
+ if (operatorEqualDbg) std::cout << "rhs.land[level].size() : " << rhs.land[level].size() << "\n";
+ if (operatorEqualDbg) std::cout << "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::cout << "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::cout << "rhs.land[level][i] : " << rhs.land[level][i].first << " " << rhs.land[level][i].second << "\n";
+ if (operatorEqualDbg) std::cout << "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::cout << "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::cout << "Bars : \n";
for (size_t i = 0; i != bars.size(); ++i) {
- std::cerr << bars[i].first << " " << bars[i].second << "\n";
+ std::cout << bars[i].first << " " << bars[i].second << "\n";
}
getchar();
}
@@ -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::cout << "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::cout << "2 Adding to lambda_n : (" << point.first << " " << point.second << ")\n";
}
if (dbg) {
- std::cerr << "characteristicPoints[i+p] : " << characteristicPoints[i + p].first << " "
+ std::cout << "characteristicPoints[i+p] : " << characteristicPoints[i + p].first << " "
<< characteristicPoints[i + p].second << "\n";
- std::cerr << "point : " << point.first << " " << point.second << "\n";
+ std::cout << "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::cout << "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::cout << "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::cout << "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::cout << "point : " << point.first << " " << point.second << "\n";
+ std::cout << "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::cout << "point birth and death : " << minus_length(point) << " , " << birth_plus_deaths(point)
<< "\n";
- std::cerr << "3 Adding to newCharacteristicPoints : (" << characteristicPoints[i + p].first << " "
+ std::cout << "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::cout << "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::cout << "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::cout << "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::cout << "7 Adding to newCharacteristicPoints : (" << characteristicPoints[i].first << " "
<< characteristicPoints[i].second << ")\n";
}
}
@@ -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::cout << "Here \n";
+ std::cout << "x : " << x << "\n";
+ std::cout << "this->land[level][coordBegin].first : " << this->land[level][coordBegin].first << "\n";
+ std::cout << "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::cout << "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::cout << "coordBegin : " << coordBegin << "\n";
+ std::cout << "coordEnd : " << coordEnd << "\n";
+ std::cout << "this->land[level][coordBegin].first : " << this->land[level][coordBegin].first << "\n";
+ std::cout << "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::cout << "newCord : " << newCord << "\n";
+ std::cout << "this->land[level][newCord].first : " << this->land[level][newCord].first << "\n";
std::cin.ignore();
}
@@ -771,8 +771,8 @@ double Persistence_landscape::compute_value_at_a_given_point(unsigned level, dou
<< this->land[level][coordEnd].first << "\n";
std::cout << "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::cout << "coordBegin : " << coordBegin << "\n";
+ std::cout << "coordEnd : " << coordEnd << "\n";
std::cin.ignore();
}
return function_value(this->land[level][coordBegin], this->land[level][coordEnd], x);
@@ -943,7 +943,7 @@ 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::cout << "Reading a point : " << beginn << " , " << endd << std::endl;
}
} else {
if (dbg) {
@@ -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::cout << "land1.land[" << i << "].size() : " << land1.land[i].size() << std::endl;
+ std::cout << "land2.land[" << i << "].size() : " << land2.land[i].size() << std::endl;
}
getchar();
}
@@ -997,12 +997,12 @@ 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 << "p : " << p << "\n";
+ std::cout << "q : " << q << "\n";
+ std::cout << "land1.land.size() : " << land1.land.size() << std::endl;
+ std::cout << "land2.land.size() : " << land2.land.size() << std::endl;
+ std::cout << "land1.land[" << i << "].size() : " << land1.land[i].size() << std::endl;
+ std::cout << "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";
}
@@ -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::cout << " 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::cout << "Level : " << level << std::endl;
+ std::cout << "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::cout << "(" << pl1.land[level][i].first << "," << pl1.land[level][i].second << ") \n";
}
- std::cerr << "PL2 : \n";
+ std::cout << "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::cout << "(" << 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::cout << 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::cout << "pl1[level][i].second : " << pl1.land[level][i].second << std::endl;
+ std::cout << "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::cout << "val : " << val << std::endl;
std::cin.ignore();
}
}
}
- if (dbg) std::cerr << "minimalNumberOfLevels : " << minimalNumberOfLevels << std::endl;
+ if (dbg) std::cout << "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::cout << "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::cout << "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::cout << "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::cout << "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::cout << "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::cout << "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::cout << "[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::cout << "[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::cout << "a : " << a << ", b : " << b << " , c: " << c << ", d : " << d << std::endl;
+ std::cout << "x1 : " << x1 << " , x2 : " << x2 << std::endl;
+ std::cout << "contributionFromThisPart : " << contributionFromThisPart << std::endl;
+ std::cout << "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::cout << "Incrementing both \n";
}
} else {
if (dbg) {
- std::cerr << "Incrementing first \n";
+ std::cout << "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::cout << "Incrementing second \n";
}
}
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..b17fc0a5 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::cout << "this->grid_max : " << this->grid_max << std::endl;
+ std::cout << "this->grid_min : " << this->grid_min << std::endl;
+ std::cout << "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::cout << "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::cout << "this->values_of_landscapes[i][level] : " << this->values_of_landscapes[i][level] << std::endl;
+ std::cout << "previous_y : " << previous_y << std::endl;
+ std::cout << "current_y : " << current_y << std::endl;
+ std::cout << "dx : " << dx << std::endl;
+ std::cout << "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::cout << "dx : " << dx << std::endl;
+ std::cout << "previous_x : " << previous_x << std::endl;
+ std::cout << "previous_y : " << previous_y << std::endl;
+ std::cout << "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::cout << "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::cout << "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::cout << "Increasing result by : " << value_to_add << std::endl;
+ std::cout << "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::cout << "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::cout << "This is a procedure compute_value_at_a_given_point \n";
+ std::cout << "level : " << level << std::endl;
+ std::cout << "x : " << x << std::endl;
+ std::cout << "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::cout << "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::cout << "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::cout << "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::cout << "Problem in the position : " << i << " of values_of_landscapes. \n";
+ std::cout << 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::cout << "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::cout << "previous_x : " << previous_x << std::endl;
+ std::cout << "previous_y_l1 : " << previous_y_l1 << std::endl;
+ std::cout << "current_y_l1 : " << current_y_l1 << std::endl;
+ std::cout << "previous_y_l2 : " << previous_y_l2 << std::endl;
+ std::cout << "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::cout << "Here are the formulas for a line: \n";
+ std::cout << "a : " << a << std::endl;
+ std::cout << "b : " << b << std::endl;
+ std::cout << "c : " << c << std::endl;
+ std::cout << "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::cout << "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::cout << "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::cout << "added_value : " << added_value << std::endl;
+ std::cout << "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::cout << "first : " << first << std::endl;
+ std::cout << "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::cout << "Difference : " << lan << std::endl;
}
//| first-second |:
lan.abs();
if (dbg) {
- std::cerr << "Abs : " << lan << std::endl;
+ std::cout << "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::cout << "p : " << p << std::endl;
getchar();
}
result = lan.compute_integral_of_landscape(p);
if (dbg) {
- std::cerr << "integral : " << result << std::endl;
+ std::cout << "integral : " << result << std::endl;
getchar();
}
} else {
result = lan.compute_integral_of_landscape();
if (dbg) {
- std::cerr << "integral, without power : " << result << std::endl;
+ std::cout << "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::cout << "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::cout << "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::cout << "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::cout << "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::cout << 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::cout << "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::cout << "grid_interval_begin : " << grid_interval_begin << std::endl;
+ std::cout << "grid_interval_end : " << grid_interval_end << std::endl;
+ std::cout << "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::cout << "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::cout << "Adding landscape value (going down) for a point : " << i << " equal : " << landscape_value
<< std::endl;
}
}
diff --git a/src/Persistence_representations/include/gudhi/Persistence_vectors.h b/src/Persistence_representations/include/gudhi/Persistence_vectors.h
index 6776f4a3..be985909 100644
--- a/src/Persistence_representations/include/gudhi/Persistence_vectors.h
+++ b/src/Persistence_representations/include/gudhi/Persistence_vectors.h
@@ -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::cout << "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::cout << 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::cout << "Value : " << value << std::endl;
+ std::cout << "heap.front() : " << heap.front() << std::endl;
getchar();
}
if (-value < heap.front()) {
if (dbg) {
- std::cerr << "Replacing : " << heap.front() << " with : " << -value << std::endl;
+ std::cout << "Replacing : " << heap.front() << " with : " << -value << std::endl;
getchar();
}
// remove the first element from the heap
@@ -431,7 +431,7 @@ 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::cout << "This is the heap after all the operations :\n";
for (size_t i = 0; i != heap.size(); ++i) {
std::cout << heap[i] << " ";
}
@@ -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::cout << "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::cout << "Power : " << power << std::endl;
+ std::cout << "This : " << *this << std::endl;
+ std::cout << "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::cout << "|" << 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::cout << "| " << 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..8b348fd1 100644
--- a/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
+++ b/src/Persistence_representations/include/gudhi/read_persistence_from_file.h
@@ -50,7 +50,7 @@ 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::cout << "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;
}
@@ -59,7 +59,7 @@ std::vector<std::pair<double, double> > read_persistence_intervals_in_one_dimens
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::cout << "Considering interval : " << barcode_initial[i].first << " " << barcode_initial[i].second
<< std::endl;
}
@@ -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::cout << "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::cerr << "final_barcode.size() : " << final_barcode.size() << std::endl;
+ std::cout << "final_barcode.size() : " << final_barcode.size() << std::endl;
getchar();
}
diff --git a/src/common/include/gudhi/Debug_utils.h b/src/common/include/gudhi/Debug_utils.h
index 38abc06d..d4e66d8d 100644
--- a/src/common/include/gudhi/Debug_utils.h
+++ b/src/common/include/gudhi/Debug_utils.h
@@ -27,7 +27,7 @@
#define GUDHI_CHECK_code(CODE)
#endif
-#define PRINT(a) std::cerr << #a << ": " << (a) << " (DISP)" << std::endl
+#define PRINT(a) std::cout << #a << ": " << (a) << " (DISP)" << std::endl
// #define DBG_VERBOSE
#ifdef DBG_VERBOSE
diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h
index db31bf5c..ac9e987b 100644
--- a/src/common/include/gudhi/reader_utils.h
+++ b/src/common/include/gudhi/reader_utils.h
@@ -272,12 +272,12 @@ std::vector<std::vector<Filtration_value>> read_lower_triangular_matrix_from_csv
in.close();
#ifdef DEBUG_TRACES
- std::cerr << "Here is the matrix we read : \n";
+ std::cout << "Here is the matrix we read : \n";
for (size_t i = 0; i != result.size(); ++i) {
for (size_t j = 0; j != result[i].size(); ++j) {
- std::cerr << result[i][j] << " ";
+ std::cout << result[i][j] << " ";
}
- std::cerr << std::endl;
+ std::cout << std::endl;
}
#endif // DEBUG_TRACES