From 9b4c31ef855bf5c98718675a9caab52e8d8514e7 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 5 Aug 2016 09:58:11 +0000 Subject: Fix the 3 billions of simplices limit Add some comment and documentation about the new limit (4 billions) Rephrase third party library installation documentation git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/3billions_simplices_fix@1420 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 95b20677e455b61578da74aabbd3764b4a27816d --- .../test/persistent_cohomology_unit_test.cpp | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp') diff --git a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp index 5c54ed5f..530e7092 100644 --- a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp +++ b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp @@ -4,6 +4,7 @@ #include // std::pair, std::make_pair #include // float comparison #include +#include // for std::uint8_t #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "persistent_cohomology" @@ -172,3 +173,44 @@ BOOST_AUTO_TEST_CASE( rips_persistent_cohomology_single_field_dim_5 ) // std::string str_rips_persistence = test_rips_persistence(6, 0); // TODO(VR): division by zero // std::string str_rips_persistence = test_rips_persistence(0, 0); + +/** SimplexTree minimal options to test the limits. + * + * Maximum number of simplices to compute persistence is std::numeric_limits::max()<\CODE> = 256.*/ +struct MiniSTOptions { + typedef linear_indexing_tag Indexing_tag; + typedef short Vertex_handle; + typedef double Filtration_value; + typedef std::uint8_t Simplex_key; + static const bool store_key = true; + static const bool store_filtration = false; + static const bool contiguous_vertices = false; +}; + +using Mini_simplex_tree = Gudhi::Simplex_tree; +using Mini_st_persistence = + Gudhi::persistent_cohomology::Persistent_cohomology; + +BOOST_AUTO_TEST_CASE( persistence_constructor_exception ) +{ + Mini_simplex_tree st; + + // To make number of simplices = 255 + const short simplex_0[] = {0, 1, 2, 3, 4, 5, 6, 7}; + st.insert_simplex_and_subfaces(simplex_0); + // FIXME: Remove this line + st.set_dimension(8); + + // Sort the simplices in the order of the filtration + st.initialize_filtration(); + + BOOST_CHECK(st.num_simplices() <= std::numeric_limits::max()); + // Class for homology computation + BOOST_CHECK_NO_THROW(Mini_st_persistence pcoh(st)); + + st.insert_simplex({8}); + BOOST_CHECK(st.num_simplices() > std::numeric_limits::max()); + // Class for homology computation + BOOST_CHECK_THROW(Mini_st_persistence pcoh2(st), std::out_of_range); + +} -- cgit v1.2.3 From aaff5fb721805e0295193a05964a0ba7faf94162 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 25 Aug 2016 13:08:30 +0000 Subject: Add a comment on MiniSTOption Simplex_key type definition about the maximum to be reached git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/3billions_simplices_fix@1456 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 476838c17d5f6e8745661ee0a67295ce65828f43 --- src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp') diff --git a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp index 530e7092..6efd749e 100644 --- a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp +++ b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp @@ -181,6 +181,7 @@ struct MiniSTOptions { typedef linear_indexing_tag Indexing_tag; typedef short Vertex_handle; typedef double Filtration_value; + // Maximum number of simplices to compute persistence is 2^8 - 1 = 255. One is reserved for null_key typedef std::uint8_t Simplex_key; static const bool store_key = true; static const bool store_filtration = false; -- cgit v1.2.3