summaryrefslogtreecommitdiff
path: root/src/Persistent_cohomology/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/Persistent_cohomology/example')
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt8
-rw-r--r--src/Persistent_cohomology/example/custom_persistence_sort.cpp29
-rw-r--r--src/Persistent_cohomology/example/persistence_from_file.cpp43
-rw-r--r--src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp46
-rw-r--r--src/Persistent_cohomology/example/plain_homology.cpp11
-rw-r--r--src/Persistent_cohomology/example/rips_multifield_persistence.cpp37
-rw-r--r--src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp31
-rw-r--r--src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp41
8 files changed, 109 insertions, 137 deletions
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index 94ec13c5..4c08cd68 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -5,13 +5,13 @@ add_executable(plain_homology plain_homology.cpp)
add_executable(persistence_from_simple_simplex_tree persistence_from_simple_simplex_tree.cpp)
add_executable(rips_persistence_step_by_step rips_persistence_step_by_step.cpp)
-target_link_libraries(rips_persistence_step_by_step ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(rips_persistence_step_by_step Boost::program_options)
add_executable(rips_persistence_via_boundary_matrix rips_persistence_via_boundary_matrix.cpp)
-target_link_libraries(rips_persistence_via_boundary_matrix ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(rips_persistence_via_boundary_matrix Boost::program_options)
add_executable(persistence_from_file persistence_from_file.cpp)
-target_link_libraries(persistence_from_file ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(persistence_from_file Boost::program_options)
if (TBB_FOUND)
target_link_libraries(plain_homology ${TBB_LIBRARIES})
@@ -43,7 +43,7 @@ if(GMP_FOUND)
if(GMPXX_FOUND)
add_executable(rips_multifield_persistence rips_multifield_persistence.cpp )
target_link_libraries(rips_multifield_persistence
- ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
+ Boost::program_options ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
if (TBB_FOUND)
target_link_libraries(rips_multifield_persistence ${TBB_LIBRARIES})
endif(TBB_FOUND)
diff --git a/src/Persistent_cohomology/example/custom_persistence_sort.cpp b/src/Persistent_cohomology/example/custom_persistence_sort.cpp
index be74cf50..410cd987 100644
--- a/src/Persistent_cohomology/example/custom_persistence_sort.cpp
+++ b/src/Persistent_cohomology/example/custom_persistence_sort.cpp
@@ -70,26 +70,23 @@ struct cmp_intervals_by_dim_then_length {
int main(int argc, char **argv) {
std::vector<Point> points = random_points();
- std::cout << "Points size=" << points.size() << std::endl;
+ std::clog << "Points size=" << points.size() << std::endl;
// Alpha complex persistence computation from generated points
Alpha_complex alpha_complex_from_points(points);
- std::cout << "alpha_complex_from_points" << std::endl;
+ std::clog << "alpha_complex_from_points" << std::endl;
Simplex_tree simplex;
- std::cout << "simplex" << std::endl;
+ std::clog << "simplex" << std::endl;
if (alpha_complex_from_points.create_complex(simplex, 0.6)) {
- std::cout << "simplex" << std::endl;
+ std::clog << "simplex" << std::endl;
// ----------------------------------------------------------------------------
// Display information about the alpha complex
// ----------------------------------------------------------------------------
- std::cout << "Simplicial complex is of dimension " << simplex.dimension() <<
+ std::clog << "Simplicial complex is of dimension " << simplex.dimension() <<
" - " << simplex.num_simplices() << " simplices - " <<
simplex.num_vertices() << " vertices." << std::endl;
- // Sort the simplices in the order of the filtration
- simplex.initialize_filtration();
-
- std::cout << "Simplex_tree dim: " << simplex.dimension() << std::endl;
+ std::clog << "Simplex_tree dim: " << simplex.dimension() << std::endl;
Persistent_cohomology pcoh(simplex);
@@ -102,23 +99,23 @@ int main(int argc, char **argv) {
auto persistent_pairs = pcoh.get_persistent_pairs();
std::sort(std::begin(persistent_pairs), std::end(persistent_pairs), cmp);
for (auto pair : persistent_pairs) {
- std::cout << simplex.dimension(get<0>(pair)) << " "
+ std::clog << simplex.dimension(get<0>(pair)) << " "
<< simplex.filtration(get<0>(pair)) << " "
<< simplex.filtration(get<1>(pair)) << std::endl;
}
// Persistent Betti numbers
- std::cout << "The persistent Betti numbers in interval [0.40, 0.41] are : ";
+ std::clog << "The persistent Betti numbers in interval [0.40, 0.41] are : ";
for (int dim = 0; dim < simplex.dimension(); dim++)
- std::cout << "b" << dim << " = " << pcoh.persistent_betti_number(dim, 0.40, 0.41) << " ; ";
- std::cout << std::endl;
+ std::clog << "b" << dim << " = " << pcoh.persistent_betti_number(dim, 0.40, 0.41) << " ; ";
+ std::clog << std::endl;
// Betti numbers
std::vector<int> betti_numbers = pcoh.betti_numbers();
- std::cout << "The Betti numbers are : ";
+ std::clog << "The Betti numbers are : ";
for (std::size_t i = 0; i < betti_numbers.size(); i++)
- std::cout << "b" << i << " = " << betti_numbers[i] << " ; ";
- std::cout << std::endl;
+ std::clog << "b" << i << " = " << betti_numbers[i] << " ; ";
+ std::clog << std::endl;
}
return 0;
}
diff --git a/src/Persistent_cohomology/example/persistence_from_file.cpp b/src/Persistent_cohomology/example/persistence_from_file.cpp
index d169cc63..38c44514 100644
--- a/src/Persistent_cohomology/example/persistence_from_file.cpp
+++ b/src/Persistent_cohomology/example/persistence_from_file.cpp
@@ -37,9 +37,9 @@ int main(int argc, char * argv[]) {
program_options(argc, argv, simplex_tree_file, output_file, p, min_persistence);
- std::cout << "Simplex_tree from file=" << simplex_tree_file.c_str() << " - output_file=" << output_file.c_str()
+ std::clog << "Simplex_tree from file=" << simplex_tree_file.c_str() << " - output_file=" << output_file.c_str()
<< std::endl;
- std::cout << " - p=" << p << " - min_persistence=" << min_persistence << std::endl;
+ std::clog << " - p=" << p << " - min_persistence=" << min_persistence << std::endl;
// Read the list of simplices from a file.
Simplex_tree<> simplex_tree;
@@ -47,21 +47,18 @@ int main(int argc, char * argv[]) {
std::ifstream simplex_tree_stream(simplex_tree_file);
simplex_tree_stream >> simplex_tree;
- std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices" << std::endl;
- std::cout << " - dimension " << simplex_tree.dimension() << std::endl;
+ std::clog << "The complex contains " << simplex_tree.num_simplices() << " simplices" << std::endl;
+ std::clog << " - dimension " << simplex_tree.dimension() << std::endl;
/*
- std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
+ std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
for( auto f_simplex : simplex_tree.filtration_simplex_range() )
- { std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] ";
+ { std::clog << " " << "[" << simplex_tree.filtration(f_simplex) << "] ";
for( auto vertex : simplex_tree.simplex_vertex_range(f_simplex) )
- { std::cout << vertex << " "; }
- std::cout << std::endl;
+ { std::clog << vertex << " "; }
+ std::clog << std::endl;
}*/
- // Sort the simplices in the order of the filtration
- simplex_tree.initialize_filtration();
-
// Compute the persistence diagram of the complex
Persistent_cohomology< Simplex_tree<>, Field_Zp > pcoh(simplex_tree);
// initializes the coefficient field for homology
@@ -96,7 +93,7 @@ void program_options(int argc, char * argv[]
visible.add_options()
("help,h", "produce help message")
("output-file,o", po::value<std::string>(&output_file)->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")
("field-charac,p", po::value<int>(&p)->default_value(11),
"Characteristic p of the coefficient field Z/pZ for computing homology.")
("min-persistence,m", po::value<Filtration_value>(&min_persistence),
@@ -114,17 +111,17 @@ void program_options(int argc, char * argv[]
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/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp b/src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp
index 3c91662f..bffaabdd 100644
--- a/src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp
+++ b/src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp
@@ -51,62 +51,62 @@ int main(int argc, char * const argv[]) {
}
// TEST OF INSERTION
- std::cout << "********************************************************************" << std::endl;
- std::cout << "TEST OF INSERTION" << std::endl;
+ std::clog << "********************************************************************" << std::endl;
+ std::clog << "TEST OF INSERTION" << std::endl;
Simplex_tree st;
// ++ FIRST
- std::cout << " - INSERT (0,1,2)" << std::endl;
+ std::clog << " - INSERT (0,1,2)" << std::endl;
typeVectorVertex SimplexVector = {0, 1, 2};
st.insert_simplex_and_subfaces(SimplexVector, 0.3);
// ++ SECOND
- std::cout << " - INSERT 3" << std::endl;
+ std::clog << " - INSERT 3" << std::endl;
SimplexVector = {3};
st.insert_simplex_and_subfaces(SimplexVector, 0.1);
// ++ THIRD
- std::cout << " - INSERT (0,3)" << std::endl;
+ std::clog << " - INSERT (0,3)" << std::endl;
SimplexVector = {0, 3};
st.insert_simplex_and_subfaces(SimplexVector, 0.2);
// ++ FOURTH
- std::cout << " - INSERT (0,1) (already inserted)" << std::endl;
+ std::clog << " - INSERT (0,1) (already inserted)" << std::endl;
SimplexVector = {0, 1};
st.insert_simplex_and_subfaces(SimplexVector, 0.2);
// ++ FIFTH
- std::cout << " - INSERT (3,4,5)" << std::endl;
+ std::clog << " - INSERT (3,4,5)" << std::endl;
SimplexVector = {3, 4, 5};
st.insert_simplex_and_subfaces(SimplexVector, 0.3);
// ++ SIXTH
- std::cout << " - INSERT (0,1,6,7)" << std::endl;
+ std::clog << " - INSERT (0,1,6,7)" << std::endl;
SimplexVector = {0, 1, 6, 7};
st.insert_simplex_and_subfaces(SimplexVector, 0.4);
// ++ SEVENTH
- std::cout << " - INSERT (4,5,8,9)" << std::endl;
+ std::clog << " - INSERT (4,5,8,9)" << std::endl;
SimplexVector = {4, 5, 8, 9};
st.insert_simplex_and_subfaces(SimplexVector, 0.4);
// ++ EIGHTH
- std::cout << " - INSERT (9,10,11)" << std::endl;
+ std::clog << " - INSERT (9,10,11)" << std::endl;
SimplexVector = {9, 10, 11};
st.insert_simplex_and_subfaces(SimplexVector, 0.3);
// ++ NINETH
- std::cout << " - INSERT (2,10,12)" << std::endl;
+ std::clog << " - INSERT (2,10,12)" << std::endl;
SimplexVector = {2, 10, 12};
st.insert_simplex_and_subfaces(SimplexVector, 0.3);
// ++ TENTH
- std::cout << " - INSERT (11,6)" << std::endl;
+ std::clog << " - INSERT (11,6)" << std::endl;
SimplexVector = {6, 11};
st.insert_simplex_and_subfaces(SimplexVector, 0.2);
// ++ ELEVENTH
- std::cout << " - INSERT (13,14,15)" << std::endl;
+ std::clog << " - INSERT (13,14,15)" << std::endl;
SimplexVector = {13, 14, 15};
st.insert_simplex_and_subfaces(SimplexVector, 0.25);
@@ -131,24 +131,24 @@ int main(int argc, char * const argv[]) {
/* An edge [10,12,2] */
- std::cout << "The complex contains " << st.num_simplices() << " simplices - " << st.num_vertices() << " vertices "
+ std::clog << "The complex contains " << st.num_simplices() << " simplices - " << st.num_vertices() << " vertices "
<< std::endl;
- std::cout << " - dimension " << st.dimension() << std::endl;
- std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:"
+ std::clog << " - dimension " << st.dimension() << std::endl;
+ std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:"
<< std::endl;
- std::cout << "**************************************************************" << std::endl;
- std::cout << "strict graph G { " << std::endl;
+ std::clog << "**************************************************************" << std::endl;
+ std::clog << "strict graph G { " << std::endl;
for (auto f_simplex : st.filtration_simplex_range()) {
- std::cout << " " << "[" << st.filtration(f_simplex) << "] ";
+ std::clog << " " << "[" << st.filtration(f_simplex) << "] ";
for (auto vertex : st.simplex_vertex_range(f_simplex)) {
- std::cout << static_cast<int>(vertex) << " -- ";
+ std::clog << static_cast<int>(vertex) << " -- ";
}
- std::cout << ";" << std::endl;
+ std::clog << ";" << std::endl;
}
- std::cout << "}" << std::endl;
- std::cout << "**************************************************************" << std::endl;
+ std::clog << "}" << std::endl;
+ std::clog << "**************************************************************" << std::endl;
// Compute the persistence diagram of the complex
Persistent_cohomology pcoh(st);
diff --git a/src/Persistent_cohomology/example/plain_homology.cpp b/src/Persistent_cohomology/example/plain_homology.cpp
index 84333e46..236b67de 100644
--- a/src/Persistent_cohomology/example/plain_homology.cpp
+++ b/src/Persistent_cohomology/example/plain_homology.cpp
@@ -59,9 +59,6 @@ int main() {
st.insert_simplex_and_subfaces(edge35);
st.insert_simplex(vertex4);
- // Sort the simplices in the order of the filtration
- st.initialize_filtration();
-
// Class for homology computation
// By default, since the complex has dimension 1, only 0-dimensional homology would be computed.
// Here we also want persistent homology to be computed for the maximal dimension in the complex (persistence_dim_max = true)
@@ -83,9 +80,9 @@ int main() {
pcoh.output_diagram();
// Print the Betti numbers are b0=2 and b1=2.
- std::cout << std::endl;
- std::cout << "The Betti numbers are : ";
+ std::clog << std::endl;
+ std::clog << "The Betti numbers are : ";
for (int i = 0; i < 3; i++)
- std::cout << "b" << i << " = " << pcoh.betti_number(i) << " ; ";
- std::cout << std::endl;
+ std::clog << "b" << i << " = " << pcoh.betti_number(i) << " ; ";
+ std::clog << std::endl;
}
diff --git a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
index 9eb5ccfc..2edf5bc4 100644
--- a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
@@ -56,11 +56,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";
-
- // Sort the simplices in the order of the filtration
- simplex_tree.initialize_filtration();
+ std::clog << "The complex contains " << simplex_tree.num_simplices() << " simplices \n";
+ std::clog << " and has dimension " << simplex_tree.dimension() << " \n";
// Compute the persistence diagram of the complex
Persistent_cohomology pcoh(simplex_tree);
@@ -99,7 +96,7 @@ void program_options(int argc, char * argv[]
visible.add_options()
("help,h", "produce help message")
("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-edge-length,r", po::value<Filtration_value>(&threshold)->default_value(0),
"Maximal length of an edge for the Rips complex construction.")
("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
@@ -123,20 +120,20 @@ void program_options(int argc, char * argv[]
po::notify(vm);
if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Compute the persistent homology with various coefficient fields \n";
- std::cout << "of a Rips complex defined on a set of input points. The coefficient \n";
- std::cout << "fields are all the Z/rZ for a prime number r contained in the \n";
- std::cout << "specified range [p,q]\n \n";
- std::cout << "The output diagram contains one bar per line, written with the convention: \n";
- std::cout << " p1*...*pr 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 << "p1*...*pr is the product of prime numbers pi such that the homology \n";
- std::cout << "feature exists in homology with Z/piZ 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 various coefficient fields \n";
+ std::clog << "of a Rips complex defined on a set of input points. The coefficient \n";
+ std::clog << "fields are all the Z/rZ for a prime number r contained in the \n";
+ std::clog << "specified range [p,q]\n \n";
+ std::clog << "The output diagram contains one bar per line, written with the convention: \n";
+ std::clog << " p1*...*pr 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 << "p1*...*pr is the product of prime numbers pi such that the homology \n";
+ std::clog << "feature exists in homology with Z/piZ 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/Persistent_cohomology/example/rips_persistence_step_by_step.cpp b/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
index 02db05ec..a503d983 100644
--- a/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
@@ -73,11 +73,8 @@ int main(int argc, char * argv[]) {
// expand the graph until dimension dim_max
st.expansion(dim_max);
- std::cout << "The complex contains " << st.num_simplices() << " simplices \n";
- std::cout << " and has dimension " << st.dimension() << " \n";
-
- // Sort the simplices in the order of the filtration
- st.initialize_filtration();
+ std::clog << "The complex contains " << st.num_simplices() << " simplices \n";
+ std::clog << " and has dimension " << st.dimension() << " \n";
// Compute the persistence diagram of the complex
Persistent_cohomology pcoh(st);
@@ -115,7 +112,7 @@ void program_options(int argc, char * argv[]
visible.add_options()
("help,h", "produce help message")
("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-edge-length,r",
po::value<Filtration_value>(&threshold)->default_value(std::numeric_limits<Filtration_value>::infinity()),
"Maximal length of an edge for the Rips complex construction.")
@@ -138,17 +135,17 @@ void program_options(int argc, char * argv[]
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/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp b/src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp
index 37fa5e93..8c5742aa 100644
--- a/src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp
@@ -17,10 +17,6 @@
#include <boost/program_options.hpp>
-#ifdef GUDHI_USE_TBB
-#include <tbb/task_scheduler_init.h>
-#endif
-
#include <string>
#include <vector>
@@ -64,13 +60,8 @@ int main(int argc, char * argv[]) {
Simplex_tree& st = *new Simplex_tree;
rips_complex_from_file.create_complex(st, dim_max);
- std::cout << "The complex contains " << st.num_simplices() << " simplices \n";
- std::cout << " and has dimension " << st.dimension() << " \n";
-
-#ifdef GUDHI_USE_TBB
- // Unnecessary, but clarifies which operations are parallel.
- tbb::task_scheduler_init ts;
-#endif
+ std::clog << "The complex contains " << st.num_simplices() << " simplices \n";
+ std::clog << " and has dimension " << st.dimension() << " \n";
// Sort the simplices in the order of the filtration
st.initialize_filtration();
@@ -81,10 +72,6 @@ int main(int argc, char * argv[]) {
// Convert to a more convenient representation.
Gudhi::Hasse_complex<> hcpx(st);
-#ifdef GUDHI_USE_TBB
- ts.terminate();
-#endif
-
// Free some space.
delete &st;
@@ -122,7 +109,7 @@ void program_options(int argc, char * argv[]
visible.add_options()
("help,h", "produce help message")
("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-edge-length,r", po::value<Filtration_value>(&threshold)->default_value(0),
"Maximal length of an edge for the Rips complex construction.")
("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
@@ -144,17 +131,17 @@ void program_options(int argc, char * argv[]
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);
}
}