summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorGard Spreemann <gspreemann@gmail.com>2017-10-08 11:15:17 +0200
committerGard Spreemann <gspreemann@gmail.com>2017-10-08 11:15:17 +0200
commit866f6ce614e9c09c97fed12c8c0c2c9fb84fad3f (patch)
tree0c90eb9bab09ccc9785cdf2dc59f0ec861670b85 /example
parent8d7329f3e5ad843e553c3c5503cecc28ef2eead6 (diff)
GUDHI 2.0.1 as released by upstream in a tarball.upstream/2.0.1
Diffstat (limited to 'example')
-rw-r--r--example/Alpha_complex/CMakeLists.txt8
-rw-r--r--example/Bitmap_cubical_complex/Bitmap_cubical_complex.cpp24
-rw-r--r--example/Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp22
-rw-r--r--example/Bitmap_cubical_complex/CMakeLists.txt7
-rw-r--r--example/Bottleneck_distance/CMakeLists.txt28
-rw-r--r--example/Bottleneck_distance/bottleneck_read_file_example.cpp48
-rw-r--r--example/Contraction/CMakeLists.txt7
-rw-r--r--example/Contraction/Garland_heckbert.cpp6
-rw-r--r--example/Contraction/Rips_contraction.cpp7
-rw-r--r--example/Persistent_cohomology/CMakeLists.txt50
-rw-r--r--example/Persistent_cohomology/README2
-rw-r--r--example/Persistent_cohomology/alpha_complex_3d_persistence.cpp7
-rw-r--r--example/Persistent_cohomology/exact_alpha_complex_3d_persistence.cpp7
-rw-r--r--example/Persistent_cohomology/periodic_alpha_complex_3d_persistence.cpp14
-rw-r--r--example/Persistent_cohomology/persistence_from_file.cpp3
-rw-r--r--example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp3
-rw-r--r--example/Persistent_cohomology/rips_distance_matrix_persistence.cpp2
-rw-r--r--example/Persistent_cohomology/weighted_alpha_complex_3d_persistence.cpp14
-rw-r--r--example/Rips_complex/CMakeLists.txt9
-rw-r--r--example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp2
-rw-r--r--example/Simplex_tree/CMakeLists.txt8
-rw-r--r--example/Simplex_tree/simple_simplex_tree.cpp3
-rw-r--r--example/Skeleton_blocker/CMakeLists.txt6
-rw-r--r--example/Skeleton_blocker/Skeleton_blocker_iteration.cpp7
-rw-r--r--example/Spatial_searching/CMakeLists.txt1
-rw-r--r--example/Spatial_searching/example_spatial_searching.cpp24
-rw-r--r--example/Subsampling/CMakeLists.txt6
-rw-r--r--example/Tangential_complex/CMakeLists.txt7
-rw-r--r--example/Witness_complex/CMakeLists.txt17
-rw-r--r--example/common/CMakeLists.txt14
30 files changed, 218 insertions, 145 deletions
diff --git a/example/Alpha_complex/CMakeLists.txt b/example/Alpha_complex/CMakeLists.txt
index a4853d78..5bf553e9 100644
--- a/example/Alpha_complex/CMakeLists.txt
+++ b/example/Alpha_complex/CMakeLists.txt
@@ -5,9 +5,9 @@ project(Alpha_complex_examples)
# cmake -DCGAL_DIR=~/workspace/CGAL-4.7 ..
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
add_executable ( Alpha_complex_example_from_points Alpha_complex_from_points.cpp )
- target_link_libraries(Alpha_complex_example_from_points ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(Alpha_complex_example_from_points ${CGAL_LIBRARY})
add_executable ( Alpha_complex_example_from_off Alpha_complex_from_off.cpp )
- target_link_libraries(Alpha_complex_example_from_off ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(Alpha_complex_example_from_off ${CGAL_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Alpha_complex_example_from_points ${TBB_LIBRARIES})
target_link_libraries(Alpha_complex_example_from_off ${TBB_LIBRARIES})
@@ -29,4 +29,8 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
add_test(Alpha_complex_example_from_off_32_diff_files ${DIFF_PATH}
${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt)
endif()
+
+ install(TARGETS Alpha_complex_example_from_points DESTINATION bin)
+ install(TARGETS Alpha_complex_example_from_off DESTINATION bin)
+
endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
diff --git a/example/Bitmap_cubical_complex/Bitmap_cubical_complex.cpp b/example/Bitmap_cubical_complex/Bitmap_cubical_complex.cpp
index e6bc6648..67735ba1 100644
--- a/example/Bitmap_cubical_complex/Bitmap_cubical_complex.cpp
+++ b/example/Bitmap_cubical_complex/Bitmap_cubical_complex.cpp
@@ -27,8 +27,9 @@
// standard stuff
#include <iostream>
-#include <sstream>
+#include <string>
#include <vector>
+#include <cstddef>
int main(int argc, char** argv) {
std::cout << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical " <<
@@ -38,9 +39,6 @@ int main(int argc, char** argv) {
"filtrations of top dimensional cells. We assume that the cells are in the lexicographical order. See " <<
"CubicalOneSphere.txt or CubicalTwoSphere.txt for example.\n" << std::endl;
- int p = 2;
- double min_persistence = 0;
-
if (argc != 2) {
std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at " <<
"the input. The program will now terminate.\n";
@@ -56,16 +54,26 @@ int main(int argc, char** argv) {
// Compute the persistence diagram of the complex
Persistent_cohomology pcoh(b);
+ int p = 2;
+ double min_persistence = 0;
+
pcoh.init_coefficients(p); // initializes the coefficient field for homology
pcoh.compute_persistent_cohomology(min_persistence);
- std::stringstream ss;
- ss << argv[1] << "_persistence";
- std::ofstream out(ss.str().c_str());
+ std::string output_file_name(argv[1]);
+ output_file_name += "_persistence";
+
+ std::size_t last_in_path = output_file_name.find_last_of("/\\");
+
+ if (last_in_path != std::string::npos) {
+ output_file_name = output_file_name.substr(last_in_path+1);
+ }
+
+ std::ofstream out(output_file_name.c_str());
pcoh.output_diagram(out);
out.close();
- std::cout << "Result in file: " << ss.str().c_str() << "\n";
+ std::cout << "Result in file: " << output_file_name << "\n";
return 0;
}
diff --git a/example/Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp b/example/Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
index 839a4c89..122160a2 100644
--- a/example/Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
+++ b/example/Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
@@ -30,6 +30,7 @@
#include <iostream>
#include <sstream>
#include <vector>
+#include <string>
int main(int argc, char** argv) {
std::cout << "This program computes persistent homology, by using " <<
@@ -40,9 +41,6 @@ int main(int argc, char** argv) {
"assume that the cells are in the lexicographical order. See CubicalOneSphere.txt or CubicalTwoSphere.txt for" <<
" example.\n" << std::endl;
- int p = 2;
- double min_persistence = 0;
-
if (argc != 2) {
std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at " <<
"the input. The program will now terminate.\n";
@@ -58,16 +56,26 @@ int main(int argc, char** argv) {
typedef Gudhi::persistent_cohomology::Persistent_cohomology<Bitmap_cubical_complex, Field_Zp> Persistent_cohomology;
// Compute the persistence diagram of the complex
Persistent_cohomology pcoh(b, true);
+
+ int p = 2;
+ double min_persistence = 0;
pcoh.init_coefficients(p); // initializes the coefficient field for homology
pcoh.compute_persistent_cohomology(min_persistence);
- std::stringstream ss;
- ss << argv[1] << "_persistence";
- std::ofstream out(ss.str().c_str());
+ std::string output_file_name(argv[1]);
+ output_file_name += "_persistence";
+
+ std::size_t last_in_path = output_file_name.find_last_of("/\\");
+
+ if (last_in_path != std::string::npos) {
+ output_file_name = output_file_name.substr(last_in_path+1);
+ }
+
+ std::ofstream out(output_file_name.c_str());
pcoh.output_diagram(out);
out.close();
- std::cout << "Result in file: " << ss.str().c_str() << "\n";
+ std::cout << "Result in file: " << output_file_name << "\n";
return 0;
}
diff --git a/example/Bitmap_cubical_complex/CMakeLists.txt b/example/Bitmap_cubical_complex/CMakeLists.txt
index 241a11e5..a0401619 100644
--- a/example/Bitmap_cubical_complex/CMakeLists.txt
+++ b/example/Bitmap_cubical_complex/CMakeLists.txt
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.6)
project(Bitmap_cubical_complex_examples)
add_executable ( Bitmap_cubical_complex Bitmap_cubical_complex.cpp )
-target_link_libraries(Bitmap_cubical_complex ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Bitmap_cubical_complex ${TBB_LIBRARIES})
endif()
@@ -14,7 +13,6 @@ add_test(NAME Bitmap_cubical_complex_example_persistence_two_sphere COMMAND $<TA
"${CMAKE_SOURCE_DIR}/data/bitmap/CubicalTwoSphere.txt")
add_executable ( Random_bitmap_cubical_complex Random_bitmap_cubical_complex.cpp )
-target_link_libraries(Random_bitmap_cubical_complex ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Random_bitmap_cubical_complex ${TBB_LIBRARIES})
endif()
@@ -22,7 +20,6 @@ add_test(NAME Bitmap_cubical_complex_example_random COMMAND $<TARGET_FILE:Random
"2" "100" "100")
add_executable ( Bitmap_cubical_complex_periodic_boundary_conditions Bitmap_cubical_complex_periodic_boundary_conditions.cpp )
-target_link_libraries(Bitmap_cubical_complex_periodic_boundary_conditions ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Bitmap_cubical_complex_periodic_boundary_conditions ${TBB_LIBRARIES})
endif()
@@ -34,3 +31,7 @@ add_test(NAME Bitmap_cubical_complex_example_periodic_boundary_conditions_2d_tor
add_test(NAME Bitmap_cubical_complex_example_periodic_boundary_conditions_3d_torus
COMMAND $<TARGET_FILE:Bitmap_cubical_complex_periodic_boundary_conditions>
"${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt")
+
+install(TARGETS Bitmap_cubical_complex DESTINATION bin)
+install(TARGETS Random_bitmap_cubical_complex DESTINATION bin)
+install(TARGETS Bitmap_cubical_complex_periodic_boundary_conditions DESTINATION bin)
diff --git a/example/Bottleneck_distance/CMakeLists.txt b/example/Bottleneck_distance/CMakeLists.txt
index 0d0bff45..eac617db 100644
--- a/example/Bottleneck_distance/CMakeLists.txt
+++ b/example/Bottleneck_distance/CMakeLists.txt
@@ -1,22 +1,38 @@
cmake_minimum_required(VERSION 2.6)
project(Bottleneck_distance_examples)
-if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+if (NOT CGAL_VERSION VERSION_LESS 4.8.1)
add_executable (bottleneck_read_file_example bottleneck_read_file_example.cpp)
add_executable (bottleneck_basic_example bottleneck_basic_example.cpp)
- add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp)
- target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (TBB_FOUND)
target_link_libraries(bottleneck_read_file_example ${TBB_LIBRARIES})
target_link_libraries(bottleneck_basic_example ${TBB_LIBRARIES})
- target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES})
endif(TBB_FOUND)
add_test(NAME Bottleneck_distance_example_basic COMMAND $<TARGET_FILE:bottleneck_basic_example>)
+ add_test(NAME Bottleneck_read_file_example
+ COMMAND $<TARGET_FILE:bottleneck_read_file_example>
+ "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/second.pers")
+
+ install(TARGETS bottleneck_read_file_example DESTINATION bin)
+ install(TARGETS bottleneck_basic_example DESTINATION bin)
+
+endif (NOT CGAL_VERSION VERSION_LESS 4.8.1)
+
+# Eigen3 and CGAL > 4.7.0 is required for alpha complex
+# CGAL > 4.8.1 is required for bottleneck distance =>
+if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+ 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})
+
add_test(NAME Bottleneck_distance_example_alpha_rips_persistence_bottleneck
- COMMAND $<TARGET_FILE:alpha_rips_persistence_bottleneck_distance>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.15" "-m" "0.12" "-d" "3" "-p" "3")
+ COMMAND $<TARGET_FILE:alpha_rips_persistence_bottleneck_distance>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.15" "-m" "0.12" "-d" "3" "-p" "3")
+ install(TARGETS alpha_rips_persistence_bottleneck_distance DESTINATION bin)
+ if (TBB_FOUND)
+ target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES})
+ endif(TBB_FOUND)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Bottleneck_distance/bottleneck_read_file_example.cpp b/example/Bottleneck_distance/bottleneck_read_file_example.cpp
index bde05825..24d73c57 100644
--- a/example/Bottleneck_distance/bottleneck_read_file_example.cpp
+++ b/example/Bottleneck_distance/bottleneck_read_file_example.cpp
@@ -20,53 +20,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define CGAL_HAS_THREADS
-
#include <gudhi/Bottleneck.h>
+#include <gudhi/reader_utils.h>
#include <iostream>
#include <vector>
#include <utility> // for pair
-#include <fstream>
-#include <sstream>
#include <string>
-
-std::vector< std::pair<double, double> > read_diagram_from_file(const char* filename) {
- std::ifstream in;
- in.open(filename);
- std::vector< std::pair<double, double> > result;
- if (!in.is_open()) {
- std::cerr << "File : " << filename << " do not exist. The program will now terminate \n";
- throw "File do not exist \n";
- }
-
- std::string line;
- while (!in.eof()) {
- getline(in, line);
- if (line.length() != 0) {
- std::stringstream lineSS;
- lineSS << line;
- double beginn, endd;
- lineSS >> beginn;
- lineSS >> endd;
- result.push_back(std::make_pair(beginn, endd));
- }
- }
- in.close();
- return result;
-} // read_diagram_from_file
+#include <limits> // for numeric_limits
int main(int argc, char** argv) {
if (argc < 3) {
- std::cout << "To run this program please provide as an input two files with persistence diagrams. Each file " <<
- "should contain a birth-death pair per line. Third, optional parameter is an error bound on a bottleneck" <<
- " distance (set by default to zero). The program will now terminate \n";
+ std::cout << "To run this program please provide as an input two files with persistence diagrams. Each file" <<
+ " should contain a birth-death pair per line. Third, optional parameter is an error bound on a bottleneck" <<
+ " distance (set by default to the smallest positive double value). If you set the error bound to 0, be" <<
+ " aware this version is exact but expensive. The program will now terminate \n";
+ return -1;
}
- std::vector< std::pair< double, double > > diag1 = read_diagram_from_file(argv[1]);
- std::vector< std::pair< double, double > > diag2 = read_diagram_from_file(argv[2]);
- double tolerance = 0.;
+ std::vector<std::pair<double, double>> diag1 = Gudhi::read_persistence_intervals_in_dimension(argv[1]);
+ std::vector<std::pair<double, double>> diag2 = Gudhi::read_persistence_intervals_in_dimension(argv[2]);
+
+ double tolerance = std::numeric_limits<double>::min();
if (argc == 4) {
tolerance = atof(argv[3]);
}
double b = Gudhi::persistence_diagram::bottleneck_distance(diag1, diag2, tolerance);
std::cout << "The distance between the diagrams is : " << b << ". The tolerance is : " << tolerance << std::endl;
+
+ return 0;
}
diff --git a/example/Contraction/CMakeLists.txt b/example/Contraction/CMakeLists.txt
index 51a6832d..83594c0e 100644
--- a/example/Contraction/CMakeLists.txt
+++ b/example/Contraction/CMakeLists.txt
@@ -5,10 +5,6 @@ project(Contraction_examples)
add_executable(RipsContraction Rips_contraction.cpp)
add_executable(GarlandHeckbert Garland_heckbert.cpp)
-target_link_libraries(RipsContraction ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBRARY})
-target_link_libraries(GarlandHeckbert ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBRARY})
-
-
add_test(NAME Contraction_example_tore3D_0.2 COMMAND $<TARGET_FILE:RipsContraction>
"${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0.2")
# TODO(DS) : These tests are too long under Windows
@@ -16,3 +12,6 @@ add_test(NAME Contraction_example_tore3D_0.2 COMMAND $<TARGET_FILE:RipsContracti
# "${CMAKE_SOURCE_DIR}/data/points/sphere3D_2646.off" "0.2")
#add_test(NAME Contraction_example_SO3_0.3 COMMAND $<TARGET_FILE:RipsContraction>
# "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off" "0.3")
+
+install(TARGETS RipsContraction DESTINATION bin)
+install(TARGETS GarlandHeckbert DESTINATION bin)
diff --git a/example/Contraction/Garland_heckbert.cpp b/example/Contraction/Garland_heckbert.cpp
index 8b5a6a6c..f0cde95e 100644
--- a/example/Contraction/Garland_heckbert.cpp
+++ b/example/Contraction/Garland_heckbert.cpp
@@ -29,8 +29,8 @@
#include <gudhi/Edge_contraction.h>
#include <gudhi/Skeleton_blocker.h>
#include <gudhi/Off_reader.h>
+#include <gudhi/Clock.h>
-#include <boost/timer/timer.hpp>
#include <iostream>
#include "Garland_heckbert/Error_quadric.h"
@@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
int num_contractions = atoi(argv[3]);
- boost::timer::auto_cpu_timer t;
+ Gudhi::Clock contraction_chrono("Time to simplify and enumerate simplices");
// constructs the contractor object with Garland Heckbert policies.
Complex_contractor contractor(complex,
@@ -182,6 +182,8 @@ int main(int argc, char *argv[]) {
complex.num_edges() << " edges and " <<
complex.num_triangles() << " triangles." << std::endl;
+ std::cout << contraction_chrono;
+
// write simplified complex
Gudhi::skeleton_blocker::Skeleton_blocker_off_writer<Complex> off_writer(argv[2], complex);
diff --git a/example/Contraction/Rips_contraction.cpp b/example/Contraction/Rips_contraction.cpp
index 8289b1d3..501b0e87 100644
--- a/example/Contraction/Rips_contraction.cpp
+++ b/example/Contraction/Rips_contraction.cpp
@@ -23,8 +23,8 @@
#include <gudhi/Skeleton_blocker.h>
#include <gudhi/Off_reader.h>
#include <gudhi/Point.h>
+#include <gudhi/Clock.h>
-#include <boost/timer/timer.hpp>
#include <iostream>
struct Geometry_trait {
@@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
build_rips(complex, atof(argv[2]));
- boost::timer::auto_cpu_timer t;
+ Gudhi::Clock contraction_chrono("Time to simplify and enumerate simplices");
std::cout << "Initial complex has " <<
complex.num_vertices() << " vertices and " <<
@@ -90,8 +90,7 @@ int main(int argc, char *argv[]) {
complex.num_blockers() << " blockers and " <<
num_simplices << " simplices" << std::endl;
-
- std::cout << "Time to simplify and enumerate simplices:\n";
+ std::cout << contraction_chrono;
return EXIT_SUCCESS;
}
diff --git a/example/Persistent_cohomology/CMakeLists.txt b/example/Persistent_cohomology/CMakeLists.txt
index 3c45e79b..f47de4c3 100644
--- a/example/Persistent_cohomology/CMakeLists.txt
+++ b/example/Persistent_cohomology/CMakeLists.txt
@@ -2,25 +2,23 @@ cmake_minimum_required(VERSION 2.6)
project(Persistent_cohomology_examples)
add_executable(plain_homology plain_homology.cpp)
-target_link_libraries(plain_homology ${Boost_SYSTEM_LIBRARY})
add_executable(persistence_from_simple_simplex_tree persistence_from_simple_simplex_tree.cpp)
-target_link_libraries(persistence_from_simple_simplex_tree ${Boost_SYSTEM_LIBRARY})
add_executable(rips_distance_matrix_persistence rips_distance_matrix_persistence.cpp)
-target_link_libraries(rips_distance_matrix_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(rips_distance_matrix_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable(rips_persistence rips_persistence.cpp)
-target_link_libraries(rips_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(rips_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable(rips_persistence_step_by_step rips_persistence_step_by_step.cpp)
-target_link_libraries(rips_persistence_step_by_step ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(rips_persistence_step_by_step ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable(rips_persistence_via_boundary_matrix rips_persistence_via_boundary_matrix.cpp)
-target_link_libraries(rips_persistence_via_boundary_matrix ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(rips_persistence_via_boundary_matrix ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable(persistence_from_file persistence_from_file.cpp)
-target_link_libraries(persistence_from_file ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_link_libraries(persistence_from_file ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (TBB_FOUND)
target_link_libraries(plain_homology ${TBB_LIBRARIES})
@@ -47,27 +45,36 @@ add_test(NAME Persistent_cohomology_example_from_file_3_2_0 COMMAND $<TARGET_FIL
"${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/bunny_5000_complex.fsc" "-p" "2" "-m" "0")
add_test(NAME Persistent_cohomology_example_from_file_3_3_100 COMMAND $<TARGET_FILE:persistence_from_file>
"${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/bunny_5000_complex.fsc" "-p" "3" "-m" "100")
-
+
+install(TARGETS plain_homology DESTINATION bin)
+install(TARGETS persistence_from_simple_simplex_tree DESTINATION bin)
+install(TARGETS rips_distance_matrix_persistence DESTINATION bin)
+install(TARGETS rips_persistence DESTINATION bin)
+install(TARGETS rips_persistence_step_by_step DESTINATION bin)
+install(TARGETS rips_persistence_via_boundary_matrix DESTINATION bin)
+install(TARGETS persistence_from_file DESTINATION bin)
+
if(GMP_FOUND)
if(GMPXX_FOUND)
add_executable(rips_multifield_persistence rips_multifield_persistence.cpp )
target_link_libraries(rips_multifield_persistence
- ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
+ ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
if (TBB_FOUND)
target_link_libraries(rips_multifield_persistence ${TBB_LIBRARIES})
endif(TBB_FOUND)
- add_test(NAME Persistent_cohomology_example_multifield_2_71 COMMAND $<TARGET_FILE:rips_multifield_persistence>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "2" "-q" "71")
+ add_test(NAME Persistent_cohomology_example_multifield_2_71 COMMAND $<TARGET_FILE:rips_multifield_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "2" "-q" "71")
+ install(TARGETS rips_multifield_persistence DESTINATION bin)
endif(GMPXX_FOUND)
endif(GMP_FOUND)
if(CGAL_FOUND)
add_executable(alpha_complex_3d_persistence alpha_complex_3d_persistence.cpp)
- target_link_libraries(alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(alpha_complex_3d_persistence ${CGAL_LIBRARY})
add_executable(exact_alpha_complex_3d_persistence exact_alpha_complex_3d_persistence.cpp)
- target_link_libraries(exact_alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(exact_alpha_complex_3d_persistence ${CGAL_LIBRARY})
add_executable(weighted_alpha_complex_3d_persistence weighted_alpha_complex_3d_persistence.cpp)
- target_link_libraries(weighted_alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(weighted_alpha_complex_3d_persistence ${CGAL_LIBRARY})
if (TBB_FOUND)
target_link_libraries(alpha_complex_3d_persistence ${TBB_LIBRARIES})
@@ -81,16 +88,20 @@ if(CGAL_FOUND)
add_test(NAME Persistent_cohomology_example_weighted_alpha_complex_3d COMMAND $<TARGET_FILE:weighted_alpha_complex_3d_persistence>
"${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.weights" "2" "0.45")
+ install(TARGETS alpha_complex_3d_persistence DESTINATION bin)
+ install(TARGETS exact_alpha_complex_3d_persistence DESTINATION bin)
+ install(TARGETS weighted_alpha_complex_3d_persistence DESTINATION bin)
+
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
add_executable (alpha_complex_persistence alpha_complex_persistence.cpp)
target_link_libraries(alpha_complex_persistence
- ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+ ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable(periodic_alpha_complex_3d_persistence periodic_alpha_complex_3d_persistence.cpp)
- target_link_libraries(periodic_alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(periodic_alpha_complex_3d_persistence ${CGAL_LIBRARY})
add_executable(custom_persistence_sort custom_persistence_sort.cpp)
- target_link_libraries(custom_persistence_sort ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(custom_persistence_sort ${CGAL_LIBRARY})
if (TBB_FOUND)
target_link_libraries(alpha_complex_persistence ${TBB_LIBRARIES})
@@ -102,5 +113,10 @@ if(CGAL_FOUND)
add_test(NAME Persistent_cohomology_example_periodic_alpha_complex_3d COMMAND $<TARGET_FILE:periodic_alpha_complex_3d_persistence>
"${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off" "${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt" "2" "0")
add_test(NAME Persistent_cohomology_example_custom_persistence_sort COMMAND $<TARGET_FILE:custom_persistence_sort>)
+
+ install(TARGETS alpha_complex_persistence DESTINATION bin)
+ install(TARGETS periodic_alpha_complex_3d_persistence DESTINATION bin)
+ install(TARGETS custom_persistence_sort DESTINATION bin)
+
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
endif(CGAL_FOUND)
diff --git a/example/Persistent_cohomology/README b/example/Persistent_cohomology/README
index 2ac79398..794b94ae 100644
--- a/example/Persistent_cohomology/README
+++ b/example/Persistent_cohomology/README
@@ -121,7 +121,7 @@ N.B.: - alpha_complex_persistence accepts OFF files in d-Dimension.
3) 3D periodic special case
---------------------------
-./periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off 3 1.0
+./periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off ../../data/points/iso_cuboid_3_in_0_1.txt 3 1.0
output:
Periodic Delaunay computed.
diff --git a/example/Persistent_cohomology/alpha_complex_3d_persistence.cpp b/example/Persistent_cohomology/alpha_complex_3d_persistence.cpp
index fd227b82..f63ff0f6 100644
--- a/example/Persistent_cohomology/alpha_complex_3d_persistence.cpp
+++ b/example/Persistent_cohomology/alpha_complex_3d_persistence.cpp
@@ -76,8 +76,9 @@ using Simplex_tree_vector_vertex = std::vector< Simplex_tree_vertex >;
using PCOH = Gudhi::persistent_cohomology::Persistent_cohomology< ST, Gudhi::persistent_cohomology::Field_Zp >;
void usage(const std::string& progName) {
- std::cerr << "Usage: " << progName <<
- " path_to_file_graph coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
+ std::cerr << "Usage:\n" << progName << " path_to_OFF_file coeff_field_characteristic[integer " <<
+ "> 0] min_persistence[float >= -1.0]\n";
+ std::cerr << " path_to_OFF_file is the path to your points cloud in OFF format.\n";
exit(-1);
}
@@ -202,7 +203,6 @@ int main(int argc, char * const argv[]) {
else
std::cout << "This shall not happen" << std::endl;
}
- simplex_tree.set_filtration(filtration_max);
simplex_tree.set_dimension(dim_max);
#ifdef DEBUG_TRACES
@@ -216,7 +216,6 @@ int main(int argc, char * const argv[]) {
std::cout << " Number of vertices = " << simplex_tree.num_vertices() << " ";
std::cout << " Number of simplices = " << simplex_tree.num_simplices() << std::endl << std::endl;
std::cout << " Dimension = " << simplex_tree.dimension() << " ";
- std::cout << " filtration = " << simplex_tree.filtration() << std::endl << std::endl;
#endif // DEBUG_TRACES
#ifdef DEBUG_TRACES
diff --git a/example/Persistent_cohomology/exact_alpha_complex_3d_persistence.cpp b/example/Persistent_cohomology/exact_alpha_complex_3d_persistence.cpp
index 8a335075..09561d03 100644
--- a/example/Persistent_cohomology/exact_alpha_complex_3d_persistence.cpp
+++ b/example/Persistent_cohomology/exact_alpha_complex_3d_persistence.cpp
@@ -77,8 +77,9 @@ using Simplex_tree_vector_vertex = std::vector< Simplex_tree_vertex >;
using PCOH = Gudhi::persistent_cohomology::Persistent_cohomology< ST, Gudhi::persistent_cohomology::Field_Zp >;
void usage(char * const progName) {
- std::cerr << "Usage: " << progName <<
- " path_to_file_graph coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
+ std::cerr << "Usage:\n" << progName << " path_to_OFF_file coeff_field_characteristic[integer " <<
+ "> 0] min_persistence[float >= -1.0]\n";
+ std::cerr << " path_to_OFF_file is the path to your points cloud in OFF format.\n";
exit(-1);
}
@@ -204,7 +205,6 @@ int main(int argc, char * const argv[]) {
else
std::cout << "This shall not happen" << std::endl;
}
- simplex_tree.set_filtration(filtration_max);
simplex_tree.set_dimension(dim_max);
#ifdef DEBUG_TRACES
@@ -218,7 +218,6 @@ int main(int argc, char * const argv[]) {
std::cout << " Number of vertices = " << simplex_tree.num_vertices() << " ";
std::cout << " Number of simplices = " << simplex_tree.num_simplices() << std::endl << std::endl;
std::cout << " Dimension = " << simplex_tree.dimension() << " ";
- std::cout << " filtration = " << simplex_tree.filtration() << std::endl << std::endl;
#endif // DEBUG_TRACES
#ifdef DEBUG_TRACES
diff --git a/example/Persistent_cohomology/periodic_alpha_complex_3d_persistence.cpp b/example/Persistent_cohomology/periodic_alpha_complex_3d_persistence.cpp
index 8928cfc2..8140a3c5 100644
--- a/example/Persistent_cohomology/periodic_alpha_complex_3d_persistence.cpp
+++ b/example/Persistent_cohomology/periodic_alpha_complex_3d_persistence.cpp
@@ -84,8 +84,16 @@ using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomolog
ST, Gudhi::persistent_cohomology::Field_Zp >;
void usage(char * const progName) {
- std::cerr << "Usage: " << progName <<
- " path_to_file_graph path_to_iso_cuboid_3_file coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
+ std::cerr << "Usage:\n" << progName << " path_to_OFF_file path_to_iso_cuboid_3_file coeff_field_characteristic[" <<
+ "integer > 0] min_persistence[float >= -1.0]\n" <<
+ " path_to_OFF_file is the path to your points cloud in OFF format.\n" <<
+ " path_to_iso_cuboid_3_file is the path to the iso cuboid file with the following format :\n" <<
+ " x_min y_min z_min x_max y_max z_max\n" <<
+ " In this example, the periodic cube will be " <<
+ "{ x = [x_min,x_max]; y = [y_min,y_max]; z = [z_min,z_max] }.\n" <<
+ " For more information, please refer to\n" <<
+ " https://doc.cgal.org/latest/Kernel_23/classCGAL_1_1Iso__cuboid__3.html\n";
+
exit(-1);
}
@@ -221,7 +229,6 @@ int main(int argc, char * const argv[]) {
else
std::cout << "This shall not happen" << std::endl;
}
- simplex_tree.set_filtration(filtration_max);
simplex_tree.set_dimension(dim_max);
#ifdef DEBUG_TRACES
@@ -235,7 +242,6 @@ int main(int argc, char * const argv[]) {
std::cout << " Number of vertices = " << simplex_tree.num_vertices() << " ";
std::cout << " Number of simplices = " << simplex_tree.num_simplices() << std::endl << std::endl;
std::cout << " Dimension = " << simplex_tree.dimension() << " ";
- std::cout << " filtration = " << simplex_tree.filtration() << std::endl << std::endl;
#endif // DEBUG_TRACES
#ifdef DEBUG_TRACES
diff --git a/example/Persistent_cohomology/persistence_from_file.cpp b/example/Persistent_cohomology/persistence_from_file.cpp
index 67235467..eafa3fd5 100644
--- a/example/Persistent_cohomology/persistence_from_file.cpp
+++ b/example/Persistent_cohomology/persistence_from_file.cpp
@@ -61,8 +61,7 @@ int main(int argc, char * argv[]) {
simplex_tree_stream >> simplex_tree;
std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices" << std::endl;
- std::cout << " - dimension " << simplex_tree.dimension() << " - filtration " << simplex_tree.filtration()
- << std::endl;
+ std::cout << " - dimension " << simplex_tree.dimension() << std::endl;
/*
std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
diff --git a/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp b/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp
index 7ca9410a..8214d66a 100644
--- a/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp
+++ b/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp
@@ -143,11 +143,10 @@ int main(int argc, char * const argv[]) {
/* An edge [10,12,2] */
st.set_dimension(2);
- st.set_filtration(0.4);
std::cout << "The complex contains " << st.num_simplices() << " simplices - " << st.num_vertices() << " vertices "
<< std::endl;
- std::cout << " - dimension " << st.dimension() << " - filtration " << st.filtration() << 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::endl;
std::cout << "**************************************************************" << std::endl;
diff --git a/example/Persistent_cohomology/rips_distance_matrix_persistence.cpp b/example/Persistent_cohomology/rips_distance_matrix_persistence.cpp
index 8517e7f6..d38808c7 100644
--- a/example/Persistent_cohomology/rips_distance_matrix_persistence.cpp
+++ b/example/Persistent_cohomology/rips_distance_matrix_persistence.cpp
@@ -57,7 +57,7 @@ int main(int argc, char * argv[]) {
program_options(argc, argv, csv_matrix_file, filediag, threshold, dim_max, p, min_persistence);
- Distance_matrix distances = read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_matrix_file);
+ Distance_matrix distances = Gudhi::read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_matrix_file);
Rips_complex rips_complex_from_file(distances, threshold);
// Construct the Rips complex in a Simplex Tree
diff --git a/example/Persistent_cohomology/weighted_alpha_complex_3d_persistence.cpp b/example/Persistent_cohomology/weighted_alpha_complex_3d_persistence.cpp
index 34b90933..72268511 100644
--- a/example/Persistent_cohomology/weighted_alpha_complex_3d_persistence.cpp
+++ b/example/Persistent_cohomology/weighted_alpha_complex_3d_persistence.cpp
@@ -81,8 +81,13 @@ using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomolog
ST, Gudhi::persistent_cohomology::Field_Zp >;
void usage(char * const progName) {
- std::cerr << "Usage: " << progName <<
- " path_to_file_graph path_to_weight_file coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
+ std::cerr << "Usage:\n" << progName << " path_to_OFF_file path_to_weight_file coeff_field_characteristic[integer " <<
+ "> 0] min_persistence[float >= -1.0]\n";
+ std::cerr << " path_to_OFF_file is the path to your points cloud in OFF format.\n";
+ std::cerr << " path_to_weight_file is the path to the weights of your points cloud (one value per line.)\n";
+ std::cerr << " Weights values are explained on CGAL documentation:\n";
+ std::cerr << " https://doc.cgal.org/latest/Alpha_shapes_3/index.html#title0\n";
+ std::cerr << " https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation3secclassRegulartriangulation\n";
exit(-1);
}
@@ -115,6 +120,7 @@ int main(int argc, char * const argv[]) {
if (weights_ifstr.good()) {
double weight = 0.0;
std::size_t index = 0;
+ wp.reserve(lp.size());
// Attempt read the weight in a double format, return false if it fails
while ((weights_ifstr >> weight) && (index < lp.size())) {
wp.push_back(Weighted_point_3(lp[index], weight));
@@ -130,7 +136,7 @@ int main(int argc, char * const argv[]) {
}
// alpha shape construction from points. CGAL has a strange behavior in REGULARIZED mode.
- Alpha_shape_3 as(lp.begin(), lp.end(), 0, Alpha_shape_3::GENERAL);
+ Alpha_shape_3 as(wp.begin(), wp.end(), 0, Alpha_shape_3::GENERAL);
#ifdef DEBUG_TRACES
std::cout << "Alpha shape computed in GENERAL mode" << std::endl;
#endif // DEBUG_TRACES
@@ -222,7 +228,6 @@ int main(int argc, char * const argv[]) {
else
std::cout << "This shall not happen" << std::endl;
}
- simplex_tree.set_filtration(filtration_max);
simplex_tree.set_dimension(dim_max);
#ifdef DEBUG_TRACES
@@ -236,7 +241,6 @@ int main(int argc, char * const argv[]) {
std::cout << " Number of vertices = " << simplex_tree.num_vertices() << " ";
std::cout << " Number of simplices = " << simplex_tree.num_simplices() << std::endl << std::endl;
std::cout << " Dimension = " << simplex_tree.dimension() << " ";
- std::cout << " filtration = " << simplex_tree.filtration() << std::endl << std::endl;
#endif // DEBUG_TRACES
#ifdef DEBUG_TRACES
diff --git a/example/Rips_complex/CMakeLists.txt b/example/Rips_complex/CMakeLists.txt
index 8aee79e2..2940f164 100644
--- a/example/Rips_complex/CMakeLists.txt
+++ b/example/Rips_complex/CMakeLists.txt
@@ -3,17 +3,13 @@ project(Rips_complex_examples)
# Point cloud
add_executable ( Rips_complex_example_from_off example_rips_complex_from_off_file.cpp )
-target_link_libraries(Rips_complex_example_from_off ${Boost_SYSTEM_LIBRARY})
add_executable ( Rips_complex_example_one_skeleton_from_points example_one_skeleton_rips_from_points.cpp )
-target_link_libraries(Rips_complex_example_one_skeleton_from_points ${Boost_SYSTEM_LIBRARY})
# Distance matrix
add_executable ( Rips_complex_example_one_skeleton_from_distance_matrix example_one_skeleton_rips_from_distance_matrix.cpp )
-target_link_libraries(Rips_complex_example_one_skeleton_from_distance_matrix ${Boost_SYSTEM_LIBRARY})
add_executable ( Rips_complex_example_from_csv_distance_matrix example_rips_complex_from_csv_distance_matrix_file.cpp )
-target_link_libraries(Rips_complex_example_from_csv_distance_matrix ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Rips_complex_example_from_off ${TBB_LIBRARIES})
@@ -56,3 +52,8 @@ if (DIFF_PATH)
${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt
${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt)
endif()
+
+install(TARGETS Rips_complex_example_from_off DESTINATION bin)
+install(TARGETS Rips_complex_example_one_skeleton_from_points DESTINATION bin)
+install(TARGETS Rips_complex_example_one_skeleton_from_distance_matrix DESTINATION bin)
+install(TARGETS Rips_complex_example_from_csv_distance_matrix DESTINATION bin)
diff --git a/example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp b/example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp
index 7ae8126f..9e182f1e 100644
--- a/example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp
+++ b/example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp
@@ -32,7 +32,7 @@ int main(int argc, char **argv) {
// Init of a Rips complex from a distance matrix in a csv file
// Default separator is ';'
// ----------------------------------------------------------------------------
- Distance_matrix distances = read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_file_name);
+ Distance_matrix distances = Gudhi::read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_file_name);
Rips_complex rips_complex_from_file(distances, threshold);
std::streambuf* streambufffer;
diff --git a/example/Simplex_tree/CMakeLists.txt b/example/Simplex_tree/CMakeLists.txt
index b1ea98d4..e22cc92c 100644
--- a/example/Simplex_tree/CMakeLists.txt
+++ b/example/Simplex_tree/CMakeLists.txt
@@ -19,14 +19,20 @@ add_test(NAME Simplex_tree_example_simple_simplex_tree COMMAND $<TARGET_FILE:Sim
add_executable ( Simplex_tree_example_mini_simplex_tree mini_simplex_tree.cpp )
add_test(NAME Simplex_tree_example_mini_simplex_tree COMMAND $<TARGET_FILE:Simplex_tree_example_mini_simplex_tree>)
+install(TARGETS Simplex_tree_example_from_cliques_of_graph DESTINATION bin)
+install(TARGETS Simplex_tree_example_simple_simplex_tree DESTINATION bin)
+install(TARGETS Simplex_tree_example_mini_simplex_tree DESTINATION bin)
# An example with Simplex-tree using CGAL alpha_shapes_3
if(GMP_FOUND AND CGAL_FOUND)
add_executable ( Simplex_tree_example_alpha_shapes_3_from_off example_alpha_shapes_3_simplex_tree_from_off_file.cpp )
- target_link_libraries(Simplex_tree_example_alpha_shapes_3_from_off ${GMP_LIBRARIES} ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+ target_link_libraries(Simplex_tree_example_alpha_shapes_3_from_off ${GMP_LIBRARIES} ${CGAL_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Simplex_tree_example_alpha_shapes_3_from_off ${TBB_LIBRARIES})
endif()
add_test(NAME Simplex_tree_example_alpha_shapes_3_from_off COMMAND $<TARGET_FILE:Simplex_tree_example_alpha_shapes_3_from_off>
"${CMAKE_SOURCE_DIR}/data/points/bunny_5000.off")
+
+ install(TARGETS Simplex_tree_example_alpha_shapes_3_from_off DESTINATION bin)
+
endif()
diff --git a/example/Simplex_tree/simple_simplex_tree.cpp b/example/Simplex_tree/simple_simplex_tree.cpp
index 60f9a35e..d8318f03 100644
--- a/example/Simplex_tree/simple_simplex_tree.cpp
+++ b/example/Simplex_tree/simple_simplex_tree.cpp
@@ -185,13 +185,12 @@ int main(int argc, char * const argv[]) {
}
// ++ GENERAL VARIABLE SET
- simplexTree.set_filtration(FOURTH_FILTRATION_VALUE); // Max filtration value
simplexTree.set_dimension(2); // Max dimension = 2 -> (2,1,0)
std::cout << "********************************************************************\n";
// Display the Simplex_tree - Can not be done in the middle of 2 inserts
std::cout << "* The complex contains " << simplexTree.num_simplices() << " simplices\n";
- std::cout << " - dimension " << simplexTree.dimension() << " - filtration " << simplexTree.filtration() << "\n";
+ std::cout << " - dimension " << simplexTree.dimension() << "\n";
std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
for (auto f_simplex : simplexTree.filtration_simplex_range()) {
std::cout << " " << "[" << simplexTree.filtration(f_simplex) << "] ";
diff --git a/example/Skeleton_blocker/CMakeLists.txt b/example/Skeleton_blocker/CMakeLists.txt
index c887e408..de70f089 100644
--- a/example/Skeleton_blocker/CMakeLists.txt
+++ b/example/Skeleton_blocker/CMakeLists.txt
@@ -5,8 +5,10 @@ add_executable(Skeleton_blocker_example_from_simplices Skeleton_blocker_from_sim
add_executable(Skeleton_blocker_example_iteration Skeleton_blocker_iteration.cpp)
add_executable(Skeleton_blocker_example_link Skeleton_blocker_link.cpp)
-target_link_libraries(Skeleton_blocker_example_iteration ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBRARY})
-
add_test(NAME Skeleton_blocker_example_from_simplices COMMAND $<TARGET_FILE:Skeleton_blocker_example_from_simplices>)
add_test(NAME Skeleton_blocker_example_iteration COMMAND $<TARGET_FILE:Skeleton_blocker_example_iteration>)
add_test(NAME Skeleton_blocker_example_link COMMAND $<TARGET_FILE:Skeleton_blocker_example_link>)
+
+install(TARGETS Skeleton_blocker_example_from_simplices DESTINATION bin)
+install(TARGETS Skeleton_blocker_example_iteration DESTINATION bin)
+install(TARGETS Skeleton_blocker_example_link DESTINATION bin)
diff --git a/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp b/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp
index 6a1bc480..08ff0264 100644
--- a/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp
+++ b/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp
@@ -21,8 +21,7 @@
*/
#include <gudhi/Skeleton_blocker.h>
-
-#include <boost/timer/timer.hpp>
+#include <gudhi/Clock.h>
#include <stdio.h>
#include <stdlib.h>
@@ -47,8 +46,7 @@ Complex build_complete_complex(int n) {
}
int main(int argc, char *argv[]) {
- boost::timer::auto_cpu_timer t;
-
+ Gudhi::Clock skbl_chrono("Time to build the complete complex, enumerate simplices and Euler Characteristic");
const int n = 15;
// build a full complex with n vertices and 2^n-1 simplices
@@ -82,5 +80,6 @@ int main(int argc, char *argv[]) {
std::cout << "Saw " << num_vertices << " vertices, " << num_edges << " edges and " << num_simplices << " simplices"
<< std::endl;
std::cout << "The Euler Characteristic is " << euler << std::endl;
+ std::cout << skbl_chrono;
return EXIT_SUCCESS;
}
diff --git a/example/Spatial_searching/CMakeLists.txt b/example/Spatial_searching/CMakeLists.txt
index f4b9f3cb..4cf3d863 100644
--- a/example/Spatial_searching/CMakeLists.txt
+++ b/example/Spatial_searching/CMakeLists.txt
@@ -6,4 +6,5 @@ if(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
target_link_libraries(Spatial_searching_example_spatial_searching ${CGAL_LIBRARY})
add_test(NAME Spatial_searching_example_spatial_searching
COMMAND $<TARGET_FILE:Spatial_searching_example_spatial_searching>)
+ install(TARGETS Spatial_searching_example_spatial_searching DESTINATION bin)
endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Spatial_searching/example_spatial_searching.cpp b/example/Spatial_searching/example_spatial_searching.cpp
index 14b324ae..034ad24a 100644
--- a/example/Spatial_searching/example_spatial_searching.cpp
+++ b/example/Spatial_searching/example_spatial_searching.cpp
@@ -24,29 +24,37 @@ int main(void) {
// 10-nearest neighbor query
std::cout << "10 nearest neighbors from points[20]:\n";
- auto knn_range = points_ds.query_k_nearest_neighbors(points[20], 10, true);
+ auto knn_range = points_ds.k_nearest_neighbors(points[20], 10, true);
for (auto const& nghb : knn_range)
std::cout << nghb.first << " (sq. dist. = " << nghb.second << ")\n";
// Incremental nearest neighbor query
std::cout << "Incremental nearest neighbors:\n";
- auto inn_range = points_ds.query_incremental_nearest_neighbors(points[45]);
+ auto inn_range = points_ds.incremental_nearest_neighbors(points[45]);
// Get the neighbors in distance order until we hit the first point
for (auto ins_iterator = inn_range.begin(); ins_iterator->first != 0; ++ins_iterator)
std::cout << ins_iterator->first << " (sq. dist. = " << ins_iterator->second << ")\n";
- // 10-farthest neighbor query
- std::cout << "10 farthest neighbors from points[20]:\n";
- auto kfn_range = points_ds.query_k_farthest_neighbors(points[20], 10, true);
+ // 10-furthest neighbor query
+ std::cout << "10 furthest neighbors from points[20]:\n";
+ auto kfn_range = points_ds.k_furthest_neighbors(points[20], 10, true);
for (auto const& nghb : kfn_range)
std::cout << nghb.first << " (sq. dist. = " << nghb.second << ")\n";
- // Incremental farthest neighbor query
- std::cout << "Incremental farthest neighbors:\n";
- auto ifn_range = points_ds.query_incremental_farthest_neighbors(points[45]);
+ // Incremental furthest neighbor query
+ std::cout << "Incremental furthest neighbors:\n";
+ auto ifn_range = points_ds.incremental_furthest_neighbors(points[45]);
// Get the neighbors in distance reverse order until we hit the first point
for (auto ifs_iterator = ifn_range.begin(); ifs_iterator->first != 0; ++ifs_iterator)
std::cout << ifs_iterator->first << " (sq. dist. = " << ifs_iterator->second << ")\n";
+ // All-near-neighbors search
+ std::cout << "All-near-neighbors search:\n";
+ std::vector<std::size_t> rs_result;
+ points_ds.all_near_neighbors(points[45], 0.5, std::back_inserter(rs_result));
+ K k;
+ for (auto const& p_idx : rs_result)
+ std::cout << p_idx << " (sq. dist. = " << k.squared_distance_d_object()(points[p_idx], points[45]) << ")\n";
+
return 0;
}
diff --git a/example/Subsampling/CMakeLists.txt b/example/Subsampling/CMakeLists.txt
index 71b8d2e8..34400b1e 100644
--- a/example/Subsampling/CMakeLists.txt
+++ b/example/Subsampling/CMakeLists.txt
@@ -14,4 +14,10 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
COMMAND $<TARGET_FILE:Subsampling_example_choose_n_farthest_points>)
add_test(NAME Subsampling_example_sparsify_point_set
COMMAND $<TARGET_FILE:Subsampling_example_sparsify_point_set>)
+
+ install(TARGETS Subsampling_example_pick_n_random_points DESTINATION bin)
+ install(TARGETS Subsampling_example_choose_n_farthest_points DESTINATION bin)
+ install(TARGETS Subsampling_example_custom_kernel DESTINATION bin)
+ install(TARGETS Subsampling_example_sparsify_point_set DESTINATION bin)
+
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Tangential_complex/CMakeLists.txt b/example/Tangential_complex/CMakeLists.txt
index 339d0581..16d1339d 100644
--- a/example/Tangential_complex/CMakeLists.txt
+++ b/example/Tangential_complex/CMakeLists.txt
@@ -3,9 +3,9 @@ project(Tangential_complex_examples)
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
add_executable( Tangential_complex_example_basic example_basic.cpp )
- target_link_libraries(Tangential_complex_example_basic ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY})
+ target_link_libraries(Tangential_complex_example_basic ${CGAL_LIBRARY})
add_executable( Tangential_complex_example_with_perturb example_with_perturb.cpp )
- target_link_libraries(Tangential_complex_example_with_perturb ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY})
+ target_link_libraries(Tangential_complex_example_with_perturb ${CGAL_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Tangential_complex_example_basic ${TBB_LIBRARIES})
target_link_libraries(Tangential_complex_example_with_perturb ${TBB_LIBRARIES})
@@ -15,4 +15,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
COMMAND $<TARGET_FILE:Tangential_complex_example_basic>)
add_test(NAME Tangential_complex_example_with_perturb
COMMAND $<TARGET_FILE:Tangential_complex_example_with_perturb>)
+
+ install(TARGETS Tangential_complex_example_basic DESTINATION bin)
+ install(TARGETS Tangential_complex_example_with_perturb DESTINATION bin)
endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Witness_complex/CMakeLists.txt b/example/Witness_complex/CMakeLists.txt
index 670651ce..cbc53902 100644
--- a/example/Witness_complex/CMakeLists.txt
+++ b/example/Witness_complex/CMakeLists.txt
@@ -2,27 +2,25 @@ cmake_minimum_required(VERSION 2.6)
project(Witness_complex_examples)
add_executable ( Witness_complex_example_nearest_landmark_table example_nearest_landmark_table.cpp )
-target_link_libraries(Witness_complex_example_nearest_landmark_table ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Witness_complex_example_nearest_landmark_table ${TBB_LIBRARIES})
endif()
add_test(NAME Witness_complex_example_nearest_landmark_table
COMMAND $<TARGET_FILE:Witness_complex_example_nearest_landmark_table>)
+install(TARGETS Witness_complex_example_nearest_landmark_table DESTINATION bin)
+
# CGAL and Eigen3 are required for Euclidean version of Witness
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
add_executable( Witness_complex_example_off example_witness_complex_off.cpp )
- target_link_libraries(Witness_complex_example_off ${Boost_SYSTEM_LIBRARY})
add_executable( Witness_complex_example_strong_off example_strong_witness_complex_off.cpp )
- target_link_libraries(Witness_complex_example_strong_off ${Boost_SYSTEM_LIBRARY})
add_executable ( Witness_complex_example_sphere example_witness_complex_sphere.cpp )
- target_link_libraries(Witness_complex_example_sphere ${Boost_SYSTEM_LIBRARY})
add_executable ( Witness_complex_example_witness_persistence example_witness_complex_persistence.cpp )
- target_link_libraries(Witness_complex_example_witness_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+ target_link_libraries(Witness_complex_example_witness_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY})
add_executable ( Witness_complex_example_strong_witness_persistence example_strong_witness_persistence.cpp )
- target_link_libraries(Witness_complex_example_strong_witness_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
+ target_link_libraries(Witness_complex_example_strong_witness_persistence ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Witness_complex_example_witness_persistence ${TBB_LIBRARIES})
@@ -43,4 +41,11 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
add_test(NAME Witness_complex_example_strong_test_torus_persistence
COMMAND $<TARGET_FILE:Witness_complex_example_strong_witness_persistence>
"${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-l" "20" "-a" "0.5")
+
+ install(TARGETS Witness_complex_example_off DESTINATION bin)
+ install(TARGETS Witness_complex_example_strong_off DESTINATION bin)
+ install(TARGETS Witness_complex_example_sphere DESTINATION bin)
+ install(TARGETS Witness_complex_example_witness_persistence DESTINATION bin)
+ install(TARGETS Witness_complex_example_strong_witness_persistence DESTINATION bin)
+
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
diff --git a/example/common/CMakeLists.txt b/example/common/CMakeLists.txt
index d5311b18..afe865d4 100644
--- a/example/common/CMakeLists.txt
+++ b/example/common/CMakeLists.txt
@@ -2,21 +2,27 @@ cmake_minimum_required(VERSION 2.6)
project(Common_examples)
add_executable ( vector_double_off_reader example_vector_double_points_off_reader.cpp )
-target_link_libraries(vector_double_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+target_link_libraries(vector_double_off_reader ${CGAL_LIBRARY})
add_test(NAME Common_example_vector_double_off_reader COMMAND $<TARGET_FILE:vector_double_off_reader>
"${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off")
+install(TARGETS vector_double_off_reader DESTINATION bin)
+
if(CGAL_FOUND)
add_executable ( cgal_3D_off_reader example_CGAL_3D_points_off_reader.cpp )
- target_link_libraries(cgal_3D_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(cgal_3D_off_reader ${CGAL_LIBRARY})
add_test(NAME Common_example_vector_cgal_3D_off_reader COMMAND $<TARGET_FILE:cgal_3D_off_reader>
"${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off")
- # need CGAL 4.7and Eigen3
+ install(TARGETS cgal_3D_off_reader DESTINATION bin)
+
+ # need CGAL 4.7 and Eigen3
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
add_executable ( cgal_off_reader example_CGAL_points_off_reader.cpp )
- target_link_libraries(cgal_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ target_link_libraries(cgal_off_reader ${CGAL_LIBRARY})
add_test(NAME Common_example_vector_cgal_off_reader COMMAND $<TARGET_FILE:cgal_off_reader>
"${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off")
+ install(TARGETS cgal_off_reader DESTINATION bin)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
+
endif()