summaryrefslogtreecommitdiff
path: root/src/Persistent_cohomology/example
diff options
context:
space:
mode:
authorcjamin <cjamin@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-09-29 15:59:03 +0000
committercjamin <cjamin@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-09-29 15:59:03 +0000
commitf45959484fb85299d9ac60c43de9325e5c06e730 (patch)
tree64055685e3e2d1b1bb8db82db57bd1c45d7657ea /src/Persistent_cohomology/example
parent0a66874247cb6ab10a2d96e22ecd5009113291d2 (diff)
parent768c70aa382a7b0b561ea842720f5963a412b88e (diff)
Merge from trunk
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2732 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7872aa224ee471c05e9213b81192d304254e608a
Diffstat (limited to 'src/Persistent_cohomology/example')
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt16
-rw-r--r--src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp7
-rw-r--r--src/Persistent_cohomology/example/persistence_from_file.cpp3
-rw-r--r--src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp3
-rw-r--r--src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp14
5 files changed, 21 insertions, 22 deletions
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index eb31e050..98ed753d 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -2,19 +2,17 @@ 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_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})
@@ -46,7 +44,7 @@ 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)
@@ -58,9 +56,9 @@ endif(GMP_FOUND)
if(CGAL_FOUND)
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(exact_alpha_complex_3d_persistence ${TBB_LIBRARIES})
@@ -76,7 +74,7 @@ if(CGAL_FOUND)
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
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(custom_persistence_sort ${TBB_LIBRARIES})
diff --git a/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp
index fa49dcee..8ce68406 100644
--- a/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp
+++ b/src/Persistent_cohomology/example/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/src/Persistent_cohomology/example/persistence_from_file.cpp b/src/Persistent_cohomology/example/persistence_from_file.cpp
index 67235467..eafa3fd5 100644
--- a/src/Persistent_cohomology/example/persistence_from_file.cpp
+++ b/src/Persistent_cohomology/example/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/src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp b/src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp
index 7ca9410a..8214d66a 100644
--- a/src/Persistent_cohomology/example/persistence_from_simple_simplex_tree.cpp
+++ b/src/Persistent_cohomology/example/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/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp
index 4a2b10f3..a4ecf9da 100644
--- a/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp
+++ b/src/Persistent_cohomology/example/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