summaryrefslogtreecommitdiff
path: root/src/cython
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-06-16 15:39:47 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-06-16 15:39:47 +0000
commit58c333ebd87f6d1dbf6e1ffb887b1de00305f4cc (patch)
tree23be3bf9181f3fa38ba0906275b8d5e3d11c7078 /src/cython
parenta661984d2ed0e515bd0d2f824ba2a03047dfdd38 (diff)
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
Diffstat (limited to 'src/cython')
-rw-r--r--src/cython/Makefile2
-rwxr-xr-xsrc/cython/example/witness_complex_from_file_example.py15
-rw-r--r--src/cython/src/cpp/Witness_complex_interface.h22
-rw-r--r--src/cython/src/cython/witness_complex.pyx14
4 files changed, 13 insertions, 40 deletions
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 <gudhi/Simplex_tree.h>
-#include <gudhi/Relaxed_witness_complex.h>
-#include <gudhi/Landmark_choice_sparsification.h>
-#include <gudhi/A0_complex.h>
+#include <gudhi/Witness_complex.h>
+#include <gudhi/Landmark_choice_by_furthest_point.h>
#include "Persistent_cohomology_interface.h"
@@ -46,22 +45,13 @@ class Witness_complex_interface {
using Complex_tree = std::vector<Filtered_complex>;
public:
- Witness_complex_interface(std::vector<std::vector<double>>&points, int number_of_landmarks, double max_alpha_square,
- double mu_epsilon, int dimension_limit)
+ Witness_complex_interface(std::vector<std::vector<double>>&points, int number_of_landmarks)
: pcoh_(nullptr) {
std::vector<std::vector< int > > knn;
- std::vector<std::vector< FT > > distances;
- std::vector< Point_d > landmarks;
- std::vector<Point_d> 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: