From 3534c24fd805f8cf0ed8f1d5faea183513966b9f Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 22 Sep 2017 06:59:33 +0000 Subject: Remove global filtration attribute of te simplex tree (including getter and setter) git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_remove_useless_global_filtration@2705 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a6c179ae47e61d1ca12d1f54c4ae1fc0e3c1fde2 --- src/cython/cython/simplex_tree.pyx | 10 ---------- src/cython/example/simplex_tree_example.py | 1 - src/cython/test/test_simplex_tree.py | 1 - 3 files changed, 12 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 47aa5311..45487158 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -36,9 +36,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": cdef cppclass Simplex_tree_interface_full_featured "Gudhi::Simplex_tree_interface": Simplex_tree() - double filtration() double simplex_filtration(vector[int] simplex) - void set_filtration(double filtration) void initialize_filtration() int num_vertices() int num_simplices() @@ -115,14 +113,6 @@ cdef class SimplexTree: """ return self.thisptr.simplex_filtration(simplex) - def set_filtration(self, filtration): - """This function sets the main simplicial complex filtration value. - - :param filtration: The filtration value. - :type filtration: float. - """ - self.thisptr.set_filtration( filtration) - def initialize_filtration(self): """This function initializes and sorts the simplicial complex filtration vector. diff --git a/src/cython/example/simplex_tree_example.py b/src/cython/example/simplex_tree_example.py index 3af20fcf..831d9da8 100755 --- a/src/cython/example/simplex_tree_example.py +++ b/src/cython/example/simplex_tree_example.py @@ -52,7 +52,6 @@ else: st.set_dimension(3) print("dimension=", st.dimension()) -st.set_filtration(4.0) st.initialize_filtration() print("filtration=", st.get_filtration()) print("filtration[1, 2]=", st.filtration([1, 2])) diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py index 3ae537e3..4d452d7d 100755 --- a/src/cython/test/test_simplex_tree.py +++ b/src/cython/test/test_simplex_tree.py @@ -53,7 +53,6 @@ def test_insertion(): assert st.find([2, 3]) == False # filtration test - st.set_filtration(5.0) st.initialize_filtration() assert st.filtration([0, 1, 2]) == 4.0 assert st.filtration([0, 2]) == 4.0 -- cgit v1.2.3 From 6965bcc31dfc44ba82524637b4184f8dfdd86e9c Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 25 Sep 2017 15:44:28 +0000 Subject: Do not advertise nor use the exact bottleneck distance version git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2711 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e441b042d15bfbe727789803ca17b17711a48d9c --- .../example/bottleneck_read_file_example.cpp | 12 ++++++------ src/cython/doc/bottleneck_distance_user.rst | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cython') diff --git a/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp b/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp index 1408681a..24d73c57 100644 --- a/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp +++ b/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp @@ -25,21 +25,21 @@ #include #include #include // for pair -#include -#include #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 a bottleneck" << - " distance (set by default to zero). The program will now terminate \n"; + 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 a 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 = 0.; + double tolerance = std::numeric_limits::min(); if (argc == 4) { tolerance = atof(argv[3]); } diff --git a/src/cython/doc/bottleneck_distance_user.rst b/src/cython/doc/bottleneck_distance_user.rst index 0066992f..7692dce2 100644 --- a/src/cython/doc/bottleneck_distance_user.rst +++ b/src/cython/doc/bottleneck_distance_user.rst @@ -25,7 +25,7 @@ This example computes the bottleneck distance from 2 persistence diagrams: message = "Bottleneck distance approximation=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2, 0.1) print(message) - message = "Bottleneck distance exact value=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2, 0) + message = "Bottleneck distance value=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2) print(message) The output is: @@ -33,4 +33,4 @@ The output is: .. testoutput:: Bottleneck distance approximation=0.81 - Bottleneck distance exact value=0.75 + Bottleneck distance value=0.75 -- cgit v1.2.3 From 526625e6faa7b01430b481d5c21d7d7dfe16e290 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 27 Sep 2017 20:25:21 +0000 Subject: Fix some cpplints git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_remove_useless_global_filtration@2721 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 76b127e54d9511b70294ab48336ca6dbd6fdb1d6 --- ...Bitmap_cubical_complex_periodic_boundary_conditions.cpp | 1 + src/Bottleneck_distance/include/gudhi/Neighbors_finder.h | 8 ++++---- src/Spatial_searching/include/gudhi/Kd_tree_search.h | 14 ++++++-------- src/common/utilities/off_file_from_shape_generator.cpp | 2 +- src/cython/include/Reader_utils_interface.h | 2 ++ 5 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/cython') diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp index f8754345..122160a2 100644 --- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp +++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp @@ -30,6 +30,7 @@ #include #include #include +#include int main(int argc, char** argv) { std::cout << "This program computes persistent homology, by using " << diff --git a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h index bdc47578..a6b9b021 100644 --- a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h +++ b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h @@ -44,16 +44,16 @@ struct Square_query { typedef Internal_point Point_d; typedef double FT; bool contains(Point_d p) const { - return std::abs(p.x()-c.x())<=size && std::abs(p.y()-c.y())<=size; + return std::abs(p.x()-c.x()) <= size && std::abs(p.y()-c.y()) <= size; } - bool inner_range_intersects(CGAL::Kd_tree_rectangle const&r) const { + bool inner_range_intersects(CGAL::Kd_tree_rectangle const&r) const { return r.max_coord(0) >= c.x() - size && r.min_coord(0) <= c.x() + size && r.max_coord(1) >= c.y() - size && r.min_coord(1) <= c.y() + size; } - bool outer_range_contains(CGAL::Kd_tree_rectangle const&r) const { + bool outer_range_contains(CGAL::Kd_tree_rectangle const&r) const { return r.min_coord(0) >= c.x() - size && r.max_coord(0) <= c.x() + size && @@ -146,7 +146,7 @@ inline int Neighbors_finder::pull_near(int u_point_index) { // Is the query point near to a V point in the plane ? Internal_point u_point = g.get_u_point(u_point_index); auto neighbor = kd_t.search_any_point(Square_query{u_point, r}); - if(!neighbor) + if (!neighbor) return null_point_index(); tmp = neighbor->point_index; auto point = g.get_v_point(tmp); diff --git a/src/Spatial_searching/include/gudhi/Kd_tree_search.h b/src/Spatial_searching/include/gudhi/Kd_tree_search.h index a4385c84..af04736b 100644 --- a/src/Spatial_searching/include/gudhi/Kd_tree_search.h +++ b/src/Spatial_searching/include/gudhi/Kd_tree_search.h @@ -193,7 +193,7 @@ class Kd_tree_search { /// \brief Search incrementally for the nearest neighbors from a query point. /// @param[in] p The query point. /// @param[in] eps Approximation factor. - /// @return A range (whose `value_type` is `std::size_t`) containing the + /// @return A range (whose `value_type` is `std::size_t`) containing the /// neighbors sorted by their distance to p. /// All the neighbors are not computed by this function, but they will be /// computed incrementally when the iterator on the range is incremented. @@ -239,7 +239,7 @@ class Kd_tree_search { /// \brief Search incrementally for the farthest neighbors from a query point. /// @param[in] p The query point. /// @param[in] eps Approximation factor. - /// @return A range (whose `value_type` is `std::size_t`) + /// @return A range (whose `value_type` is `std::size_t`) /// containing the neighbors sorted by their distance to p. /// All the neighbors are not computed by this function, but they will be /// computed incrementally when the iterator on the range is incremented. @@ -264,12 +264,10 @@ class Kd_tree_search { /// Note: `it` is used this way: `*it++ = each_point`. /// @param[in] eps Approximation factor. template - void near_search( - Point const& p, - FT radius, - OutputIterator it, - FT eps = FT(0)) const { - + void near_search(Point const& p, + FT radius, + OutputIterator it, + FT eps = FT(0)) const { m_tree.search(it, Fuzzy_sphere(p, radius, eps, m_tree.traits())); } diff --git a/src/common/utilities/off_file_from_shape_generator.cpp b/src/common/utilities/off_file_from_shape_generator.cpp index 0f310a13..afcd558c 100644 --- a/src/common/utilities/off_file_from_shape_generator.cpp +++ b/src/common/utilities/off_file_from_shape_generator.cpp @@ -77,7 +77,7 @@ int main(int argc, char **argv) { usage(argv[0]); } - enum class Data_shape { sphere, cube, curve, torus, klein, undefined } ; + enum class Data_shape { sphere, cube, curve, torus, klein, undefined}; Data_shape shape = Data_shape::undefined; if (memcmp(argv[2], "sphere", sizeof("sphere")) == 0) { diff --git a/src/cython/include/Reader_utils_interface.h b/src/cython/include/Reader_utils_interface.h index b87b6cca..8ec34f61 100644 --- a/src/cython/include/Reader_utils_interface.h +++ b/src/cython/include/Reader_utils_interface.h @@ -28,6 +28,8 @@ #include #include #include +#include +#include // for pair<> namespace Gudhi { -- cgit v1.2.3