diff options
author | mcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-08-28 21:20:08 +0000 |
---|---|---|
committer | mcarrier <mcarrier@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-08-28 21:20:08 +0000 |
commit | 421d41de2ba46670d04f4b0269c034a6be9f42bd (patch) | |
tree | a6149e5a7a9e6504800493c06e793a8fc660f3c6 /src/cython/test/test_simplex_tree.py | |
parent | d34354883a5021ab9beaa03f7739378caf3e5683 (diff) | |
parent | 0784baddd1392727289a972b8374b3c2dca940a9 (diff) |
added function to read point cloud from array in memory + changed a little bit the API
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/Nerve_GIC@3841 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: f31a3a60b2438d7b767a1ee310d859477330a743
Diffstat (limited to 'src/cython/test/test_simplex_tree.py')
-rwxr-xr-x | src/cython/test/test_simplex_tree.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py index 029e7729..cb701c9a 100755 --- a/src/cython/test/test_simplex_tree.py +++ b/src/cython/test/test_simplex_tree.py @@ -161,3 +161,47 @@ def test_automatic_dimension(): assert st.upper_bound_dimension() == 2 assert st.dimension() == 1 assert st.upper_bound_dimension() == 1 + +def test_make_filtration_non_decreasing(): + st = SimplexTree() + assert st.__is_defined() == True + assert st.__is_persistence_defined() == False + + # Inserted simplex: + # 1 + # o + # /X\ + # o---o---o---o + # 2 0 3\X/4 + # o + # 5 + assert st.insert([2, 1, 0], filtration=2.0) == True + assert st.insert([3, 0], filtration=2.0) == True + assert st.insert([3, 4, 5], filtration=2.0) == True + + assert st.make_filtration_non_decreasing() == False + + # Because of non decreasing property of simplex tree, { 0 } , { 1 } and + # { 0, 1 } are going to be set from value 2.0 to 1.0 + st.insert([0, 1, 6, 7], filtration=1.0); + + assert st.make_filtration_non_decreasing() == False + + # Modify specific values to test make_filtration_non_decreasing + st.assign_filtration([0,1,6,7], 0.8); + st.assign_filtration([0,1,6], 0.9); + st.assign_filtration([0,6], 0.6); + st.assign_filtration([3,4,5], 1.2); + st.assign_filtration([3,4], 1.1); + st.assign_filtration([4,5], 1.99); + + assert st.make_filtration_non_decreasing() == True + + assert st.filtration([0,1,6,7]) == 1. + assert st.filtration([0,1,6]) == 1. + assert st.filtration([0,1]) == 1. + assert st.filtration([0]) == 1. + assert st.filtration([1]) == 1. + assert st.filtration([3,4,5]) == 2. + assert st.filtration([3,4]) == 2. + assert st.filtration([4,5]) == 2. |