From f23c94a1f79b5157d2468c9a1eea50b04873c638 Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 22 Nov 2017 15:44:09 +0000 Subject: Part of the doc disappeared during the homogenization... git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2939 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 1381b0362d36dbd1ed67c180f5488b05f4784624 --- src/Alpha_complex/utilities/README | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Alpha_complex/utilities/README b/src/Alpha_complex/utilities/README index c3dd170b..cc3b2524 100644 --- a/src/Alpha_complex/utilities/README +++ b/src/Alpha_complex/utilities/README @@ -8,9 +8,12 @@ This program computes the persistent homology with coefficient field Z/pZ of the where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). **Usage** -`alpha_complex_3d_persistence [options] ` +`alpha_complex_3d_persistence [options] ` +where +`` is the path to the input point cloud in OFF format. **Allowed options** + * `-h [ --help ]` Produce help message * `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. * `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. @@ -50,9 +53,13 @@ Same as `alpha_complex_3d_persistence`, but using exact computation. It is slowe Same as `alpha_complex_3d_persistence`, but using weighted points. **Usage** -`weighted_alpha_complex_3d_persistence [options] ` +`weighted_alpha_complex_3d_persistence [options] ` +where +`` is the path to the input point cloud in OFF format. +`` is the path to the file containing the weights of the points (one value per line). **Allowed options** + * `-h [ --help ]` Produce help message * `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. * `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. @@ -80,17 +87,13 @@ and [Regular triangulation](https://doc.cgal.org/latest/Triangulation_3/index.ht Same as `alpha_complex_3d_persistence`, but using periodic alpha shape 3d. **Usage** -`periodic_alpha_complex_3d_persistence

` +`periodic_alpha_complex_3d_persistence [options] ` where `` is the path to the input point cloud in OFF format. `` is the path to the file describing the periodic domain. It must be in the format described [here](http://gudhi.gforge.inria.fr/doc/latest/fileformats.html#FileFormatsIsoCuboid). -`

` is the characteristic p of the coefficient field *Z/pZ* for computing homology. It must be a stricly positive integer. -`` is the minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. - -**Usage** -`./periodic_alpha_complex_3d_persistence [options] input-file cuboid-file` **Allowed options** + * `-h [ --help ]` Produce help message * `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. * `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. @@ -137,7 +140,9 @@ This program computes the persistent homology with coefficient field Z/pZ of the where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). **Usage** -`alpha_complex_persistence [options] ` +`alpha_complex_persistence [options] ` +where +`` is the path to the input point cloud in OFF format. **Allowed options** -- cgit v1.2.3 From def50bba711e9c2a3be86b4944845b0009fe29a2 Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 22 Nov 2017 15:48:17 +0000 Subject: Fix typo git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2940 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b888519a9985ae84fcf5788eab66fc5b574936f8 --- src/common/doc/file_formats.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/common/doc/file_formats.h b/src/common/doc/file_formats.h index 3b3d9248..069b19d1 100644 --- a/src/common/doc/file_formats.h +++ b/src/common/doc/file_formats.h @@ -57,10 +57,10 @@ namespace Gudhi { \section FileFormatsIsoCuboid Iso-cuboid - Such a file describes an iso-oriented cuboid with diagonal opposite vertices (min_hx, min_hy, min_hz,...) and (max_hx, max_hy, max_hz, ...). The format is:
+ Such a file describes an iso-oriented cuboid with diagonal opposite vertices (min_x, min_y, min_z,...) and (max_x, max_y, max_z, ...). The format is:
\verbatim - min_hx min_hy [min_hz ...] - max_hx max_hy [max_hz ...] + min_x min_y [min_z ...] + max_x max_y [max_z ...] \endverbatim Here is a simple sample file in the 3D case: -- cgit v1.2.3 From 458d964077335101ba3f231e051ceeb13ea9cfa6 Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 22 Nov 2017 16:02:26 +0000 Subject: Add link to OFF file doc git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2941 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2789c8353a525f9a0bfa1d51886b5d2388daf469 --- src/Alpha_complex/utilities/README | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Alpha_complex/utilities/README b/src/Alpha_complex/utilities/README index cc3b2524..0d3d6bfc 100644 --- a/src/Alpha_complex/utilities/README +++ b/src/Alpha_complex/utilities/README @@ -10,7 +10,7 @@ where `dim` is the dimension of the homological feature, `b` and `d` are respect **Usage** `alpha_complex_3d_persistence [options] ` where -`` is the path to the input point cloud in OFF format. +`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). **Allowed options** @@ -55,7 +55,7 @@ Same as `alpha_complex_3d_persistence`, but using weighted points. **Usage** `weighted_alpha_complex_3d_persistence [options] ` where -`` is the path to the input point cloud in OFF format. +`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). `` is the path to the file containing the weights of the points (one value per line). **Allowed options** @@ -85,11 +85,12 @@ and [Regular triangulation](https://doc.cgal.org/latest/Triangulation_3/index.ht ## `periodic_alpha_complex_3d_persistence` ## Same as `alpha_complex_3d_persistence`, but using periodic alpha shape 3d. +Refer to the [CGAL's 3D Periodic Triangulations User Manual](https://doc.cgal.org/latest/Periodic_3_triangulation_3/index.html) for more details. **Usage** `periodic_alpha_complex_3d_persistence [options] ` where -`` is the path to the input point cloud in OFF format. +`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). `` is the path to the file describing the periodic domain. It must be in the format described [here](http://gudhi.gforge.inria.fr/doc/latest/fileformats.html#FileFormatsIsoCuboid). **Allowed options** @@ -142,7 +143,7 @@ where `dim` is the dimension of the homological feature, `b` and `d` are respect **Usage** `alpha_complex_persistence [options] ` where -`` is the path to the input point cloud in OFF format. +`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). **Allowed options** @@ -172,6 +173,5 @@ Betti numbers[1] = 2 Betti numbers[2] = 1 ``` -N.B.: -* `alpha_complex_persistence` only accepts OFF files in dimension d. +N.B.: * Filtration values are alpha square values. -- cgit v1.2.3 From 05224407e92eaf623a980adf5f578b72c64647cb Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 22 Nov 2017 16:31:18 +0000 Subject: Rename some utilities + some fix in the doc git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2942 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e7fe4af0f7d54ed580e557fe7ff9bc57ced2baa9 --- .../utilities/Bitmap_cubical_complex.cpp | 80 --------------------- ...ubical_complex_periodic_boundary_conditions.cpp | 82 ---------------------- .../utilities/CMakeLists.txt | 20 +++--- src/Bitmap_cubical_complex/utilities/README | 22 +++--- .../utilities/cubical_complex_persistence.cpp | 80 +++++++++++++++++++++ .../periodic_cubical_complex_persistence.cpp | 82 ++++++++++++++++++++++ src/Bottleneck_distance/utilities/CMakeLists.txt | 8 +-- .../utilities/bottleneck_distance.cpp | 50 +++++++++++++ .../utilities/bottleneck_read_file.cpp | 50 ------------- src/common/doc/main_page.h | 12 ++-- 10 files changed, 240 insertions(+), 246 deletions(-) delete mode 100644 src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex.cpp delete mode 100644 src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex_periodic_boundary_conditions.cpp create mode 100644 src/Bitmap_cubical_complex/utilities/cubical_complex_persistence.cpp create mode 100644 src/Bitmap_cubical_complex/utilities/periodic_cubical_complex_persistence.cpp create mode 100644 src/Bottleneck_distance/utilities/bottleneck_distance.cpp delete mode 100644 src/Bottleneck_distance/utilities/bottleneck_read_file.cpp (limited to 'src') diff --git a/src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex.cpp b/src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex.cpp deleted file mode 100644 index 9d1bc08c..00000000 --- a/src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Pawel Dlotko - * - * Copyright (C) 2015 INRIA Saclay (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include - -// standard stuff -#include -#include -#include -#include - -int main(int argc, char** argv) { - std::cout - << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical " - << "complexes provided in text files in Perseus style (the only numbered in the first line is a dimension D of a" - << "bitmap. In the lines I between 2 and D+1 there are numbers of top dimensional cells in the direction I. Let " - << "N denote product of the numbers in the lines between 2 and D. In the lines D+2 to D+2+N there are " - << "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; - - 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"; - return 1; - } - - typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base Bitmap_cubical_complex_base; - typedef Gudhi::cubical_complex::Bitmap_cubical_complex Bitmap_cubical_complex; - typedef Gudhi::persistent_cohomology::Field_Zp Field_Zp; - typedef Gudhi::persistent_cohomology::Persistent_cohomology Persistent_cohomology; - - Bitmap_cubical_complex b(argv[1]); - - // Compute the persistence diagram of the complex - Persistent_cohomology pcoh(b); - int p = 11; - double min_persistence = 0; - - pcoh.init_coefficients(p); // initializes the coefficient field for homology - pcoh.compute_persistent_cohomology(min_persistence); - - 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: " << output_file_name << "\n"; - - return 0; -} diff --git a/src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex_periodic_boundary_conditions.cpp b/src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex_periodic_boundary_conditions.cpp deleted file mode 100644 index c812cb3a..00000000 --- a/src/Bitmap_cubical_complex/utilities/Bitmap_cubical_complex_periodic_boundary_conditions.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Author(s): Pawel Dlotko - * - * Copyright (C) 2015 INRIA Saclay (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include - -// standard stuff -#include -#include -#include -#include - -int main(int argc, char** argv) { - std::cout - << "This program computes persistent homology, by using " - << "Bitmap_cubical_complex_periodic_boundary_conditions class, of cubical complexes provided in text files in " - << "Perseus style (the only numbered in the first line is a dimension D of a bitmap. In the lines I between 2 " - << "and D+1 there are numbers of top dimensional cells in the direction I. Let N denote product of the numbers " - << "in the lines between 2 and D. In the lines D+2 to D+2+N there are 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; - - 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"; - return 1; - } - - typedef Gudhi::cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base Bitmap_base; - typedef Gudhi::cubical_complex::Bitmap_cubical_complex Bitmap_cubical_complex; - - Bitmap_cubical_complex b(argv[1]); - - typedef Gudhi::persistent_cohomology::Field_Zp Field_Zp; - typedef Gudhi::persistent_cohomology::Persistent_cohomology Persistent_cohomology; - // Compute the persistence diagram of the complex - Persistent_cohomology pcoh(b, true); - - int p = 11; - double min_persistence = 0; - pcoh.init_coefficients(p); // initializes the coefficient field for homology - pcoh.compute_persistent_cohomology(min_persistence); - - 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: " << output_file_name << "\n"; - - return 0; -} diff --git a/src/Bitmap_cubical_complex/utilities/CMakeLists.txt b/src/Bitmap_cubical_complex/utilities/CMakeLists.txt index f0f80059..676a730a 100644 --- a/src/Bitmap_cubical_complex/utilities/CMakeLists.txt +++ b/src/Bitmap_cubical_complex/utilities/CMakeLists.txt @@ -1,29 +1,29 @@ cmake_minimum_required(VERSION 2.6) project(Bitmap_cubical_complex_utilities) -add_executable ( Bitmap_cubical_complex Bitmap_cubical_complex.cpp ) +add_executable ( cubical_complex_persistence cubical_complex_persistence.cpp ) if (TBB_FOUND) - target_link_libraries(Bitmap_cubical_complex ${TBB_LIBRARIES}) + target_link_libraries(cubical_complex_persistence ${TBB_LIBRARIES}) endif() -add_test(NAME Bitmap_cubical_complex_utility_persistence_one_sphere COMMAND $ +add_test(NAME Bitmap_cubical_complex_utility_persistence_one_sphere COMMAND $ "${CMAKE_SOURCE_DIR}/data/bitmap/CubicalOneSphere.txt") -add_test(NAME Bitmap_cubical_complex_utility_persistence_two_sphere COMMAND $ +add_test(NAME Bitmap_cubical_complex_utility_persistence_two_sphere COMMAND $ "${CMAKE_SOURCE_DIR}/data/bitmap/CubicalTwoSphere.txt") -add_executable ( Bitmap_cubical_complex_periodic_boundary_conditions Bitmap_cubical_complex_periodic_boundary_conditions.cpp ) +add_executable ( periodic_cubical_complex_persistence periodic_cubical_complex_persistence.cpp ) if (TBB_FOUND) - target_link_libraries(Bitmap_cubical_complex_periodic_boundary_conditions ${TBB_LIBRARIES}) + target_link_libraries(periodic_cubical_complex_persistence ${TBB_LIBRARIES}) endif() add_test(NAME Bitmap_cubical_complex_utility_periodic_boundary_conditions_2d_torus - COMMAND $ + COMMAND $ "${CMAKE_SOURCE_DIR}/data/bitmap/2d_torus.txt") add_test(NAME Bitmap_cubical_complex_utility_periodic_boundary_conditions_3d_torus - COMMAND $ + COMMAND $ "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt") -install(TARGETS Bitmap_cubical_complex DESTINATION bin) -install(TARGETS Bitmap_cubical_complex_periodic_boundary_conditions DESTINATION bin) +install(TARGETS cubical_complex_persistence DESTINATION bin) +install(TARGETS periodic_cubical_complex_persistence DESTINATION bin) diff --git a/src/Bitmap_cubical_complex/utilities/README b/src/Bitmap_cubical_complex/utilities/README index d9085635..e7c10083 100644 --- a/src/Bitmap_cubical_complex/utilities/README +++ b/src/Bitmap_cubical_complex/utilities/README @@ -1,24 +1,18 @@ # Bitmap_cubical_complex # -## `Bitmap_cubical_complex` ## +## `cubical_complex_persistence` ## This program computes persistent homology, by using the Bitmap_cubical_complex class, of cubical complexes provided in text files in Perseus style. The only number in the first line is a dimension D of a bitmap. In the lines I between 2 and D+1 there are numbers of top dimensional cells in the direction I. Let N denote product of the numbers in the lines between 2 and D. In the lines D+2 to D+2+N there are filtrations of top dimensional cells. We assume that the cells are in the lexicographical order. -Examples: +Example: -* Create a Cubical Complex from the Perseus style file CubicalOneSphere.txt, computes Persistence cohomology from it and writes the results in a persistence file: -`Bitmap_cubical_complex data/bitmap/CubicalOneSphere.txt` +* Create a Cubical Complex from the Perseus style file `CubicalTwoSphere.txt`, computes Persistence cohomology from it and writes the results in a persistence file `CubicalTwoSphere.txt_persistence`: +`cubical_complex_persistence data/bitmap/CubicalTwoSphere.txt` -* Create a Cubical Complex from the Perseus style file CubicalTwoSphere.txt, computes Persistence cohomology from it and writes the results in a persistence file: -`Bitmap_cubical_complex data/bitmap/CubicalTwoSphere.txt` - -## `Bitmap_cubical_complex_periodic_boundary_conditions` ## +## `periodic_cubical_complex_persistence` ## Same as above, but with periodic boundary conditions. -Examples: - -* Create a Periodical Cubical Complex from the Perseus style file 2d_torus.txt, computes Persistence cohomology from it and writes the results in a persistence file: -`Bitmap_cubical_complex_periodic_boundary_conditions.exe data/bitmap/2d_torus.txt` +Example: -* Create a Periodical Cubical Complex from the Perseus style file 3d_torus.txt, computes Persistence cohomology from it and writes the results in a persistence file: -`Bitmap_cubical_complex_periodic_boundary_conditions.exe data/bitmap/3d_torus.txt` +* Create a Periodical Cubical Complex from the Perseus style file `3d_torus.txt`, computes Persistence cohomology from it and writes the results in a persistence file `3d_torus.txt_persistence`: +`periodic_cubical_complex_persistence data/bitmap/3d_torus.txt` diff --git a/src/Bitmap_cubical_complex/utilities/cubical_complex_persistence.cpp b/src/Bitmap_cubical_complex/utilities/cubical_complex_persistence.cpp new file mode 100644 index 00000000..9d1bc08c --- /dev/null +++ b/src/Bitmap_cubical_complex/utilities/cubical_complex_persistence.cpp @@ -0,0 +1,80 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Pawel Dlotko + * + * Copyright (C) 2015 INRIA Saclay (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include + +// standard stuff +#include +#include +#include +#include + +int main(int argc, char** argv) { + std::cout + << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical " + << "complexes provided in text files in Perseus style (the only numbered in the first line is a dimension D of a" + << "bitmap. In the lines I between 2 and D+1 there are numbers of top dimensional cells in the direction I. Let " + << "N denote product of the numbers in the lines between 2 and D. In the lines D+2 to D+2+N there are " + << "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; + + 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"; + return 1; + } + + typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base Bitmap_cubical_complex_base; + typedef Gudhi::cubical_complex::Bitmap_cubical_complex Bitmap_cubical_complex; + typedef Gudhi::persistent_cohomology::Field_Zp Field_Zp; + typedef Gudhi::persistent_cohomology::Persistent_cohomology Persistent_cohomology; + + Bitmap_cubical_complex b(argv[1]); + + // Compute the persistence diagram of the complex + Persistent_cohomology pcoh(b); + int p = 11; + double min_persistence = 0; + + pcoh.init_coefficients(p); // initializes the coefficient field for homology + pcoh.compute_persistent_cohomology(min_persistence); + + 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: " << output_file_name << "\n"; + + return 0; +} diff --git a/src/Bitmap_cubical_complex/utilities/periodic_cubical_complex_persistence.cpp b/src/Bitmap_cubical_complex/utilities/periodic_cubical_complex_persistence.cpp new file mode 100644 index 00000000..c812cb3a --- /dev/null +++ b/src/Bitmap_cubical_complex/utilities/periodic_cubical_complex_persistence.cpp @@ -0,0 +1,82 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Pawel Dlotko + * + * Copyright (C) 2015 INRIA Saclay (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include + +// standard stuff +#include +#include +#include +#include + +int main(int argc, char** argv) { + std::cout + << "This program computes persistent homology, by using " + << "Bitmap_cubical_complex_periodic_boundary_conditions class, of cubical complexes provided in text files in " + << "Perseus style (the only numbered in the first line is a dimension D of a bitmap. In the lines I between 2 " + << "and D+1 there are numbers of top dimensional cells in the direction I. Let N denote product of the numbers " + << "in the lines between 2 and D. In the lines D+2 to D+2+N there are 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; + + 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"; + return 1; + } + + typedef Gudhi::cubical_complex::Bitmap_cubical_complex_periodic_boundary_conditions_base Bitmap_base; + typedef Gudhi::cubical_complex::Bitmap_cubical_complex Bitmap_cubical_complex; + + Bitmap_cubical_complex b(argv[1]); + + typedef Gudhi::persistent_cohomology::Field_Zp Field_Zp; + typedef Gudhi::persistent_cohomology::Persistent_cohomology Persistent_cohomology; + // Compute the persistence diagram of the complex + Persistent_cohomology pcoh(b, true); + + int p = 11; + double min_persistence = 0; + pcoh.init_coefficients(p); // initializes the coefficient field for homology + pcoh.compute_persistent_cohomology(min_persistence); + + 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: " << output_file_name << "\n"; + + return 0; +} diff --git a/src/Bottleneck_distance/utilities/CMakeLists.txt b/src/Bottleneck_distance/utilities/CMakeLists.txt index 063b6ae3..d19e3b1c 100644 --- a/src/Bottleneck_distance/utilities/CMakeLists.txt +++ b/src/Bottleneck_distance/utilities/CMakeLists.txt @@ -2,15 +2,15 @@ cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_utilities) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) - add_executable (bottleneck_read_file bottleneck_read_file.cpp) + add_executable (bottleneck_distance bottleneck_distance.cpp) if (TBB_FOUND) - target_link_libraries(bottleneck_read_file ${TBB_LIBRARIES}) + target_link_libraries(bottleneck_distance ${TBB_LIBRARIES}) endif(TBB_FOUND) add_test(NAME Bottleneck_distance_utilities_Bottleneck_read_file - COMMAND $ + COMMAND $ "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/second.pers") - install(TARGETS bottleneck_read_file DESTINATION bin) + install(TARGETS bottleneck_distance DESTINATION bin) endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Bottleneck_distance/utilities/bottleneck_distance.cpp b/src/Bottleneck_distance/utilities/bottleneck_distance.cpp new file mode 100644 index 00000000..9dd52b31 --- /dev/null +++ b/src/Bottleneck_distance/utilities/bottleneck_distance.cpp @@ -0,0 +1,50 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Authors: Francois Godi, small modifications by Pawel Dlotko + * + * Copyright (C) 2015 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include // for pair +#include +#include // 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 the 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> diag1 = Gudhi::read_persistence_intervals_in_dimension(argv[1]); + std::vector> diag2 = Gudhi::read_persistence_intervals_in_dimension(argv[2]); + + double tolerance = std::numeric_limits::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/src/Bottleneck_distance/utilities/bottleneck_read_file.cpp b/src/Bottleneck_distance/utilities/bottleneck_read_file.cpp deleted file mode 100644 index 9dd52b31..00000000 --- a/src/Bottleneck_distance/utilities/bottleneck_read_file.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Authors: Francois Godi, small modifications by Pawel Dlotko - * - * Copyright (C) 2015 INRIA - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#include // for pair -#include -#include // 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 the 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> diag1 = Gudhi::read_persistence_intervals_in_dimension(argv[1]); - std::vector> diag2 = Gudhi::read_persistence_intervals_in_dimension(argv[2]); - - double tolerance = std::numeric_limits::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/src/common/doc/main_page.h b/src/common/doc/main_page.h index 34d3893d..72ef191d 100644 --- a/src/common/doc/main_page.h +++ b/src/common/doc/main_page.h @@ -328,7 +328,7 @@ make doxygen * \li * Bottleneck_distance/bottleneck_basic_example.cpp * \li - * Bottleneck_distance/bottleneck_read_file.cpp + * Bottleneck_distance/bottleneck_distance.cpp * \li * Spatial_searching/example_spatial_searching.cpp * \li @@ -411,9 +411,9 @@ make doxygen * \li * Alpha_complex/weighted_alpha_complex_3d_persistence.cpp * \li - * Bitmap_cubical_complex/Bitmap_cubical_complex.cpp + * Bitmap_cubical_complex/cubical_complex_persistence.cpp * \li - * Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp + * Bitmap_cubical_complex/periodic_cubical_complex_persistence.cpp * \li * Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp * \li @@ -491,9 +491,9 @@ make doxygen * @example Alpha_complex/weighted_alpha_complex_3d_persistence.cpp * @example Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp * @example Bottleneck_distance/bottleneck_basic_example.cpp - * @example Bottleneck_distance/bottleneck_read_file.cpp - * @example Bitmap_cubical_complex/Bitmap_cubical_complex.cpp - * @example Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp + * @example Bottleneck_distance/bottleneck_distance.cpp + * @example Bitmap_cubical_complex/cubical_complex_persistence.cpp + * @example Bitmap_cubical_complex/periodic_cubical_complex_persistence.cpp * @example Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp * @example common/example_CGAL_3D_points_off_reader.cpp * @example common/example_CGAL_points_off_reader.cpp -- cgit v1.2.3 From 50842cbc95006c8ff1a9066fa9431999025c4688 Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 22 Nov 2017 16:34:52 +0000 Subject: b => birth + d => death git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2943 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6ec0292942fcc14c1ef53b8ff9d1182b8f07a287 --- src/Alpha_complex/utilities/README | 346 ++++++++++++++++----------------- src/Bottleneck_distance/example/README | 4 +- src/Rips_complex/utilities/README | 4 +- src/Witness_complex/utilities/README | 8 +- 4 files changed, 181 insertions(+), 181 deletions(-) (limited to 'src') diff --git a/src/Alpha_complex/utilities/README b/src/Alpha_complex/utilities/README index 0d3d6bfc..1cd2ca95 100644 --- a/src/Alpha_complex/utilities/README +++ b/src/Alpha_complex/utilities/README @@ -1,177 +1,177 @@ -# Alpha_complex # - -## `alpha_complex_3d_persistence` ## -This program computes the persistent homology with coefficient field Z/pZ of the 3D alpha complex built from a 3D point cloud. The output diagram contains one bar per line, written with the convention: - -`p dim b d` - -where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). - -**Usage** -`alpha_complex_3d_persistence [options] ` +# Alpha_complex # + +## `alpha_complex_3d_persistence` ## +This program computes the persistent homology with coefficient field Z/pZ of the 3D alpha complex built from a 3D point cloud. The output diagram contains one bar per line, written with the convention: + +`p dim birth death` + +where `dim` is the dimension of the homological feature, `birth` and `death` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). + +**Usage** +`alpha_complex_3d_persistence [options] ` where -`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). - -**Allowed options** - -* `-h [ --help ]` Produce help message -* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. -* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. -* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. - -**Example** -`alpha_complex_3d_persistence ../../data/points/tore3D_300.off -p 2 -m 0.45` - -outputs: -``` -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` only accepts OFF files in dimension 3. -* Filtration values are alpha square values. - - - -## `exact_alpha_complex_3d_persistence` ## -Same as `alpha_complex_3d_persistence`, but using exact computation. It is slower, but it is necessary when points are on a grid for instance. - - - -## `weighted_alpha_complex_3d_persistence` ## -Same as `alpha_complex_3d_persistence`, but using weighted points. - -**Usage** -`weighted_alpha_complex_3d_persistence [options] ` +`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). + +**Allowed options** + +* `-h [ --help ]` Produce help message +* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. +* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. +* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. + +**Example** +`alpha_complex_3d_persistence ../../data/points/tore3D_300.off -p 2 -m 0.45` + +outputs: +``` +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` only accepts OFF files in dimension 3. +* Filtration values are alpha square values. + + + +## `exact_alpha_complex_3d_persistence` ## +Same as `alpha_complex_3d_persistence`, but using exact computation. It is slower, but it is necessary when points are on a grid for instance. + + + +## `weighted_alpha_complex_3d_persistence` ## +Same as `alpha_complex_3d_persistence`, but using weighted points. + +**Usage** +`weighted_alpha_complex_3d_persistence [options] ` +where +`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). +`` is the path to the file containing the weights of the points (one value per line). + +**Allowed options** + +* `-h [ --help ]` Produce help message +* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. +* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. +* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. + +**Example** +`weighted_alpha_complex_3d_persistence ../../data/points/tore3D_300.off ../../data/points/tore3D_300.weights -p 2 -m 0.45` + +outputs: +``` +Simplex_tree dim: 3 +2 0 -1 inf +2 1 -0.931784 0.000103311 +2 1 -0.906588 2.60165e-05 +2 2 -0.43556 0.0393798 +``` + +N.B.: +* Weights values are explained on CGAL [Alpha shape](https://doc.cgal.org/latest/Alpha_shapes_3/index.html#title0) +and [Regular triangulation](https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation3secclassRegulartriangulation) documentation. +* Filtration values are alpha square values. + + +## `periodic_alpha_complex_3d_persistence` ## +Same as `alpha_complex_3d_persistence`, but using periodic alpha shape 3d. +Refer to the [CGAL's 3D Periodic Triangulations User Manual](https://doc.cgal.org/latest/Periodic_3_triangulation_3/index.html) for more details. + +**Usage** +`periodic_alpha_complex_3d_persistence [options] ` where `` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). -`` is the path to the file containing the weights of the points (one value per line). - -**Allowed options** - -* `-h [ --help ]` Produce help message -* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. -* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. -* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. - -**Example** -`weighted_alpha_complex_3d_persistence ../../data/points/tore3D_300.off ../../data/points/tore3D_300.weights -p 2 -m 0.45` - -outputs: -``` -Simplex_tree dim: 3 -2 0 -1 inf -2 1 -0.931784 0.000103311 -2 1 -0.906588 2.60165e-05 -2 2 -0.43556 0.0393798 -``` - -N.B.: -* Weights values are explained on CGAL [Alpha shape](https://doc.cgal.org/latest/Alpha_shapes_3/index.html#title0) -and [Regular triangulation](https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation3secclassRegulartriangulation) documentation. -* Filtration values are alpha square values. - - -## `periodic_alpha_complex_3d_persistence` ## -Same as `alpha_complex_3d_persistence`, but using periodic alpha shape 3d. -Refer to the [CGAL's 3D Periodic Triangulations User Manual](https://doc.cgal.org/latest/Periodic_3_triangulation_3/index.html) for more details. - -**Usage** -`periodic_alpha_complex_3d_persistence [options] ` -where -`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). -`` is the path to the file describing the periodic domain. It must be in the format described [here](http://gudhi.gforge.inria.fr/doc/latest/fileformats.html#FileFormatsIsoCuboid). - -**Allowed options** - -* `-h [ --help ]` Produce help message -* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. -* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. -* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals - - -**Example** -`periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off ../../data/points/iso_cuboid_3_in_0_1.txt -p 3 -m 1.0` - -outputs: -``` -Periodic Delaunay computed. -Simplex_tree dim: 3 -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 an 3D iso-oriented cuboids: -``` -Betti numbers[0] = 1 -Betti numbers[1] = 3 -Betti numbers[2] = 3 -Betti numbers[3] = 1 -``` - -N.B.: -* Cuboid file must be in the format described [here](http://gudhi.gforge.inria.fr/doc/latest/fileformats.html#FileFormatsIsoCuboid). -* Filtration values are alpha square values. - - - - -## `alpha_complex_persistence` ## -This program computes the persistent homology with coefficient field Z/pZ of the dD alpha complex built from a dD point cloud. The output diagram contains one bar per line, written with the convention: - -`p dim b d` - -where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). - -**Usage** -`alpha_complex_persistence [options] ` +`` is the path to the file describing the periodic domain. It must be in the format described [here](http://gudhi.gforge.inria.fr/doc/latest/fileformats.html#FileFormatsIsoCuboid). + +**Allowed options** + +* `-h [ --help ]` Produce help message +* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. +* `-p [ --field-charac ]` (default=11) Characteristic p of the coefficient field Z/pZ for computing homology. +* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals + + +**Example** +`periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off ../../data/points/iso_cuboid_3_in_0_1.txt -p 3 -m 1.0` + +outputs: +``` +Periodic Delaunay computed. +Simplex_tree dim: 3 +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 an 3D iso-oriented cuboids: +``` +Betti numbers[0] = 1 +Betti numbers[1] = 3 +Betti numbers[2] = 3 +Betti numbers[3] = 1 +``` + +N.B.: +* Cuboid file must be in the format described [here](http://gudhi.gforge.inria.fr/doc/latest/fileformats.html#FileFormatsIsoCuboid). +* Filtration values are alpha square values. + + + + +## `alpha_complex_persistence` ## +This program computes the persistent homology with coefficient field Z/pZ of the dD alpha complex built from a dD point cloud. The output diagram contains one bar per line, written with the convention: + +`p dim birth death` + +where `dim` is the dimension of the homological feature, `birth` and `death` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). + +**Usage** +`alpha_complex_persistence [options] ` where -`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). - -**Allowed options** - -* `-h [ --help ]` Produce help message -* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. -* `-r [ --max-alpha-square-value ]` (default = inf) Maximal alpha square value for the Alpha complex construction. -* `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology. -* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. - -**Example** -`alpha_complex_persistence -r 32 -p 2 -m 0.45 ../../data/points/tore3D_300.off` - -outputs: -``` -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.: -* Filtration values are alpha square values. +`` is the path to the input point cloud in [nOFF ASCII format](http://www.geomview.org/docs/html/OFF.html). + +**Allowed options** + +* `-h [ --help ]` Produce help message +* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. +* `-r [ --max-alpha-square-value ]` (default = inf) Maximal alpha square value for the Alpha complex construction. +* `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology. +* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. + +**Example** +`alpha_complex_persistence -r 32 -p 2 -m 0.45 ../../data/points/tore3D_300.off` + +outputs: +``` +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.: +* Filtration values are alpha square values. diff --git a/src/Bottleneck_distance/example/README b/src/Bottleneck_distance/example/README index 0e314608..01bcd74a 100644 --- a/src/Bottleneck_distance/example/README +++ b/src/Bottleneck_distance/example/README @@ -3,9 +3,9 @@ ## `alpha_rips_persistence_bottleneck_distance` ## This program computes the persistent homology with coefficient field Z/pZ of a Rips complex defined on a set of input points. The output diagram contains one bar per line, written with the convention: -`p dim b d` +`p dim birth death` -where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients. +where `dim` is the dimension of the homological feature, `birth` and `death` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients. Usage: `alpha_rips_persistence_bottleneck_distance [options] ` diff --git a/src/Rips_complex/utilities/README b/src/Rips_complex/utilities/README index ca10424d..c839a5f4 100644 --- a/src/Rips_complex/utilities/README +++ b/src/Rips_complex/utilities/README @@ -3,9 +3,9 @@ ## `rips_persistence` ## This program computes the persistent homology with coefficient field *Z/pZ* of a Rips complex defined on a set of input points. The output diagram contains one bar per line, written with the convention: -`p dim b d` +`p dim birth death` -where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). +where `dim` is the dimension of the homological feature, `birth` and `death` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients (`p` must be a prime number). **Usage** `rips_persistence [options] ` diff --git a/src/Witness_complex/utilities/README b/src/Witness_complex/utilities/README index d8dc9ca7..952d4983 100644 --- a/src/Witness_complex/utilities/README +++ b/src/Witness_complex/utilities/README @@ -3,9 +3,9 @@ ## `weak_witness_persistence` ## This program computes the persistent homology with coefficient field *Z/pZ* of a Weak witness complex defined on a set of input points. The output diagram contains one bar per line, written with the convention: -`p dim b d` +`p dim birth death` -where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients. +where `dim` is the dimension of the homological feature, `birth` and `death` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients. *Usage* `weak_witness_persistence [options] ` @@ -39,9 +39,9 @@ N.B.: output is random as the 20 landmarks are chosen randomly. ## `strong_witness_persistence` ## This program computes the persistent homology with coefficient field *Z/pZ* of a Strong witness complex defined on a set of input points. The output diagram contains one bar per line, written with the convention: -`p dim b d` +`p dim birth death` -where `dim` is the dimension of the homological feature, `b` and `d` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients. +where `dim` is the dimension of the homological feature, `birth` and `death` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients. *Usage* `strong_witness_persistence [options] ` -- cgit v1.2.3 From 5a4e31ee8607b54e81b1a64faaa8ce42f0309690 Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 22 Nov 2017 16:51:57 +0000 Subject: Add precisions git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2944 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7017c186aaad9702b72886348e5bfefa5a17160f --- src/Rips_complex/utilities/README | 2 ++ src/Witness_complex/utilities/README | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/Rips_complex/utilities/README b/src/Rips_complex/utilities/README index c839a5f4..1a6f2b95 100644 --- a/src/Rips_complex/utilities/README +++ b/src/Rips_complex/utilities/README @@ -19,6 +19,8 @@ where `dim` is the dimension of the homological feature, `birth` and `death` are * `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology. * `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. +Beware: this program may use a lot of RAM and take a lot of time if `max-edge-length` is set to a large value. + **Example 1 with Z/2Z coefficients** `rips_persistence ../../data/points/tore3D_1307.off -r 0.25 -m 0.5 -d 3 -p 2` diff --git a/src/Witness_complex/utilities/README b/src/Witness_complex/utilities/README index 952d4983..1141033e 100644 --- a/src/Witness_complex/utilities/README +++ b/src/Witness_complex/utilities/README @@ -1,5 +1,7 @@ # Witness_complex # +For more details about the witness complex, please read the [user manual of the package](http://gudhi.gforge.inria.fr/doc/latest/group__witness__complex.html). + ## `weak_witness_persistence` ## This program computes the persistent homology with coefficient field *Z/pZ* of a Weak witness complex defined on a set of input points. The output diagram contains one bar per line, written with the convention: -- cgit v1.2.3 From 32324d2b6ef2d7a4dd1c75e6f09c725eadc5145a Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 24 Nov 2017 07:50:59 +0000 Subject: Add link git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2948 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e41794c0552552f14afe81ead6df3530f02bd388 --- src/Bitmap_cubical_complex/utilities/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Bitmap_cubical_complex/utilities/README b/src/Bitmap_cubical_complex/utilities/README index e7c10083..1d6b34ff 100644 --- a/src/Bitmap_cubical_complex/utilities/README +++ b/src/Bitmap_cubical_complex/utilities/README @@ -1,7 +1,7 @@ # Bitmap_cubical_complex # ## `cubical_complex_persistence` ## -This program computes persistent homology, by using the Bitmap_cubical_complex class, of cubical complexes provided in text files in Perseus style. The only number in the first line is a dimension D of a bitmap. In the lines I between 2 and D+1 there are numbers of top dimensional cells in the direction I. Let N denote product of the numbers in the lines between 2 and D. In the lines D+2 to D+2+N there are filtrations of top dimensional cells. We assume that the cells are in the lexicographical order. +This program computes persistent homology, by using the Bitmap_cubical_complex class, of cubical complexes provided in text files in Perseus style. See the "Input Format" section of the [User Manual](http://gudhi.gforge.inria.fr/doc/latest/group__cubical__complex.html) for a description of the file format. Example: -- cgit v1.2.3 From f1691997a3f6eceab45256ce4a94a9aa64d92471 Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 24 Nov 2017 08:10:28 +0000 Subject: Move Perseus file format to file_formats.h git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2949 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e2f0dcf1efdc3c26ff609b7a14d37a604a9c162f --- .../doc/Gudhi_Cubical_Complex_doc.h | 49 ++-------------------- src/common/doc/file_formats.h | 49 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h index daba15a4..56b62e92 100644 --- a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h +++ b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h @@ -91,31 +91,8 @@ namespace cubical_complex { * filtration to all cubes. There are a number of constructors that can be used to construct cubical complex by users * who want to use the code directly. They can be found in the \a Bitmap_cubical_complex class. * Currently one input from a text file is used. It uses a format used already in Perseus software - * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. - * Below we are providing a description of the format. The first line contains a number d begin the dimension of the - * bitmap (2 in the example below). Next d lines are the numbers of top dimensional cubes in each dimensions (3 and 3 - * in the example below). Next, in lexicographical order, the filtration of top dimensional cubes is given (1 4 6 8 - * 20 4 7 6 5 in the example below). - * - * - * \image html "exampleBitmap.png" "Example of a input data." - * - * The input file for the following complex is: - * \verbatim -2 -3 -3 -1 -4 -6 -8 -20 -4 -7 -6 -5 -\endverbatim - + * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. The file format is described here: \ref FileFormatsPerseus. + * * \section PeriodicBoundaryConditions Periodic boundary conditions * Often one would like to impose periodic boundary conditions to the cubical complex. Let \f$ I_1\times ... \times * I_n \f$ be a box that is decomposed with a cubical complex \f$ \mathcal{K} \f$. Imposing periodic boundary @@ -123,26 +100,8 @@ namespace cubical_complex { * considered the same. In particular, if for a bitmap \f$ \mathcal{K} \f$ periodic boundary conditions are imposed * in all directions, then complex \f$ \mathcal{K} \f$ became n-dimensional torus. One can use various constructors * from the file Bitmap_cubical_complex_periodic_boundary_conditions_base.h to construct cubical complex with periodic - * boundary conditions. One can also use Perseus style input files. To indicate periodic boundary conditions in a - * given direction, then number of top dimensional cells in this direction have to be multiplied by -1. For instance: - - *\verbatim -2 --3 -3 -1 -4 -6 -8 -20 -4 -7 -6 -5 -\endverbatim - - * Indicate that we have imposed periodic boundary conditions in the direction x, but not in the direction y. - + * boundary conditions. One can also use Perseus style input files (see \ref FileFormatsPerseus). + * * \section BitmapExamples Examples * End user programs are available in example/Bitmap_cubical_complex and utilities/Bitmap_cubical_complex folders. * diff --git a/src/common/doc/file_formats.h b/src/common/doc/file_formats.h index 069b19d1..d06b81f5 100644 --- a/src/common/doc/file_formats.h +++ b/src/common/doc/file_formats.h @@ -68,6 +68,55 @@ namespace Gudhi { -1. -1. -1. 1. 1. 1. \endverbatim + + + \section FileFormatsPerseus Perseus + + This file format is the format used by the Perseus software + (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. + The first line contains a number d begin the dimension of the + bitmap (2 in the example below). Next d lines are the numbers of top dimensional cubes in each dimensions (3 and 3 + in the example below). Next, in lexicographical order, the filtration of top dimensional cubes is given (1 4 6 8 + 20 4 7 6 5 in the example below). + + \image html "exampleBitmap.png" "Example of a input data." + + The input file for the following complex is: + \verbatim + 2 + 3 + 3 + 1 + 4 + 6 + 8 + 20 + 4 + 7 + 6 + 5 + \endverbatim + + To indicate periodic boundary conditions in a + given direction, then number of top dimensional cells in this direction have to be multiplied by -1. For instance: + + \verbatim + 2 + -3 + 3 + 1 + 4 + 6 + 8 + 20 + 4 + 7 + 6 + 5 + \endverbatim + + Indicate that we have imposed periodic boundary conditions in the direction x, but not in the direction y. + */ } // namespace Gudhi -- cgit v1.2.3 From 82ef91226635da17bda03b5581f0740de3282ab6 Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 24 Nov 2017 08:10:47 +0000 Subject: Describe CSV matrix file git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2950 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: bfad995548f0336c38da0de9c04f5eeaafd67570 --- src/Rips_complex/utilities/README | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Rips_complex/utilities/README b/src/Rips_complex/utilities/README index 1a6f2b95..4d20c806 100644 --- a/src/Rips_complex/utilities/README +++ b/src/Rips_complex/utilities/README @@ -48,7 +48,12 @@ outputs: ## `rips_distance_matrix_persistence` ## -Same as `rips_persistence` but taking a distance matrix as input. +Same as `rips_persistence` but taking a distance matrix as input. + +**Usage** +`rips_persistence [options] ` +where +`` is the path to the file containing a distance matrix. Can be square or lower triangular matrix. Separator is ';'. **Example** `rips_distance_matrix_persistence data/distance_matrix/full_square_distance_matrix.csv -r 15 -d 3 -p 3 -m 0` -- cgit v1.2.3 From ba46489948592fb633ec0fa755c602921f7d425b Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 24 Nov 2017 08:11:52 +0000 Subject: Typos git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2951 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 87f3b4861218ca91630bba3a83038325636f6dc9 --- src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h index 56b62e92..ee84e201 100644 --- a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h +++ b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h @@ -63,7 +63,7 @@ namespace cubical_complex { * For further details and theory of cubical complexes, please consult \cite kaczynski2004computational as well as the * following paper \cite peikert2012topological . * - * \section cubicalcomplexdatastructure Data structure. + * \section cubicalcomplexdatastructure Data structure * * The implementation of Cubical complex provides a representation of complexes that occupy a rectangular region in * \f$\mathbb{R}^n\f$. This extra assumption allows for a memory efficient way of storing cubical complexes in a form @@ -85,7 +85,7 @@ namespace cubical_complex { * present in the product that gives the cube \f$C\f$. In a similar way, we can compute boundary and the coboundary of * each cube. Further details can be found in the literature. * - * \section inputformat Input Format. + * \section inputformat Input Format * * In the current implantation, filtration is given at the maximal cubes, and it is then extended by the lower star * filtration to all cubes. There are a number of constructors that can be used to construct cubical complex by users -- cgit v1.2.3 From 86f7c676f094e44d4c06392c452b372f4470099b Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 24 Nov 2017 08:15:49 +0000 Subject: Update link git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2952 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 72ac475a06eeb1752e747f2ca8f7c5ae20389cc3 --- src/Bitmap_cubical_complex/utilities/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Bitmap_cubical_complex/utilities/README b/src/Bitmap_cubical_complex/utilities/README index 1d6b34ff..ddff7034 100644 --- a/src/Bitmap_cubical_complex/utilities/README +++ b/src/Bitmap_cubical_complex/utilities/README @@ -1,7 +1,7 @@ # Bitmap_cubical_complex # ## `cubical_complex_persistence` ## -This program computes persistent homology, by using the Bitmap_cubical_complex class, of cubical complexes provided in text files in Perseus style. See the "Input Format" section of the [User Manual](http://gudhi.gforge.inria.fr/doc/latest/group__cubical__complex.html) for a description of the file format. +This program computes persistent homology, by using the Bitmap_cubical_complex class, of cubical complexes provided in text files in Perseus style. See [here](http://gudhi.gforge.inria.fr/doc/latest/fileformats.html#FileFormatsPerseus) for a description of the file format. Example: -- cgit v1.2.3