From 437ccdf9616d91534af91cd8a0090b6f32d6e65b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 14 Apr 2016 12:49:09 +0000 Subject: Add of src/common/include/gudhi/Points_3D_off_io.h to read specific 3D OFF Files for CGAL Point_3 Add an example to read 3D OFF Files for CGAL Point_3 Modify alpha_complex_3d_persistence.cpp to read OFF files Add periodic_alpha_complex_3d_persistence.cpp in Persistent_cohomology examples Add info about new examples in README git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/periodic_alpha_complex_3d@1116 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6b423b598869a0f4f9c62d93c93b69efd93c0161 --- src/Persistent_cohomology/example/README | 98 ++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 6 deletions(-) (limited to 'src/Persistent_cohomology/example/README') diff --git a/src/Persistent_cohomology/example/README b/src/Persistent_cohomology/example/README index 8c71ccf5..92b80c76 100644 --- a/src/Persistent_cohomology/example/README +++ b/src/Persistent_cohomology/example/README @@ -4,13 +4,13 @@ cd /path-to-example/ cmake . make - -Example of use : +*********************************************************************************************************************** +Example of use of RIPS: Computation of the persistent homology with Z/2Z coefficients of the Rips complex on points sampling a Klein bottle: -./rips_persistence ../../../data/points/Kl.txt -r 0.25 -d 3 -p 2 -m 100 +./rips_persistence ../../data/points/Kl.txt -r 0.25 -d 3 -p 2 -m 100 output: 210 0 0 inf @@ -29,7 +29,7 @@ where with Z/3Z coefficients: -./rips_persistence ../../../data/points/Kl.txt -r 0.25 -d 3 -p 3 -m 100 +./rips_persistence ../../data/points/Kl.txt -r 0.25 -d 3 -p 3 -m 100 output: 3 0 0 inf @@ -37,7 +37,7 @@ output: and the computation with Z/2Z and Z/3Z coefficients simultaneously: -./rips_multifield_persistence ../../../data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 3 -m 100 +./rips_multifield_persistence ../../data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 3 -m 100 output: 6 0 0 inf @@ -47,10 +47,96 @@ output: and finally the computation with all Z/pZ for 2 <= p <= 71 (20 first prime numbers): - ./rips_multifield_persistence ../../../data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 71 -m 100 + ./rips_multifield_persistence ../../data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 71 -m 100 output: 557940830126698960967415390 0 0 inf 557940830126698960967415390 1 0.0702103 inf 2 1 0.0702103 inf 2 2 0.159992 inf + +*********************************************************************************************************************** +Example of use of ALPHA: + +For a more verbose mode, please run cmake with option "DEBUG_TRACES=TRUE" and recompile the programs. + +1) 3D special case +------------------ +Computation of the persistent homology with Z/2Z coefficients of the alpha complex on points +sampling a torus 3D: + +./alpha_complex_3d_persistence ../../data/points/tore3D_300.off 2 0.45 + +output: +Simplex_tree dim: 3 +2 0 0 inf +2 1 0.0682162 1.0001 +2 1 0.0934117 1.00003 +2 2 0.56444 1.03938 + +Here we retrieve expected Betti numbers on a tore 3D: +Betti numbers[0] = 1 +Betti numbers[1] = 2 +Betti numbers[2] = 1 + +N.B.: alpha_complex_3d_persistence accepts only OFF files in 3D dimension. + +2) d-Dimension case +------------------- +Computation of the persistent homology with Z/2Z coefficients of the alpha complex on points +sampling a torus 3D: + +./alpha_complex_persistence -r 32 -p 2 -m 0.45 ../../data/points/tore3D_300.off + +output: +Alpha complex is of dimension 3 - 9273 simplices - 300 vertices. +Simplex_tree dim: 3 +2 0 0 inf +2 1 0.0682162 1.0001 +2 1 0.0934117 1.00003 +2 2 0.56444 1.03938 + +Here we retrieve expected Betti numbers on a tore 3D: +Betti numbers[0] = 1 +Betti numbers[1] = 2 +Betti numbers[2] = 1 + +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 2 0.0 + +output: +Periodic Delaunay computed. +Simplex_tree dim: 3 +2 0 0.0866025 inf +2 1 0.0866025 inf +2 1 0.0866025 inf +2 1 0.0866025 inf +2 2 0.0866025 inf +2 2 0.0866025 inf +2 2 0.0866025 inf + +N.B.: periodic_alpha_complex_3d_persistence accepts only OFF files in 3D dimension. In this example, the periodic cube +is hard coded to { x = [0,1]; y = [0,1]; z = [0,1] } + +*********************************************************************************************************************** +Example of use of PLAIN HOMOLOGY: + +This example computes the plain homology of the following simplicial complex without filtration values: + /* Complex to build. */ + /* 1 3 */ + /* o---o */ + /* /X\ / */ + /* o---o o */ + /* 2 0 4 */ + +./plain_homology + +output: +2 0 0 inf +2 0 0 inf +2 1 0 inf + +Here we retrieve the 2 entities {0,1,2,3} and {4} (Betti numbers[0] = 2) and the hole in {0,1,3} (Betti numbers[1] = 1) \ No newline at end of file -- cgit v1.2.3 From 91e58d98e81963ac714ec6c9508c5bc15945f20b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 15 Apr 2016 13:08:20 +0000 Subject: Periodic bug fix git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/periodic_alpha_complex_3d@1125 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2540ab0edd3f26219bbc3cbd7068e7f5a043f7c2 --- src/Persistent_cohomology/example/README | 19 ++++++++++--------- .../example/periodic_alpha_complex_3d_persistence.cpp | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/Persistent_cohomology/example/README') diff --git a/src/Persistent_cohomology/example/README b/src/Persistent_cohomology/example/README index 92b80c76..f490ed9a 100644 --- a/src/Persistent_cohomology/example/README +++ b/src/Persistent_cohomology/example/README @@ -105,18 +105,19 @@ 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 2 0.0 +./periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off 3 1.0 output: Periodic Delaunay computed. Simplex_tree dim: 3 -2 0 0.0866025 inf -2 1 0.0866025 inf -2 1 0.0866025 inf -2 1 0.0866025 inf -2 2 0.0866025 inf -2 2 0.0866025 inf -2 2 0.0866025 inf +3 0 0 inf +3 1 0.05 inf +3 1 0.05 inf +3 1 0.05 inf +3 2 0.0707107 inf +3 2 0.0707107 inf +3 2 0.0707107 inf +3 3 0.0866025 inf N.B.: periodic_alpha_complex_3d_persistence accepts only OFF files in 3D dimension. In this example, the periodic cube is hard coded to { x = [0,1]; y = [0,1]; z = [0,1] } @@ -139,4 +140,4 @@ output: 2 0 0 inf 2 1 0 inf -Here we retrieve the 2 entities {0,1,2,3} and {4} (Betti numbers[0] = 2) and the hole in {0,1,3} (Betti numbers[1] = 1) \ No newline at end of file +Here we retrieve the 2 entities {0,1,2,3} and {4} (Betti numbers[0] = 2) and the hole in {0,1,3} (Betti numbers[1] = 1) diff --git a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp index 42e6f0c6..750ebb1a 100644 --- a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp @@ -173,7 +173,7 @@ int main(int argc, char * const argv[]) { // alpha shape construction from points. CGAL has a strange behavior in REGULARIZED mode. This is the default mode // Maybe need to set it to GENERAL mode - Alpha_shape_3 as(pdt, Alpha_shape_3::GENERAL); + Alpha_shape_3 as(pdt, 0, Alpha_shape_3::GENERAL); // filtration with alpha values from alpha shape std::vector the_objects; @@ -291,7 +291,7 @@ int main(int argc, char * const argv[]) { std::cout << "Simplex_tree dim: " << simplex_tree.dimension() << std::endl; // Compute the persistence diagram of the complex - Persistent_cohomology pcoh(simplex_tree); + Persistent_cohomology pcoh(simplex_tree, true); // initializes the coefficient field for homology pcoh.init_coefficients(coeff_field_characteristic); -- cgit v1.2.3 From ea216e9c11bf58ba32be89ab561b3a2396b7377c Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 15 Apr 2016 13:30:53 +0000 Subject: Filtration values are alpha square values for periodic_alpha_complex_3d Mention it in README git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/periodic_alpha_complex_3d@1127 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6085fc3e79db765c041a06d6d05dd3d28685f7bd --- src/Persistent_cohomology/example/README | 33 ++++++++++++++-------- .../periodic_alpha_complex_3d_persistence.cpp | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src/Persistent_cohomology/example/README') diff --git a/src/Persistent_cohomology/example/README b/src/Persistent_cohomology/example/README index f490ed9a..7803e5ab 100644 --- a/src/Persistent_cohomology/example/README +++ b/src/Persistent_cohomology/example/README @@ -79,7 +79,8 @@ Betti numbers[0] = 1 Betti numbers[1] = 2 Betti numbers[2] = 1 -N.B.: alpha_complex_3d_persistence accepts only OFF files in 3D dimension. +N.B.: - alpha_complex_3d_persistence accepts only OFF files in 3D dimension. + - filtration values are alpha square values 2) d-Dimension case ------------------- @@ -101,7 +102,8 @@ Betti numbers[0] = 1 Betti numbers[1] = 2 Betti numbers[2] = 1 -N.B.: alpha_complex_persistence accepts OFF files in d-Dimension. +N.B.: - alpha_complex_persistence accepts OFF files in d-Dimension. + - filtration values are alpha square values 3) 3D periodic special case --------------------------- @@ -110,17 +112,24 @@ N.B.: alpha_complex_persistence accepts OFF files in d-Dimension. output: Periodic Delaunay computed. Simplex_tree dim: 3 -3 0 0 inf -3 1 0.05 inf -3 1 0.05 inf -3 1 0.05 inf -3 2 0.0707107 inf -3 2 0.0707107 inf -3 2 0.0707107 inf -3 3 0.0866025 inf - -N.B.: periodic_alpha_complex_3d_persistence accepts only OFF files in 3D dimension. In this example, the periodic cube +3 0 0 inf +3 1 0.0025 inf +3 1 0.0025 inf +3 1 0.0025 inf +3 2 0.005 inf +3 2 0.005 inf +3 2 0.005 inf +3 3 0.0075 inf + +Here we retrieve expected Betti numbers on a tore 3D: +Betti numbers[0] = 1 +Betti numbers[1] = 3 +Betti numbers[2] = 3 +Betti numbers[3] = 1 + +N.B.: - periodic_alpha_complex_3d_persistence accepts only OFF files in 3D dimension. In this example, the periodic cube is hard coded to { x = [0,1]; y = [0,1]; z = [0,1] } + - filtration values are alpha square values *********************************************************************************************************************** Example of use of PLAIN HOMOLOGY: diff --git a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp index 750ebb1a..b8e1097d 100644 --- a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp @@ -249,7 +249,7 @@ int main(int argc, char * const argv[]) { } } // Construction of the simplex_tree - Filtration_value filtr = std::sqrt(*the_alpha_value_iterator); + Filtration_value filtr = /*std::sqrt*/(*the_alpha_value_iterator); #ifdef DEBUG_TRACES std::cout << "filtration = " << filtr << std::endl; #endif // DEBUG_TRACES -- cgit v1.2.3