From 58c333ebd87f6d1dbf6e1ffb887b1de00305f4cc Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 16 Jun 2016 15:39:47 +0000 Subject: Revert relaxed witness complex git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1308 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 526b0466b3d7d4a8ad2507e5199c15756099125e --- src/cython/Makefile | 2 +- .../example/witness_complex_from_file_example.py | 15 +++------------ src/cython/src/cpp/Witness_complex_interface.h | 22 ++++++---------------- src/cython/src/cython/witness_complex.pyx | 14 +++----------- 4 files changed, 13 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/cython/Makefile b/src/cython/Makefile index 6727bb3d..75adbf3a 100644 --- a/src/cython/Makefile +++ b/src/cython/Makefile @@ -14,11 +14,11 @@ example: python example/alpha_complex_example.py python example/random_cubical_complex_example.py 10 10 python example/cubical_complex_from_perseus_file_example.py -f ../data/bitmap/CubicalTwoSphere.txt + python example/witness_complex_from_file_example.py data/500_random_points_on_3D_Torus.csv # python example/gudhi_graphical_tools_example.py # python example/rips_persistence_diagram.py # python example/alpha_complex_from_file_example.py data/500_random_points_on_3D_Torus.csv # python example/rips_complex_from_file_example.py data/2000_random_points_on_3D_Torus.csv - # python example/witness_complex_from_file_example.py data/2000_random_points_on_3D_Torus.csv clean: rm -rf build/ *.o *.so *.cpp diff --git a/src/cython/example/witness_complex_from_file_example.py b/src/cython/example/witness_complex_from_file_example.py index d67d1c34..82a5b49a 100755 --- a/src/cython/example/witness_complex_from_file_example.py +++ b/src/cython/example/witness_complex_from_file_example.py @@ -46,20 +46,11 @@ args = parser.parse_args() points = pandas.read_csv(args.file, header=None) -print("WitnessComplex with number_of_landmarks=100 alpha=0.7 epsilon_mu=0.001 max_dim=10") +print("WitnessComplex with number_of_landmarks=100") witness_complex = gudhi.WitnessComplex(points=points.values, - number_of_landmarks=100, - max_alpha_square=0.7, - mu_epsilon=0.001, - dimension_limit=10) + number_of_landmarks=100) witness_complex.initialize_filtration() -diag = witness_complex.persistence(homology_coeff_field=2, min_persistence=0.1) -print("betti_numbers()=") -print(witness_complex.betti_numbers()) - -gudhi.diagram_persistence(diag) - -gudhi.barcode_persistence(diag) +print("filtered_tree=", witness_complex.get_filtered_tree()) diff --git a/src/cython/src/cpp/Witness_complex_interface.h b/src/cython/src/cpp/Witness_complex_interface.h index 2b3aa4bf..bdfea91f 100644 --- a/src/cython/src/cpp/Witness_complex_interface.h +++ b/src/cython/src/cpp/Witness_complex_interface.h @@ -24,9 +24,8 @@ #define WITNESS_COMPLEX_INTERFACE_H #include -#include -#include -#include +#include +#include #include "Persistent_cohomology_interface.h" @@ -46,22 +45,13 @@ class Witness_complex_interface { using Complex_tree = std::vector; public: - Witness_complex_interface(std::vector>&points, int number_of_landmarks, double max_alpha_square, - double mu_epsilon, int dimension_limit) + Witness_complex_interface(std::vector>&points, int number_of_landmarks) : pcoh_(nullptr) { std::vector > knn; - std::vector > distances; - std::vector< Point_d > landmarks; - std::vector point_vector; - for (auto point : points) { - point_vector.push_back(Point_d(point.size(), point.begin(), point.end())); - } - Gudhi::witness_complex::landmark_choice_by_sparsification(point_vector, number_of_landmarks, mu_epsilon, landmarks); - Gudhi::witness_complex::build_distance_matrix(point_vector, landmarks, max_alpha_square, dimension_limit, knn, - distances); - A0_complex< Simplex_tree<> > rw(distances, knn, simplex_tree_, number_of_landmarks, max_alpha_square, - dimension_limit); + Gudhi::witness_complex::landmark_choice_by_furthest_point(points, number_of_landmarks, knn); + Gudhi::witness_complex::witness_complex(knn, number_of_landmarks, points[0].size(), simplex_tree_); + } bool find_simplex(const Simplex& vh) { diff --git a/src/cython/src/cython/witness_complex.pyx b/src/cython/src/cython/witness_complex.pyx index 1f99bd8c..b9f354d5 100644 --- a/src/cython/src/cython/witness_complex.pyx +++ b/src/cython/src/cython/witness_complex.pyx @@ -30,7 +30,7 @@ __license__ = "GPL v3" cdef extern from "Witness_complex_interface.h" namespace "Gudhi": cdef cppclass Witness_complex_interface "Gudhi::witness_complex::Witness_complex_interface": - Witness_complex_interface(vector[vector[double]] points, int number_of_landmarks, double max_alpha_square, double mu_epsilon, int dimension_limit) + Witness_complex_interface(vector[vector[double]] points, int number_of_landmarks) double filtration() double simplex_filtration(vector[int] simplex) void set_filtration(double filtration) @@ -63,25 +63,17 @@ cdef class WitnessComplex: #cdef Witness_complex_persistence_interface * pcohptr - def __cinit__(self, points, number_of_landmarks, max_alpha_square, - mu_epsilon, dimension_limit): + def __cinit__(self, points=None, number_of_landmarks=5): """WitnessComplex constructor. Args: points (list): A list of points in d-Dimension. number_of_landmarks (int): Number of landmarks to build the WitnessComplex. - max_alpha_square (float): Maximum alpha square value to build the - distance matrix. - mu_epsilon (float): Mu epsilon value for sparsification. - dimension_limit (int): Dimension limit of the simplicial complex. """ if points is not None: self.thisptr = new Witness_complex_interface(points, - number_of_landmarks, - max_alpha_square, - mu_epsilon, - dimension_limit) + number_of_landmarks) def __dealloc__(self): if self.thisptr != NULL: -- cgit v1.2.3