From bf4b4eeda9762ed9e99c2b24f19331fa0111fcfe Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 27 Jan 2020 10:43:16 +0100 Subject: Code review: Use std::clog instead of std::cout --- ...e_one_skeleton_rips_from_correlation_matrix.cpp | 12 +-- ...mple_one_skeleton_rips_from_distance_matrix.cpp | 12 +-- .../example_one_skeleton_rips_from_points.cpp | 12 +-- ..._rips_complex_from_csv_distance_matrix_file.cpp | 2 +- .../example/example_rips_complex_from_off_file.cpp | 2 +- src/Rips_complex/example/example_sparse_rips.cpp | 2 +- src/Rips_complex/test/test_rips_complex.cpp | 108 ++++++++++----------- .../rips_correlation_matrix_persistence.cpp | 28 +++--- .../utilities/rips_distance_matrix_persistence.cpp | 28 +++--- src/Rips_complex/utilities/rips_persistence.cpp | 28 +++--- .../utilities/sparse_rips_persistence.cpp | 28 +++--- 11 files changed, 131 insertions(+), 131 deletions(-) (limited to 'src/Rips_complex') diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp index 05bacb9f..3d2ba54f 100644 --- a/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp +++ b/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp @@ -63,18 +63,18 @@ int main() { // have a reverse filtration (i.e. filtration of boundary of each simplex S // is greater or equal to the filtration of S). // ---------------------------------------------------------------------------- - std::cout << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " + std::clog << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : stree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " + std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << std::endl; } return 0; diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp index bbc3c755..25f93b03 100644 --- a/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp +++ b/src/Rips_complex/example/example_one_skeleton_rips_from_distance_matrix.cpp @@ -39,19 +39,19 @@ int main() { // ---------------------------------------------------------------------------- // Display information about the one skeleton Rips complex // ---------------------------------------------------------------------------- - std::cout << "Rips complex is of dimension " << stree.dimension() << + std::clog << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << + std::clog << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : stree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " << "[" << stree.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] "; + std::clog << std::endl; } return 0; diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp index a1db8910..d9df245b 100644 --- a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp +++ b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp @@ -34,19 +34,19 @@ int main() { // ---------------------------------------------------------------------------- // Display information about the one skeleton Rips complex // ---------------------------------------------------------------------------- - std::cout << "Rips complex is of dimension " << stree.dimension() << + std::clog << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << + std::clog << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : stree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " << "[" << stree.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] "; + std::clog << std::endl; } return 0; } diff --git a/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp index b7040453..c0c57e7b 100644 --- a/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp +++ b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp @@ -42,7 +42,7 @@ int main(int argc, char **argv) { ouput_file_stream.open(std::string(argv[4])); streambuffer = ouput_file_stream.rdbuf(); } else { - streambuffer = std::cout.rdbuf(); + streambuffer = std::clog.rdbuf(); } Simplex_tree stree; diff --git a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp index 36b468a7..9aa7a657 100644 --- a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp +++ b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp @@ -41,7 +41,7 @@ int main(int argc, char **argv) { ouput_file_stream.open(std::string(argv[4])); streambuffer = ouput_file_stream.rdbuf(); } else { - streambuffer = std::cout.rdbuf(); + streambuffer = std::clog.rdbuf(); } Simplex_tree stree; diff --git a/src/Rips_complex/example/example_sparse_rips.cpp b/src/Rips_complex/example/example_sparse_rips.cpp index 1c95b48c..4bd31103 100644 --- a/src/Rips_complex/example/example_sparse_rips.cpp +++ b/src/Rips_complex/example/example_sparse_rips.cpp @@ -25,6 +25,6 @@ int main() { // ---------------------------------------------------------------------------- // Display information about the complex // ---------------------------------------------------------------------------- - std::cout << "Sparse Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() + std::clog << "Sparse Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; } diff --git a/src/Rips_complex/test/test_rips_complex.cpp b/src/Rips_complex/test/test_rips_complex.cpp index 1225f8df..19dcd283 100644 --- a/src/Rips_complex/test/test_rips_complex.cpp +++ b/src/Rips_complex/test/test_rips_complex.cpp @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) { // ---------------------------------------------------------------------------- std::string off_file_name("alphacomplexdoc.off"); double rips_threshold = 12.0; - std::cout << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" << + std::clog << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" << rips_threshold << "==========" << std::endl; Gudhi::Points_off_reader off_reader(off_file_name); @@ -52,14 +52,14 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) { const int DIMENSION_1 = 1; Simplex_tree st; rips_complex_from_file.create_complex(st, DIMENSION_1); - std::cout << "st.dimension()=" << st.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << std::endl; BOOST_CHECK(st.dimension() == DIMENSION_1); const int NUMBER_OF_VERTICES = 7; - std::cout << "st.num_vertices()=" << st.num_vertices() << std::endl; + std::clog << "st.num_vertices()=" << st.num_vertices() << std::endl; BOOST_CHECK(st.num_vertices() == NUMBER_OF_VERTICES); - std::cout << "st.num_simplices()=" << st.num_simplices() << std::endl; + std::clog << "st.num_simplices()=" << st.num_simplices() << std::endl; BOOST_CHECK(st.num_simplices() == 18); // Check filtration values of vertices is 0.0 @@ -71,12 +71,12 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) { for (auto f_simplex : st.skeleton_simplex_range(DIMENSION_1)) { if (DIMENSION_1 == st.dimension(f_simplex)) { std::vector vp; - std::cout << "vertex = ("; + std::clog << "vertex = ("; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << vertex << ","; + std::clog << vertex << ","; vp.push_back(off_reader.get_point_cloud().at(vertex)); } - std::cout << ") - distance =" << Gudhi::Euclidean_distance()(vp.at(0), vp.at(1)) << + std::clog << ") - distance =" << Gudhi::Euclidean_distance()(vp.at(0), vp.at(1)) << " - filtration =" << st.filtration(f_simplex) << std::endl; BOOST_CHECK(vp.size() == 2); GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), Gudhi::Euclidean_distance()(vp.at(0), vp.at(1))); @@ -86,46 +86,46 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) { const int DIMENSION_2 = 2; Simplex_tree st2; rips_complex_from_file.create_complex(st2, DIMENSION_2); - std::cout << "st2.dimension()=" << st2.dimension() << std::endl; + std::clog << "st2.dimension()=" << st2.dimension() << std::endl; BOOST_CHECK(st2.dimension() == DIMENSION_2); - std::cout << "st2.num_vertices()=" << st2.num_vertices() << std::endl; + std::clog << "st2.num_vertices()=" << st2.num_vertices() << std::endl; BOOST_CHECK(st2.num_vertices() == NUMBER_OF_VERTICES); - std::cout << "st2.num_simplices()=" << st2.num_simplices() << std::endl; + std::clog << "st2.num_simplices()=" << st2.num_simplices() << std::endl; BOOST_CHECK(st2.num_simplices() == 23); Simplex_tree::Filtration_value f01 = st2.filtration(st2.find({0, 1})); Simplex_tree::Filtration_value f02 = st2.filtration(st2.find({0, 2})); Simplex_tree::Filtration_value f12 = st2.filtration(st2.find({1, 2})); Simplex_tree::Filtration_value f012 = st2.filtration(st2.find({0, 1, 2})); - std::cout << "f012= " << f012 << " | f01= " << f01 << " - f02= " << f02 << " - f12= " << f12 << std::endl; + std::clog << "f012= " << f012 << " | f01= " << f01 << " - f02= " << f02 << " - f12= " << f12 << std::endl; GUDHI_TEST_FLOAT_EQUALITY_CHECK(f012, std::max(f01, std::max(f02,f12))); Simplex_tree::Filtration_value f45 = st2.filtration(st2.find({4, 5})); Simplex_tree::Filtration_value f56 = st2.filtration(st2.find({5, 6})); Simplex_tree::Filtration_value f46 = st2.filtration(st2.find({4, 6})); Simplex_tree::Filtration_value f456 = st2.filtration(st2.find({4, 5, 6})); - std::cout << "f456= " << f456 << " | f45= " << f45 << " - f56= " << f56 << " - f46= " << f46 << std::endl; + std::clog << "f456= " << f456 << " | f45= " << f45 << " - f56= " << f56 << " - f46= " << f46 << std::endl; GUDHI_TEST_FLOAT_EQUALITY_CHECK(f456, std::max(f45, std::max(f56,f46))); const int DIMENSION_3 = 3; Simplex_tree st3; rips_complex_from_file.create_complex(st3, DIMENSION_3); - std::cout << "st3.dimension()=" << st3.dimension() << std::endl; + std::clog << "st3.dimension()=" << st3.dimension() << std::endl; BOOST_CHECK(st3.dimension() == DIMENSION_3); - std::cout << "st3.num_vertices()=" << st3.num_vertices() << std::endl; + std::clog << "st3.num_vertices()=" << st3.num_vertices() << std::endl; BOOST_CHECK(st3.num_vertices() == NUMBER_OF_VERTICES); - std::cout << "st3.num_simplices()=" << st3.num_simplices() << std::endl; + std::clog << "st3.num_simplices()=" << st3.num_simplices() << std::endl; BOOST_CHECK(st3.num_simplices() == 24); Simplex_tree::Filtration_value f123 = st3.filtration(st3.find({1, 2, 3})); Simplex_tree::Filtration_value f013 = st3.filtration(st3.find({0, 1, 3})); Simplex_tree::Filtration_value f023 = st3.filtration(st3.find({0, 2, 3})); Simplex_tree::Filtration_value f0123 = st3.filtration(st3.find({0, 1, 2, 3})); - std::cout << "f0123= " << f0123 << " | f012= " << f012 << " - f123= " << f123 << " - f013= " << f013 << + std::clog << "f0123= " << f0123 << " | f012= " << f012 << " - f123= " << f123 << " - f013= " << f013 << " - f023= " << f023 << std::endl; GUDHI_TEST_FLOAT_EQUALITY_CHECK(f0123, std::max(f012, std::max(f123, std::max(f013, f023)))); @@ -176,34 +176,34 @@ BOOST_AUTO_TEST_CASE(Rips_complex_from_points) { // ---------------------------------------------------------------------------- Rips_complex rips_complex_from_points(points, 2.0, Custom_square_euclidean_distance()); - std::cout << "========== Rips_complex_from_points ==========" << std::endl; + std::clog << "========== Rips_complex_from_points ==========" << std::endl; Simplex_tree st; const int DIMENSION = 3; rips_complex_from_points.create_complex(st, DIMENSION); // Another way to check num_simplices - std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; int num_simplices = 0; for (auto f_simplex : st.filtration_simplex_range()) { num_simplices++; - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " << "[" << st.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << ") -> " << "[" << st.filtration(f_simplex) << "] "; + std::clog << std::endl; } BOOST_CHECK(num_simplices == 15); - std::cout << "st.num_simplices()=" << st.num_simplices() << std::endl; + std::clog << "st.num_simplices()=" << st.num_simplices() << std::endl; BOOST_CHECK(st.num_simplices() == 15); - std::cout << "st.dimension()=" << st.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << std::endl; BOOST_CHECK(st.dimension() == DIMENSION); - std::cout << "st.num_vertices()=" << st.num_vertices() << std::endl; + std::clog << "st.num_vertices()=" << st.num_vertices() << std::endl; BOOST_CHECK(st.num_vertices() == 4); for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << "dimension(" << st.dimension(f_simplex) << ") - f = " << st.filtration(f_simplex) << std::endl; + std::clog << "dimension(" << st.dimension(f_simplex) << ") - f = " << st.filtration(f_simplex) << std::endl; switch (st.dimension(f_simplex)) { case 0: GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), 0.0); @@ -241,34 +241,34 @@ BOOST_AUTO_TEST_CASE(Sparse_rips_complex_from_points) { // .001 is small enough that we get a deterministic result matching the exact Rips Sparse_rips_complex sparse_rips(points, Custom_square_euclidean_distance(), .001); - std::cout << "========== Sparse_rips_complex_from_points ==========" << std::endl; + std::clog << "========== Sparse_rips_complex_from_points ==========" << std::endl; Simplex_tree st; const int DIMENSION = 3; sparse_rips.create_complex(st, DIMENSION); // Another way to check num_simplices - std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl; int num_simplices = 0; for (auto f_simplex : st.filtration_simplex_range()) { num_simplices++; - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " << "[" << st.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << ") -> " << "[" << st.filtration(f_simplex) << "] "; + std::clog << std::endl; } BOOST_CHECK(num_simplices == 15); - std::cout << "st.num_simplices()=" << st.num_simplices() << std::endl; + std::clog << "st.num_simplices()=" << st.num_simplices() << std::endl; BOOST_CHECK(st.num_simplices() == 15); - std::cout << "st.dimension()=" << st.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << std::endl; BOOST_CHECK(st.dimension() == DIMENSION); - std::cout << "st.num_vertices()=" << st.num_vertices() << std::endl; + std::clog << "st.num_vertices()=" << st.num_vertices() << std::endl; BOOST_CHECK(st.num_vertices() == 4); for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << "dimension(" << st.dimension(f_simplex) << ") - f = " << st.filtration(f_simplex) << std::endl; + std::clog << "dimension(" << st.dimension(f_simplex) << ") - f = " << st.filtration(f_simplex) << std::endl; switch (st.dimension(f_simplex)) { case 0: GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), 0.0); @@ -293,7 +293,7 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) { // ---------------------------------------------------------------------------- std::string csv_file_name("full_square_distance_matrix.csv"); double rips_threshold = 12.0; - std::cout << "========== CSV FILE NAME = " << csv_file_name << " - Rips threshold=" << + std::clog << "========== CSV FILE NAME = " << csv_file_name << " - Rips threshold=" << rips_threshold << "==========" << std::endl; Distance_matrix distances = Gudhi::read_lower_triangular_matrix_from_csv_file(csv_file_name); @@ -302,14 +302,14 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) { const int DIMENSION_1 = 1; Simplex_tree st; rips_complex_from_file.create_complex(st, DIMENSION_1); - std::cout << "st.dimension()=" << st.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << std::endl; BOOST_CHECK(st.dimension() == DIMENSION_1); const int NUMBER_OF_VERTICES = 7; - std::cout << "st.num_vertices()=" << st.num_vertices() << std::endl; + std::clog << "st.num_vertices()=" << st.num_vertices() << std::endl; BOOST_CHECK(st.num_vertices() == NUMBER_OF_VERTICES); - std::cout << "st.num_simplices()=" << st.num_simplices() << std::endl; + std::clog << "st.num_simplices()=" << st.num_simplices() << std::endl; BOOST_CHECK(st.num_simplices() == 18); // Check filtration values of vertices is 0.0 @@ -321,12 +321,12 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) { for (auto f_simplex : st.skeleton_simplex_range(DIMENSION_1)) { if (DIMENSION_1 == st.dimension(f_simplex)) { std::vector vvh; - std::cout << "vertex = ("; + std::clog << "vertex = ("; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << vertex << ","; + std::clog << vertex << ","; vvh.push_back(vertex); } - std::cout << ") - filtration =" << st.filtration(f_simplex) << std::endl; + std::clog << ") - filtration =" << st.filtration(f_simplex) << std::endl; BOOST_CHECK(vvh.size() == 2); GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), distances[vvh.at(0)][vvh.at(1)]); } @@ -335,46 +335,46 @@ BOOST_AUTO_TEST_CASE(Rips_doc_csv_file) { const int DIMENSION_2 = 2; Simplex_tree st2; rips_complex_from_file.create_complex(st2, DIMENSION_2); - std::cout << "st2.dimension()=" << st2.dimension() << std::endl; + std::clog << "st2.dimension()=" << st2.dimension() << std::endl; BOOST_CHECK(st2.dimension() == DIMENSION_2); - std::cout << "st2.num_vertices()=" << st2.num_vertices() << std::endl; + std::clog << "st2.num_vertices()=" << st2.num_vertices() << std::endl; BOOST_CHECK(st2.num_vertices() == NUMBER_OF_VERTICES); - std::cout << "st2.num_simplices()=" << st2.num_simplices() << std::endl; + std::clog << "st2.num_simplices()=" << st2.num_simplices() << std::endl; BOOST_CHECK(st2.num_simplices() == 23); Simplex_tree::Filtration_value f01 = st2.filtration(st2.find({0, 1})); Simplex_tree::Filtration_value f02 = st2.filtration(st2.find({0, 2})); Simplex_tree::Filtration_value f12 = st2.filtration(st2.find({1, 2})); Simplex_tree::Filtration_value f012 = st2.filtration(st2.find({0, 1, 2})); - std::cout << "f012= " << f012 << " | f01= " << f01 << " - f02= " << f02 << " - f12= " << f12 << std::endl; + std::clog << "f012= " << f012 << " | f01= " << f01 << " - f02= " << f02 << " - f12= " << f12 << std::endl; GUDHI_TEST_FLOAT_EQUALITY_CHECK(f012, std::max(f01, std::max(f02,f12))); Simplex_tree::Filtration_value f45 = st2.filtration(st2.find({4, 5})); Simplex_tree::Filtration_value f56 = st2.filtration(st2.find({5, 6})); Simplex_tree::Filtration_value f46 = st2.filtration(st2.find({4, 6})); Simplex_tree::Filtration_value f456 = st2.filtration(st2.find({4, 5, 6})); - std::cout << "f456= " << f456 << " | f45= " << f45 << " - f56= " << f56 << " - f46= " << f46 << std::endl; + std::clog << "f456= " << f456 << " | f45= " << f45 << " - f56= " << f56 << " - f46= " << f46 << std::endl; GUDHI_TEST_FLOAT_EQUALITY_CHECK(f456, std::max(f45, std::max(f56,f46))); const int DIMENSION_3 = 3; Simplex_tree st3; rips_complex_from_file.create_complex(st3, DIMENSION_3); - std::cout << "st3.dimension()=" << st3.dimension() << std::endl; + std::clog << "st3.dimension()=" << st3.dimension() << std::endl; BOOST_CHECK(st3.dimension() == DIMENSION_3); - std::cout << "st3.num_vertices()=" << st3.num_vertices() << std::endl; + std::clog << "st3.num_vertices()=" << st3.num_vertices() << std::endl; BOOST_CHECK(st3.num_vertices() == NUMBER_OF_VERTICES); - std::cout << "st3.num_simplices()=" << st3.num_simplices() << std::endl; + std::clog << "st3.num_simplices()=" << st3.num_simplices() << std::endl; BOOST_CHECK(st3.num_simplices() == 24); Simplex_tree::Filtration_value f123 = st3.filtration(st3.find({1, 2, 3})); Simplex_tree::Filtration_value f013 = st3.filtration(st3.find({0, 1, 3})); Simplex_tree::Filtration_value f023 = st3.filtration(st3.find({0, 2, 3})); Simplex_tree::Filtration_value f0123 = st3.filtration(st3.find({0, 1, 2, 3})); - std::cout << "f0123= " << f0123 << " | f012= " << f012 << " - f123= " << f123 << " - f013= " << f013 << + std::clog << "f0123= " << f0123 << " | f012= " << f012 << " - f123= " << f123 << " - f013= " << f013 << " - f023= " << f023 << std::endl; GUDHI_TEST_FLOAT_EQUALITY_CHECK(f0123, std::max(f012, std::max(f123, std::max(f013, f023)))); @@ -389,7 +389,7 @@ BOOST_AUTO_TEST_CASE(Rips_create_complex_throw) { // ---------------------------------------------------------------------------- std::string off_file_name("alphacomplexdoc.off"); double rips_threshold = 12.0; - std::cout << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" << + std::clog << "========== OFF FILE NAME = " << off_file_name << " - Rips threshold=" << rips_threshold << "==========" << std::endl; Gudhi::Points_off_reader off_reader(off_file_name); @@ -398,7 +398,7 @@ BOOST_AUTO_TEST_CASE(Rips_create_complex_throw) { Simplex_tree stree; std::vector simplex = {0, 1, 2}; stree.insert_simplex_and_subfaces(simplex); - std::cout << "Check exception throw in debug mode" << std::endl; + std::clog << "Check exception throw in debug mode" << std::endl; // throw excpt because stree is not empty BOOST_CHECK_THROW (rips_complex_from_file.create_complex(stree, 1), std::invalid_argument); } diff --git a/src/Rips_complex/utilities/rips_correlation_matrix_persistence.cpp b/src/Rips_complex/utilities/rips_correlation_matrix_persistence.cpp index 585de4a0..67f921a6 100644 --- a/src/Rips_complex/utilities/rips_correlation_matrix_persistence.cpp +++ b/src/Rips_complex/utilities/rips_correlation_matrix_persistence.cpp @@ -68,8 +68,8 @@ int main(int argc, char* argv[]) { Simplex_tree simplex_tree; rips_complex_from_file.create_complex(simplex_tree, dim_max); - std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; - std::cout << " and has dimension " << simplex_tree.dimension() << " \n"; + std::clog << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; + std::clog << " and has dimension " << simplex_tree.dimension() << " \n"; // Sort the simplices in the order of the filtration simplex_tree.initialize_filtration(); @@ -121,7 +121,7 @@ void program_options(int argc, char* argv[], std::string& csv_matrix_file, std:: po::options_description visible("Allowed options", 100); visible.add_options()("help,h", "produce help message")( "output-file,o", po::value(&filediag)->default_value(std::string()), - "Name of file in which the persistence diagram is written. Default print in std::cout")( + "Name of file in which the persistence diagram is written. Default print in std::clog")( "min-edge-corelation,c", po::value(&correlation_min)->default_value(0), "Minimal corelation of an edge for the Rips complex construction.")( "cpx-dimension,d", po::value(&dim_max)->default_value(1), @@ -143,17 +143,17 @@ void program_options(int argc, char* argv[], std::string& csv_matrix_file, std:: po::notify(vm); if (vm.count("help") || !vm.count("input-file")) { - std::cout << std::endl; - std::cout << "Compute the persistent homology with coefficient field Z/pZ \n"; - std::cout << "of a Rips complex defined on a corelation matrix.\n \n"; - std::cout << "The output diagram contains one bar per line, written with the convention: \n"; - std::cout << " p dim b d \n"; - std::cout << "where dim is the dimension of the homological feature,\n"; - std::cout << "b and d are respectively the birth and death of the feature and \n"; - std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; - - std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; - std::cout << visible << std::endl; + std::clog << std::endl; + std::clog << "Compute the persistent homology with coefficient field Z/pZ \n"; + std::clog << "of a Rips complex defined on a corelation matrix.\n \n"; + std::clog << "The output diagram contains one bar per line, written with the convention: \n"; + std::clog << " p dim b d \n"; + std::clog << "where dim is the dimension of the homological feature,\n"; + std::clog << "b and d are respectively the birth and death of the feature and \n"; + std::clog << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; + + std::clog << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; + std::clog << visible << std::endl; exit(-1); } } diff --git a/src/Rips_complex/utilities/rips_distance_matrix_persistence.cpp b/src/Rips_complex/utilities/rips_distance_matrix_persistence.cpp index ad429e11..4ad19675 100644 --- a/src/Rips_complex/utilities/rips_distance_matrix_persistence.cpp +++ b/src/Rips_complex/utilities/rips_distance_matrix_persistence.cpp @@ -47,8 +47,8 @@ int main(int argc, char* argv[]) { Simplex_tree simplex_tree; rips_complex_from_file.create_complex(simplex_tree, dim_max); - std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; - std::cout << " and has dimension " << simplex_tree.dimension() << " \n"; + std::clog << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; + std::clog << " and has dimension " << simplex_tree.dimension() << " \n"; // Sort the simplices in the order of the filtration simplex_tree.initialize_filtration(); @@ -82,7 +82,7 @@ void program_options(int argc, char* argv[], std::string& csv_matrix_file, std:: po::options_description visible("Allowed options", 100); visible.add_options()("help,h", "produce help message")( "output-file,o", po::value(&filediag)->default_value(std::string()), - "Name of file in which the persistence diagram is written. Default print in std::cout")( + "Name of file in which the persistence diagram is written. Default print in std::clog")( "max-edge-length,r", po::value(&threshold)->default_value(std::numeric_limits::infinity()), "Maximal length of an edge for the Rips complex construction.")( @@ -105,17 +105,17 @@ void program_options(int argc, char* argv[], std::string& csv_matrix_file, std:: po::notify(vm); if (vm.count("help") || !vm.count("input-file")) { - std::cout << std::endl; - std::cout << "Compute the persistent homology with coefficient field Z/pZ \n"; - std::cout << "of a Rips complex defined on a set of distance matrix.\n \n"; - std::cout << "The output diagram contains one bar per line, written with the convention: \n"; - std::cout << " p dim b d \n"; - std::cout << "where dim is the dimension of the homological feature,\n"; - std::cout << "b and d are respectively the birth and death of the feature and \n"; - std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; - - std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; - std::cout << visible << std::endl; + std::clog << std::endl; + std::clog << "Compute the persistent homology with coefficient field Z/pZ \n"; + std::clog << "of a Rips complex defined on a set of distance matrix.\n \n"; + std::clog << "The output diagram contains one bar per line, written with the convention: \n"; + std::clog << " p dim b d \n"; + std::clog << "where dim is the dimension of the homological feature,\n"; + std::clog << "b and d are respectively the birth and death of the feature and \n"; + std::clog << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; + + std::clog << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; + std::clog << visible << std::endl; exit(-1); } } diff --git a/src/Rips_complex/utilities/rips_persistence.cpp b/src/Rips_complex/utilities/rips_persistence.cpp index daa7e1db..4cc63d3c 100644 --- a/src/Rips_complex/utilities/rips_persistence.cpp +++ b/src/Rips_complex/utilities/rips_persistence.cpp @@ -49,8 +49,8 @@ int main(int argc, char* argv[]) { Simplex_tree simplex_tree; rips_complex_from_file.create_complex(simplex_tree, dim_max); - std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; - std::cout << " and has dimension " << simplex_tree.dimension() << " \n"; + std::clog << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; + std::clog << " and has dimension " << simplex_tree.dimension() << " \n"; // Sort the simplices in the order of the filtration simplex_tree.initialize_filtration(); @@ -84,7 +84,7 @@ void program_options(int argc, char* argv[], std::string& off_file_points, std:: po::options_description visible("Allowed options", 100); visible.add_options()("help,h", "produce help message")( "output-file,o", po::value(&filediag)->default_value(std::string()), - "Name of file in which the persistence diagram is written. Default print in std::cout")( + "Name of file in which the persistence diagram is written. Default print in std::clog")( "max-edge-length,r", po::value(&threshold)->default_value(std::numeric_limits::infinity()), "Maximal length of an edge for the Rips complex construction.")( @@ -107,17 +107,17 @@ void program_options(int argc, char* argv[], std::string& off_file_points, std:: po::notify(vm); if (vm.count("help") || !vm.count("input-file")) { - std::cout << std::endl; - std::cout << "Compute the persistent homology with coefficient field Z/pZ \n"; - std::cout << "of a Rips complex defined on a set of input points.\n \n"; - std::cout << "The output diagram contains one bar per line, written with the convention: \n"; - std::cout << " p dim b d \n"; - std::cout << "where dim is the dimension of the homological feature,\n"; - std::cout << "b and d are respectively the birth and death of the feature and \n"; - std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; - - std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; - std::cout << visible << std::endl; + std::clog << std::endl; + std::clog << "Compute the persistent homology with coefficient field Z/pZ \n"; + std::clog << "of a Rips complex defined on a set of input points.\n \n"; + std::clog << "The output diagram contains one bar per line, written with the convention: \n"; + std::clog << " p dim b d \n"; + std::clog << "where dim is the dimension of the homological feature,\n"; + std::clog << "b and d are respectively the birth and death of the feature and \n"; + std::clog << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; + + std::clog << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; + std::clog << visible << std::endl; exit(-1); } } diff --git a/src/Rips_complex/utilities/sparse_rips_persistence.cpp b/src/Rips_complex/utilities/sparse_rips_persistence.cpp index cefd8a67..40606158 100644 --- a/src/Rips_complex/utilities/sparse_rips_persistence.cpp +++ b/src/Rips_complex/utilities/sparse_rips_persistence.cpp @@ -51,8 +51,8 @@ int main(int argc, char* argv[]) { Simplex_tree simplex_tree; sparse_rips.create_complex(simplex_tree, dim_max); - std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; - std::cout << " and has dimension " << simplex_tree.dimension() << " \n"; + std::clog << "The complex contains " << simplex_tree.num_simplices() << " simplices \n"; + std::clog << " and has dimension " << simplex_tree.dimension() << " \n"; // Sort the simplices in the order of the filtration simplex_tree.initialize_filtration(); @@ -87,7 +87,7 @@ void program_options(int argc, char* argv[], std::string& off_file_points, std:: po::options_description visible("Allowed options", 100); visible.add_options()("help,h", "produce help message")( "output-file,o", po::value(&filediag)->default_value(std::string()), - "Name of file in which the persistence diagram is written. Default print in std::cout")( + "Name of file in which the persistence diagram is written. Default print in std::clog")( "max-edge-length,r", po::value(&threshold)->default_value(std::numeric_limits::infinity()), "Maximal length of an edge for the Rips complex construction.")( @@ -112,17 +112,17 @@ void program_options(int argc, char* argv[], std::string& off_file_points, std:: po::notify(vm); if (vm.count("help") || !vm.count("input-file")) { - std::cout << std::endl; - std::cout << "Compute the persistent homology with coefficient field Z/pZ \n"; - std::cout << "of a sparse 1/(1-epsilon)-approximation of the Rips complex \ndefined on a set of input points.\n \n"; - std::cout << "The output diagram contains one bar per line, written with the convention: \n"; - std::cout << " p dim b d \n"; - std::cout << "where dim is the dimension of the homological feature,\n"; - std::cout << "b and d are respectively the birth and death of the feature and \n"; - std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; - - std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; - std::cout << visible << std::endl; + std::clog << std::endl; + std::clog << "Compute the persistent homology with coefficient field Z/pZ \n"; + std::clog << "of a sparse 1/(1-epsilon)-approximation of the Rips complex \ndefined on a set of input points.\n \n"; + std::clog << "The output diagram contains one bar per line, written with the convention: \n"; + std::clog << " p dim b d \n"; + std::clog << "where dim is the dimension of the homological feature,\n"; + std::clog << "b and d are respectively the birth and death of the feature and \n"; + std::clog << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; + + std::clog << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; + std::clog << visible << std::endl; exit(-1); } } -- cgit v1.2.3