summaryrefslogtreecommitdiff
path: root/src/Witness_complex
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-27 10:43:16 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-01-27 10:43:16 +0100
commitbf4b4eeda9762ed9e99c2b24f19331fa0111fcfe (patch)
tree03950723bd824ba3c69597e022500dfd5f37e914 /src/Witness_complex
parentc7b70317b643b2eb9c603602da9c979388829821 (diff)
Code review: Use std::clog instead of std::cout
Diffstat (limited to 'src/Witness_complex')
-rw-r--r--src/Witness_complex/example/example_nearest_landmark_table.cpp2
-rw-r--r--src/Witness_complex/example/example_strong_witness_complex_off.cpp8
-rw-r--r--src/Witness_complex/example/example_witness_complex_off.cpp8
-rw-r--r--src/Witness_complex/example/example_witness_complex_sphere.cpp8
-rw-r--r--src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp16
-rw-r--r--src/Witness_complex/test/test_simple_witness_complex.cpp4
-rw-r--r--src/Witness_complex/utilities/strong_witness_persistence.cpp32
-rw-r--r--src/Witness_complex/utilities/weak_witness_persistence.cpp32
-rw-r--r--src/Witness_complex/utilities/witnesscomplex.md4
9 files changed, 57 insertions, 57 deletions
diff --git a/src/Witness_complex/example/example_nearest_landmark_table.cpp b/src/Witness_complex/example/example_nearest_landmark_table.cpp
index 441900c1..14101847 100644
--- a/src/Witness_complex/example/example_nearest_landmark_table.cpp
+++ b/src/Witness_complex/example/example_nearest_landmark_table.cpp
@@ -33,7 +33,7 @@ int main(int argc, char * const argv[]) {
Witness_complex witness_complex(nlt);
witness_complex.create_complex(simplex_tree, .41);
- std::cout << "Number of simplices: " << simplex_tree.num_simplices() << std::endl;
+ std::clog << "Number of simplices: " << simplex_tree.num_simplices() << std::endl;
Persistent_cohomology pcoh(simplex_tree);
// initializes the coefficient field for homology
diff --git a/src/Witness_complex/example/example_strong_witness_complex_off.cpp b/src/Witness_complex/example/example_strong_witness_complex_off.cpp
index 19f73836..583a04ab 100644
--- a/src/Witness_complex/example/example_strong_witness_complex_off.cpp
+++ b/src/Witness_complex/example/example_strong_witness_complex_off.cpp
@@ -38,8 +38,8 @@ int main(int argc, char* const argv[]) {
}
point_vector = Point_vector(off_reader.get_point_cloud());
- std::cout << "Successfully read " << point_vector.size() << " points.\n";
- std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n";
+ std::clog << "Successfully read " << point_vector.size() << " points.\n";
+ std::clog << "Ambient dimension is " << point_vector[0].dimension() << ".\n";
// Choose landmarks (decomment one of the following two lines)
// Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks));
@@ -52,6 +52,6 @@ int main(int argc, char* const argv[]) {
witness_complex.create_complex(simplex_tree, alpha2, lim_dim);
end = clock();
- std::cout << "Strong witness complex took " << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n";
- std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
+ std::clog << "Strong witness complex took " << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n";
+ std::clog << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
}
diff --git a/src/Witness_complex/example/example_witness_complex_off.cpp b/src/Witness_complex/example/example_witness_complex_off.cpp
index be11c955..3635da78 100644
--- a/src/Witness_complex/example/example_witness_complex_off.cpp
+++ b/src/Witness_complex/example/example_witness_complex_off.cpp
@@ -42,8 +42,8 @@ int main(int argc, char * const argv[]) {
}
point_vector = Point_vector(off_reader.get_point_cloud());
- std::cout << "Successfully read " << point_vector.size() << " points.\n";
- std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n";
+ std::clog << "Successfully read " << point_vector.size() << " points.\n";
+ std::clog << "Ambient dimension is " << point_vector[0].dimension() << ".\n";
// Choose landmarks (decomment one of the following two lines)
// Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks));
@@ -56,7 +56,7 @@ int main(int argc, char * const argv[]) {
witness_complex.create_complex(simplex_tree, alpha2, lim_dim);
end = clock();
- std::cout << "Witness complex took "
+ std::clog << "Witness complex took "
<< static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n";
- std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
+ std::clog << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
}
diff --git a/src/Witness_complex/example/example_witness_complex_sphere.cpp b/src/Witness_complex/example/example_witness_complex_sphere.cpp
index 9e3c972d..78d5db4f 100644
--- a/src/Witness_complex/example/example_witness_complex_sphere.cpp
+++ b/src/Witness_complex/example/example_witness_complex_sphere.cpp
@@ -47,8 +47,8 @@ int main(int argc, char* const argv[]) {
Gudhi::Simplex_tree<> simplex_tree;
Point_Vector point_vector, landmarks;
generate_points_sphere(point_vector, nbP, 4);
- std::cout << "Successfully generated " << point_vector.size() << " points.\n";
- std::cout << "Ambient dimension is " << point_vector[0].size() << ".\n";
+ std::clog << "Successfully generated " << point_vector.size() << " points.\n";
+ std::clog << "Ambient dimension is " << point_vector[0].size() << ".\n";
// Choose landmarks
start = clock();
@@ -62,8 +62,8 @@ int main(int argc, char* const argv[]) {
witness_complex.create_complex(simplex_tree, 0);
end = clock();
double time = static_cast<double>(end - start) / CLOCKS_PER_SEC;
- std::cout << "Witness complex for " << number_of_landmarks << " landmarks took " << time << " s. \n";
- std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
+ std::clog << "Witness complex for " << number_of_landmarks << " landmarks took " << time << " s. \n";
+ std::clog << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
l_time.push_back(std::make_pair(nbP, time));
}
write_data(l_time, "w_time.dat");
diff --git a/src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp b/src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp
index 4f718203..9b19f6dc 100644
--- a/src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp
+++ b/src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp
@@ -82,12 +82,12 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) {
witnesses);
eucl_witness_complex.create_complex(complex, 0);
- std::cout << "complex.num_simplices() = " << complex.num_simplices() << std::endl;
+ std::clog << "complex.num_simplices() = " << complex.num_simplices() << std::endl;
BOOST_CHECK(complex.num_simplices() == 24);
eucl_witness_complex.create_complex(relaxed_complex, 8.01);
- std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl;
+ std::clog << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl;
BOOST_CHECK(relaxed_complex.num_simplices() == 239);
// The corner simplex {0,2,5,7} and its cofaces are missing.
@@ -95,12 +95,12 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) {
WitnessComplex witness_complex(nearest_landmark_table);
witness_complex.create_complex(complex_ne, 0);
- std::cout << "complex.num_simplices() = " << complex_ne.num_simplices() << std::endl;
+ std::clog << "complex.num_simplices() = " << complex_ne.num_simplices() << std::endl;
BOOST_CHECK(complex_ne.num_simplices() == 24);
witness_complex.create_complex(relaxed_complex_ne, 8.01);
- std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex_ne.num_simplices() << std::endl;
+ std::clog << "relaxed_complex.num_simplices() = " << relaxed_complex_ne.num_simplices() << std::endl;
BOOST_CHECK(relaxed_complex_ne.num_simplices() == 239);
@@ -111,10 +111,10 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) {
eucl_strong_witness_complex.create_complex(strong_relaxed_complex, 9.1);
eucl_strong_witness_complex.create_complex(strong_relaxed_complex2, 9.1, 2);
- std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl;
+ std::clog << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl;
BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239);
- std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl;
+ std::clog << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl;
BOOST_CHECK(strong_relaxed_complex2.num_simplices() == 92);
@@ -124,10 +124,10 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) {
strong_witness_complex.create_complex(strong_relaxed_complex_ne, 9.1);
strong_witness_complex.create_complex(strong_relaxed_complex2_ne, 9.1, 2);
- std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex_ne.num_simplices() << std::endl;
+ std::clog << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex_ne.num_simplices() << std::endl;
BOOST_CHECK(strong_relaxed_complex_ne.num_simplices() == 239);
- std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2_ne.num_simplices() << std::endl;
+ std::clog << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2_ne.num_simplices() << std::endl;
BOOST_CHECK(strong_relaxed_complex2_ne.num_simplices() == 92);
diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp
index 9e3509d3..7c48cc54 100644
--- a/src/Witness_complex/test/test_simple_witness_complex.cpp
+++ b/src/Witness_complex/test/test_simple_witness_complex.cpp
@@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) {
Witness_complex witness_complex(nlt);
BOOST_CHECK(witness_complex.create_complex(stree, 4.1));
- std::cout << "Number of simplices: " << stree.num_simplices() << std::endl;
+ std::clog << "Number of simplices: " << stree.num_simplices() << std::endl;
BOOST_CHECK(stree.num_simplices() == 31);
// Check when complex not empty
@@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) {
BOOST_CHECK(!witness_complex.create_complex(stree2, -0.02));
witness_complex.create_complex(stree2, 4.1, 2);
- std::cout << "Number of simplices: " << stree2.num_simplices() << std::endl;
+ std::clog << "Number of simplices: " << stree2.num_simplices() << std::endl;
BOOST_CHECK(stree2.num_simplices() == 25);
}
diff --git a/src/Witness_complex/utilities/strong_witness_persistence.cpp b/src/Witness_complex/utilities/strong_witness_persistence.cpp
index 75ba1f4b..1f61c77c 100644
--- a/src/Witness_complex/utilities/strong_witness_persistence.cpp
+++ b/src/Witness_complex/utilities/strong_witness_persistence.cpp
@@ -56,8 +56,8 @@ int main(int argc, char* argv[]) {
exit(-1); // ----- >>
}
witnesses = Point_vector(off_reader.get_point_cloud());
- std::cout << "Successfully read " << witnesses.size() << " points.\n";
- std::cout << "Ambient dimension is " << witnesses[0].dimension() << ".\n";
+ std::clog << "Successfully read " << witnesses.size() << " points.\n";
+ std::clog << "Ambient dimension is " << witnesses[0].dimension() << ".\n";
// Choose landmarks (decomment one of the following two lines)
// Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks));
@@ -69,8 +69,8 @@ int main(int argc, char* argv[]) {
strong_witness_complex.create_complex(simplex_tree, max_squared_alpha, lim_d);
- 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();
@@ -107,7 +107,7 @@ void program_options(int argc, char* argv[], int& nbL, std::string& file_name, s
visible.add_options()("help,h", "produce help message")("landmarks,l", po::value<int>(&nbL),
"Number of landmarks to choose from the point cloud.")(
"output-file,o", po::value<std::string>(&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-sq-alpha,a", po::value<Filtration_value>(&max_squared_alpha)->default_value(default_alpha),
"Maximal squared relaxation parameter.")(
"field-charac,p", po::value<int>(&p)->default_value(11),
@@ -128,17 +128,17 @@ void program_options(int argc, char* argv[], int& nbL, std::string& file_name, s
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 Strong witness 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 Strong witness 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/Witness_complex/utilities/weak_witness_persistence.cpp b/src/Witness_complex/utilities/weak_witness_persistence.cpp
index 0e5b9cc1..93050af5 100644
--- a/src/Witness_complex/utilities/weak_witness_persistence.cpp
+++ b/src/Witness_complex/utilities/weak_witness_persistence.cpp
@@ -56,8 +56,8 @@ int main(int argc, char* argv[]) {
exit(-1); // ----- >>
}
witnesses = Point_vector(off_reader.get_point_cloud());
- std::cout << "Successfully read " << witnesses.size() << " points.\n";
- std::cout << "Ambient dimension is " << witnesses[0].dimension() << ".\n";
+ std::clog << "Successfully read " << witnesses.size() << " points.\n";
+ std::clog << "Ambient dimension is " << witnesses[0].dimension() << ".\n";
// Choose landmarks (decomment one of the following two lines)
// Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks));
@@ -69,8 +69,8 @@ int main(int argc, char* argv[]) {
witness_complex.create_complex(simplex_tree, max_squared_alpha, lim_d);
- 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();
@@ -107,7 +107,7 @@ void program_options(int argc, char* argv[], int& nbL, std::string& file_name, s
visible.add_options()("help,h", "produce help message")("landmarks,l", po::value<int>(&nbL),
"Number of landmarks to choose from the point cloud.")(
"output-file,o", po::value<std::string>(&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-sq-alpha,a", po::value<Filtration_value>(&max_squared_alpha)->default_value(default_alpha),
"Maximal squared relaxation parameter.")(
"field-charac,p", po::value<int>(&p)->default_value(11),
@@ -128,17 +128,17 @@ void program_options(int argc, char* argv[], int& nbL, std::string& file_name, s
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 Weak witness 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 Weak witness 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/Witness_complex/utilities/witnesscomplex.md b/src/Witness_complex/utilities/witnesscomplex.md
index 7ea397b9..3a3a7d83 100644
--- a/src/Witness_complex/utilities/witnesscomplex.md
+++ b/src/Witness_complex/utilities/witnesscomplex.md
@@ -29,7 +29,7 @@ and `p` is the characteristic of the field *Z/pZ* used for homology coefficients
* `-h [ --help ]` Produce help message
* `-l [ --landmarks ]` Number of landmarks to choose from the point cloud.
-* `-o [ --output-file ]` Name of file in which the persistence diagram is written. By default, print in std::cout.
+* `-o [ --output-file ]` Name of file in which the persistence diagram is written. By default, print in std::clog.
* `-a [ --max-sq-alpha ]` (default = inf) Maximal squared relaxation parameter.
* `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology.
* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals.
@@ -60,7 +60,7 @@ and `p` is the characteristic of the field *Z/pZ* used for homology coefficients
* `-h [ --help ]` Produce help message
* `-l [ --landmarks ]` Number of landmarks to choose from the point cloud.
-* `-o [ --output-file ]` Name of file in which the persistence diagram is written. By default, print in std::cout.
+* `-o [ --output-file ]` Name of file in which the persistence diagram is written. By default, print in std::clog.
* `-a [ --max-sq-alpha ]` (default = inf) Maximal squared relaxation parameter.
* `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology.
* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals.