summaryrefslogtreecommitdiff
path: root/src/Bottleneck_distance/example
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2020-05-20 08:42:23 +0200
committerGard Spreemann <gspr@nonempty.org>2020-05-20 08:42:23 +0200
commit9b3079646ee3f6a494b83e864b3e10b8a93597d0 (patch)
tree63ecae8cf0d09b72907805e68f19765c7dd9694a /src/Bottleneck_distance/example
parent81816dae256a9f3c0653b1d21443c3c32da7a974 (diff)
parent97e889f34e929f3c2306803b6c37b57926bd1245 (diff)
Merge tag 'tags/gudhi-release-3.2.0' into dfsg/latest
Diffstat (limited to 'src/Bottleneck_distance/example')
-rw-r--r--src/Bottleneck_distance/example/CMakeLists.txt2
-rw-r--r--src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp38
-rw-r--r--src/Bottleneck_distance/example/bottleneck_basic_example.cpp4
3 files changed, 19 insertions, 25 deletions
diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt
index 3d65963a..9839c59d 100644
--- a/src/Bottleneck_distance/example/CMakeLists.txt
+++ b/src/Bottleneck_distance/example/CMakeLists.txt
@@ -13,7 +13,7 @@ endif (NOT CGAL_VERSION VERSION_LESS 4.11.0)
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp)
- target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_PROGRAM_OPTIONS_LIBRARY})
+ target_link_libraries(alpha_rips_persistence_bottleneck_distance Boost::program_options)
if (TBB_FOUND)
target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES})
diff --git a/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp b/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp
index 6c0dc9bf..ceb9e226 100644
--- a/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp
+++ b/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp
@@ -68,12 +68,9 @@ int main(int argc, char * argv[]) {
Simplex_tree rips_stree;
rips_complex.create_complex(rips_stree, dim_max);
- std::cout << "The Rips complex contains " << rips_stree.num_simplices() << " simplices and has dimension "
+ std::clog << "The Rips complex contains " << rips_stree.num_simplices() << " simplices and has dimension "
<< rips_stree.dimension() << " \n";
- // Sort the simplices in the order of the filtration
- rips_stree.initialize_filtration();
-
// Compute the persistence diagram of the complex
Persistent_cohomology rips_pcoh(rips_stree);
// initializes the coefficient field for homology
@@ -89,12 +86,9 @@ int main(int argc, char * argv[]) {
Simplex_tree alpha_stree;
alpha_complex.create_complex(alpha_stree, threshold * threshold);
- std::cout << "The Alpha complex contains " << alpha_stree.num_simplices() << " simplices and has dimension "
+ std::clog << "The Alpha complex contains " << alpha_stree.num_simplices() << " simplices and has dimension "
<< alpha_stree.dimension() << " \n";
- // Sort the simplices in the order of the filtration
- alpha_stree.initialize_filtration();
-
// Compute the persistence diagram of the complex
Persistent_cohomology alpha_pcoh(alpha_stree);
// initializes the coefficient field for homology
@@ -115,12 +109,12 @@ int main(int argc, char * argv[]) {
std::transform(alpha_intervals.begin(), alpha_intervals.end(), alpha_intervals.begin(), compute_root_square);
double bottleneck_distance = Gudhi::persistence_diagram::bottleneck_distance(rips_intervals, alpha_intervals);
- std::cout << "In dimension " << dim << ", bottleneck distance = " << bottleneck_distance << std::endl;
+ std::clog << "In dimension " << dim << ", bottleneck distance = " << bottleneck_distance << std::endl;
if (bottleneck_distance > max_b_distance)
max_b_distance = bottleneck_distance;
}
- std::cout << "================================================================================" << std::endl;
- std::cout << "Bottleneck distance is " << max_b_distance << std::endl;
+ std::clog << "================================================================================" << std::endl;
+ std::clog << "Bottleneck distance is " << max_b_distance << std::endl;
return 0;
}
@@ -162,17 +156,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/Bottleneck_distance/example/bottleneck_basic_example.cpp b/src/Bottleneck_distance/example/bottleneck_basic_example.cpp
index 61778a55..e8632a4f 100644
--- a/src/Bottleneck_distance/example/bottleneck_basic_example.cpp
+++ b/src/Bottleneck_distance/example/bottleneck_basic_example.cpp
@@ -20,9 +20,9 @@ int main() {
double b = Gudhi::persistence_diagram::bottleneck_distance(v1, v2);
- std::cout << "Bottleneck distance = " << b << std::endl;
+ std::clog << "Bottleneck distance = " << b << std::endl;
b = Gudhi::persistence_diagram::bottleneck_distance(v1, v2, 0.1);
- std::cout << "Approx bottleneck distance = " << b << std::endl;
+ std::clog << "Approx bottleneck distance = " << b << std::endl;
}