From 3ae2a05fea03ad51cf9e43a48e67dce89b58875d Mon Sep 17 00:00:00 2001 From: pdlotko Date: Thu, 20 Sep 2018 09:14:30 +0000 Subject: Fix to the documentation: to remove confusion with the perseus format. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cubical_complex_small_fix@3899 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6d600838396236ca95346719058bd8b834541814 --- src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Bitmap_cubical_complex') 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 d1836ef0..0c70c6e0 100644 --- a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h +++ b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h @@ -90,8 +90,11 @@ namespace cubical_complex { * 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 * 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. The file format is described here: \ref FileFormatsPerseus. + * Currently one input from a text file is used. It uses a format nspired from the Perseus software + * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. Note however an important difference: while Perseus assume + * the filtration of all maximal cubes to be non-negative, over here we do not enforce this and we allow any filtration values. + * As a consequence one cannot use -1's to indicate missing cubes. If you have missing cubes in your complex, please set + * their filtration to +Inf. The file format is described in details in 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 -- cgit v1.2.3 From e1b61dcdae35e0f968846fdd919d43b84f29fe4e Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 17 Jan 2019 16:19:05 +0000 Subject: Fix cpplint git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cubical_complex_small_fix@4063 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7186509b0d722fc7a4264eeaf504cef1c1be3a2a --- src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h | 9 +++++---- src/common/doc/file_formats.h | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Bitmap_cubical_complex') 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 0c70c6e0..9e14455e 100644 --- a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h +++ b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h @@ -91,10 +91,11 @@ 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 nspired from the Perseus software - * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. Note however an important difference: while Perseus assume - * the filtration of all maximal cubes to be non-negative, over here we do not enforce this and we allow any filtration values. - * As a consequence one cannot use -1's to indicate missing cubes. If you have missing cubes in your complex, please set - * their filtration to +Inf. The file format is described in details in here: \ref FileFormatsPerseus. + * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. Note however an important difference: while Perseus + * assume the filtration of all maximal cubes to be non-negative, over here we do not enforce this and we allow any + * filtration values. + * As a consequence one cannot use -1's to indicate missing cubes. If you have missing cubes in your complex, please + * set their filtration to +Inf. The file format is described in details in 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 diff --git a/src/common/doc/file_formats.h b/src/common/doc/file_formats.h index 3a236087..d38d90e0 100644 --- a/src/common/doc/file_formats.h +++ b/src/common/doc/file_formats.h @@ -119,8 +119,9 @@ namespace Gudhi { Other sample files can be found in the `data/bitmap` folder. - Please note that unlike in Perseus format the filtration on the maximal cubes can be any double precision number. - Consequently one cannot mark the cubes that are not present with -1's. To do that please set their filtration value to +Inf. + Please note that unlike in Perseus format the filtration on the maximal cubes can be any double precision number. + Consequently one cannot mark the cubes that are not present with -1's. To do that please set their filtration value to + +Inf. */ } // namespace Gudhi -- cgit v1.2.3 From 644076d6f2de7d91a7694c94261c59da14264cd5 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 17 Jan 2019 17:14:20 +0000 Subject: Fix issue #5 : [Bitmap_cubical_complex] Perseus file reader rejects infinity git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cubical_complex_small_fix@4064 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 77ec6d5d1f69ba3e1b0a1027d902084bb25d08f3 --- .../include/gudhi/Bitmap_cubical_complex_base.h | 37 +++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'src/Bitmap_cubical_complex') diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h index 9b74e267..f5e005b2 100644 --- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h +++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h @@ -650,18 +650,33 @@ void Bitmap_cubical_complex_base::read_perseus_style_file(const char* perseus Bitmap_cubical_complex_base::Top_dimensional_cells_iterator it(*this); it = this->top_dimensional_cells_iterator_begin(); - T filtrationLevel; - for (std::size_t i = 0; i < dimensions; ++i) { - if (!(inFiltration >> filtrationLevel) || (inFiltration.eof())) { - throw std::ios_base::failure("Bad Perseus file format."); - } - if (dbg) { - std::cerr << "Cell of an index : " << it.compute_index_in_bitmap() - << " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap()) - << " get the value : " << filtrationLevel << std::endl; + T filtrationLevel = 0.; + std::size_t filtration_counter = 0; + while (!inFiltration.eof()) { + std::string line; + getline(inFiltration, line); + if (line.length() != 0) { + int n = sscanf(line.c_str(), "%lf", &filtrationLevel); + if (n != 1) { + std::string perseus_error("Bad Perseus file format. This line is incorrect : " + line); + throw std::ios_base::failure(perseus_error.c_str()); + } + + if (dbg) { + std::cerr << "Cell of an index : " << it.compute_index_in_bitmap() + << " and dimension: " << this->get_dimension_of_a_cell(it.compute_index_in_bitmap()) + << " get the value : " << filtrationLevel << std::endl; + } + this->get_cell_data(*it) = filtrationLevel; + ++it; + ++filtration_counter; } - this->get_cell_data(*it) = filtrationLevel; - ++it; + } + + if (filtration_counter != dimensions) { + std::string perseus_error("Bad Perseus file format. Read " + std::to_string(filtration_counter) + " expected " + \ + std::to_string(dimensions) + " values"); + throw std::ios_base::failure(perseus_error.c_str()); } inFiltration.close(); -- cgit v1.2.3 From 7eda6217fddd1902b8dd9ef0b422f8380c50d041 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Feb 2019 08:34:04 +0000 Subject: Fix doc typo git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cubical_complex_small_fix@4099 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b9987650ddf369c58b46955de6af9cd2d94831b3 --- src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Bitmap_cubical_complex') 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 9e14455e..e1e5885e 100644 --- a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h +++ b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h @@ -90,7 +90,7 @@ namespace cubical_complex { * 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 * 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 nspired from the Perseus software + * Currently one input from a text file is used. It uses a format inspired from the Perseus software * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. Note however an important difference: while Perseus * assume the filtration of all maximal cubes to be non-negative, over here we do not enforce this and we allow any * filtration values. -- cgit v1.2.3 From b1843507262c7c0d9831ebbeb2f43f43093aa15d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Feb 2019 12:20:25 +0000 Subject: Add unitary test for inf value read git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cubical_complex_small_fix@4100 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5cdac452d9c79cf63c62ec1382de4140a719286f --- data/bitmap/sinusoid.txt | 77 +++++++++++++++++++++++++ src/Bitmap_cubical_complex/test/Bitmap_test.cpp | 15 +++++ src/Bitmap_cubical_complex/test/CMakeLists.txt | 3 + 3 files changed, 95 insertions(+) create mode 100644 data/bitmap/sinusoid.txt (limited to 'src/Bitmap_cubical_complex') diff --git a/data/bitmap/sinusoid.txt b/data/bitmap/sinusoid.txt new file mode 100644 index 00000000..4318a790 --- /dev/null +++ b/data/bitmap/sinusoid.txt @@ -0,0 +1,77 @@ +1 +75 +10.0 +inf +6.581647338757176 +4.961839035093842 +3.4462687716225506 +2.0647730896031224 +0.843170409296631 +-0.19751272994853286 +-1.041671820306659 +-1.679592041609764 +-2.1077394076819154 +-2.3288666774217717 +-2.351930856552615 +-2.1918247624544565 +-1.8689306968915753 +-1.4085096027502502 +-0.8399440113300294 +-0.19585746852629526 +0.4888631699173285 +1.178113272962392 +1.835652464698967 +2.4261907229474 +2.916445996426541 +3.2761416444450404 +3.47891380654902 +3.503101508895332 +3.332395828417585 +2.956328659790991 +2.3705864371935323 +1.5771394088427577 +0.5841825900410704 +-0.5941098356746579 +-1.9380093068542301 +-3.4228241352585 +-5.019639498406313 +-6.696183996487342 +-8.417796803538899 +-10.148466428045634 +-11.851909952036825 +-13.492660404643832 +-15.037129682296172 +-16.454615160584872 +-17.71821983034286 +-18.80565838211054 +-19.699925081201553 +-20.389803417622236 +-20.870202256994908 +-21.142308418277846 +-21.213551105635062 +-21.0973792604076 +-20.812858505791425 +-20.38409976350673 +-19.839536666415423 +-19.211073422523185 +-18.53312866828296 +-17.841603966244676 +-17.172807860451854 +-16.562367734888753 +-16.044162085815913 +-15.649305207041936 +-15.405214716400426 +-15.334789869008524 +-15.455725282681154 +-15.779980642668242 +-16.3134222782912 +-17.055647353175157 +-17.999995937972063 +-19.13375060376363 +-20.438517554470188 +-21.890777875994743 +-23.46259238155293 +-25.122438929469578 +-26.836157119615592 +-28.567972056597156 +-30.281566498233445 diff --git a/src/Bitmap_cubical_complex/test/Bitmap_test.cpp b/src/Bitmap_cubical_complex/test/Bitmap_test.cpp index ca7bd986..6a917c25 100644 --- a/src/Bitmap_cubical_complex/test/Bitmap_test.cpp +++ b/src/Bitmap_cubical_complex/test/Bitmap_test.cpp @@ -32,6 +32,7 @@ #include #include #include +#include typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base Bitmap_cubical_complex_base; typedef Gudhi::cubical_complex::Bitmap_cubical_complex Bitmap_cubical_complex; @@ -1576,3 +1577,17 @@ BOOST_AUTO_TEST_CASE(compute_incidence_between_cells_test_periodic_boundary_cond } } } + +BOOST_AUTO_TEST_CASE(perseus_file_read) { + Bitmap_cubical_complex increasing("sinusoid.txt"); + + auto it = increasing.top_dimensional_cells_iterator_begin(); + double value = increasing.get_cell_data(*it); + std::cout << "First value of sinusoid.txt is " << value << std::endl; + BOOST_CHECK(value == 10.); + // Next value + ++it; + value = increasing.get_cell_data(*it); + std::cout << "Second value of sinusoid.txt is " << value << std::endl; + BOOST_CHECK(value == std::numeric_limits::infinity()); +} diff --git a/src/Bitmap_cubical_complex/test/CMakeLists.txt b/src/Bitmap_cubical_complex/test/CMakeLists.txt index 8b43632a..d2f002a6 100644 --- a/src/Bitmap_cubical_complex/test/CMakeLists.txt +++ b/src/Bitmap_cubical_complex/test/CMakeLists.txt @@ -2,6 +2,9 @@ project(Bitmap_cubical_complex_tests) include(GUDHI_test_coverage) +# Do not forget to copy test files in current binary dir +file(COPY "${CMAKE_SOURCE_DIR}/data/bitmap/sinusoid.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) + add_executable ( Bitmap_cubical_complex_test_unit Bitmap_test.cpp ) target_link_libraries(Bitmap_cubical_complex_test_unit ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) if (TBB_FOUND) -- cgit v1.2.3 From f29a6e9a03dca95dc0a070b604fb11e18897a6f6 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 12 Feb 2019 14:08:56 +0000 Subject: Fix doc for C++ and Python. Fix some warnings on Nerve GIC sphinx doc generation git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cubical_complex_small_fix@4101 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 57eacb8c4108be212e61796c65e3b45bb9c13644 --- src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h | 13 +++++++------ src/common/doc/file_formats.h | 8 ++++---- src/cython/doc/cubical_complex_user.rst | 10 ++++++++-- src/cython/doc/fileformats.rst | 10 +++++++++- src/cython/doc/nerve_gic_complex_ref.rst | 4 ++++ src/cython/doc/nerve_gic_complex_user.rst | 4 ++++ 6 files changed, 36 insertions(+), 13 deletions(-) (limited to 'src/Bitmap_cubical_complex') 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 e1e5885e..5fa02a5e 100644 --- a/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h +++ b/src/Bitmap_cubical_complex/doc/Gudhi_Cubical_Complex_doc.h @@ -87,15 +87,16 @@ namespace cubical_complex { * * \section inputformat Input Format * - * In the current implantation, filtration is given at the maximal cubes, and it is then extended by the lower star + * In the current implementation, 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 * 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 inspired from the Perseus software - * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. Note however an important difference: while Perseus - * assume the filtration of all maximal cubes to be non-negative, over here we do not enforce this and we allow any - * filtration values. - * As a consequence one cannot use -1's to indicate missing cubes. If you have missing cubes in your complex, please - * set their filtration to +Inf. The file format is described in details in here: \ref FileFormatsPerseus. + * (http://www.sas.upenn.edu/~vnanda/perseus/) by Vidit Nanda. + * \note While Perseus assume the filtration of all maximal cubes to be non-negative, over here we do not enforce this + * and we allow any filtration values. As a consequence one cannot use `-1`'s to indicate missing cubes. If you have + * missing cubes in your complex, please set their filtration to \f$+\infty\f$ (aka. `inf` in the file). + * + * The file format is described in details in \ref FileFormatsPerseus file format section. * * \section PeriodicBoundaryConditions Periodic boundary conditions * Often one would like to impose periodic boundary conditions to the cubical complex. Let \f$ I_1\times ... \times diff --git a/src/common/doc/file_formats.h b/src/common/doc/file_formats.h index d38d90e0..23214e25 100644 --- a/src/common/doc/file_formats.h +++ b/src/common/doc/file_formats.h @@ -72,7 +72,7 @@ namespace Gudhi { \section FileFormatsPerseus Perseus - This file format is the format used by the Perseus software + This file format is a format inspired from 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 @@ -119,9 +119,9 @@ namespace Gudhi { Other sample files can be found in the `data/bitmap` folder. - Please note that unlike in Perseus format the filtration on the maximal cubes can be any double precision number. - Consequently one cannot mark the cubes that are not present with -1's. To do that please set their filtration value to - +Inf. + \note Unlike in Perseus format the filtration on the maximal cubes can be any double precision number. + Consequently one cannot mark the cubes that are not present with `-1`'s. To do that please set their filtration value + to \f$+\infty\f$ (aka. `inf` in the file). */ } // namespace Gudhi diff --git a/src/cython/doc/cubical_complex_user.rst b/src/cython/doc/cubical_complex_user.rst index 320bd79b..19120360 100644 --- a/src/cython/doc/cubical_complex_user.rst +++ b/src/cython/doc/cubical_complex_user.rst @@ -83,9 +83,15 @@ 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 who want to use the code directly. They can be found in the :doc:`cubical_complex_ref`. -Currently one input from a text file is used. It uses a format used already in +Currently one input from a text file is used. It uses a format inspired from the Perseus software `Perseus software `_ by Vidit Nanda. -The file format is described here: :doc:`Perseus `. + +.. note:: + While Perseus assume the filtration of all maximal cubes to be non-negative, over here we do not enforce this and + we allow any filtration values. As a consequence one cannot use ``-1``'s to indicate missing cubes. If you have + missing cubes in your complex, please set their filtration to :math:`+\infty` (aka. ``inf`` in the file). + +The file format is described in details in :ref:`Perseus file format` file format section. .. testcode:: diff --git a/src/cython/doc/fileformats.rst b/src/cython/doc/fileformats.rst index ff20f26e..e205cc8b 100644 --- a/src/cython/doc/fileformats.rst +++ b/src/cython/doc/fileformats.rst @@ -51,10 +51,12 @@ Here is a simple sample file in the 3D case:: 1. 1. 1. +.. _Perseus file format: + Perseus ******* -This file format is the format used by the +This file format is a format inspired from the `Perseus software `_ 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 @@ -88,3 +90,9 @@ Indicate that we have imposed periodic boundary conditions in the direction x, but not in the direction y. Other sample files can be found in the `data/bitmap` folder. + +.. note:: + Unlike in Perseus format the filtration on the maximal cubes can be any + double precision number. Consequently one cannot mark the cubes that are + not present with ``-1``'s. To do that please set their filtration value to + :math:`+\infty` (aka. ``inf`` in the file). \ No newline at end of file diff --git a/src/cython/doc/nerve_gic_complex_ref.rst b/src/cython/doc/nerve_gic_complex_ref.rst index e24e01fc..abde2e8c 100644 --- a/src/cython/doc/nerve_gic_complex_ref.rst +++ b/src/cython/doc/nerve_gic_complex_ref.rst @@ -1,3 +1,7 @@ +:orphan: + +.. To get rid of WARNING: document isn't included in any toctree + ================================ Cover complexes reference manual ================================ diff --git a/src/cython/doc/nerve_gic_complex_user.rst b/src/cython/doc/nerve_gic_complex_user.rst index d774827e..44f30e1a 100644 --- a/src/cython/doc/nerve_gic_complex_user.rst +++ b/src/cython/doc/nerve_gic_complex_user.rst @@ -1,3 +1,7 @@ +:orphan: + +.. To get rid of WARNING: document isn't included in any toctree + Cover complexes user manual =========================== Definition -- cgit v1.2.3