summaryrefslogtreecommitdiff
path: root/src/cython/include
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-11-28 16:55:08 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-11-28 16:55:08 +0000
commit844f8b075d9143466040c4d46a181e4a0fcbbda4 (patch)
treee2ba83ae85a176e79fca013c15c0bc9a81e087a3 /src/cython/include
parentaf146a2e48c16855355ac599cbc617250727d244 (diff)
Fix issues
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1795 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c4763818a5845eb884b245eca8c78ed60c1a28ca
Diffstat (limited to 'src/cython/include')
-rw-r--r--src/cython/include/Alpha_complex_interface.h128
-rw-r--r--src/cython/include/Simplex_tree_interface.h8
-rw-r--r--src/cython/include/Tangential_complex_interface.h1
3 files changed, 9 insertions, 128 deletions
diff --git a/src/cython/include/Alpha_complex_interface.h b/src/cython/include/Alpha_complex_interface.h
index 07f5b5b4..15384206 100644
--- a/src/cython/include/Alpha_complex_interface.h
+++ b/src/cython/include/Alpha_complex_interface.h
@@ -27,7 +27,6 @@
#include <gudhi/Alpha_complex.h>
#include <CGAL/Epick_d.h>
-#include "Persistent_cohomology_interface.h"
#include "Simplex_tree_interface.h"
#include <vector>
@@ -50,111 +49,14 @@ class Alpha_complex_interface {
typedef typename Simplex_tree<>::Simplex_key Simplex_key;
public:
- Alpha_complex_interface(std::vector<std::vector<double>>&points)
- : pcoh_(nullptr) {
+ Alpha_complex_interface(std::vector<std::vector<double>>&points) {
alpha_complex_ = new Alpha_complex<Dynamic_kernel>(points);
}
- Alpha_complex_interface(std::string off_file_name, bool from_file = true)
- : pcoh_(nullptr) {
+ Alpha_complex_interface(std::string off_file_name, bool from_file = true) {
alpha_complex_ = new Alpha_complex<Dynamic_kernel>(off_file_name);
}
- bool find_simplex(const Simplex& vh) {
- return (simplex_tree_.find(vh) != simplex_tree_.null_simplex());
- }
-
- bool insert_simplex_and_subfaces(const Simplex& complex, Filtration_value filtration = 0) {
- Insertion_result result = simplex_tree_.insert_simplex_and_subfaces(complex, filtration);
- return (result.second);
- }
-
- Filtration_value simplex_filtration(const Simplex& complex) {
- return simplex_tree_.filtration(simplex_tree_.find(complex));
- }
-
- void remove_maximal_simplex(const Simplex& complex) {
- return simplex_tree_.remove_maximal_simplex(simplex_tree_.find(complex));
- }
-
- Complex_tree get_filtered_tree() {
- Complex_tree filtered_tree;
- for (auto f_simplex : simplex_tree_.filtration_simplex_range()) {
- Simplex simplex;
- for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) {
- simplex.insert(simplex.begin(), vertex);
- }
- filtered_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex)));
- }
- return filtered_tree;
-
- }
-
- Complex_tree get_skeleton_tree(int dimension) {
- Complex_tree skeleton_tree;
- for (auto f_simplex : simplex_tree_.skeleton_simplex_range(dimension)) {
- Simplex simplex;
- for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) {
- simplex.insert(simplex.begin(), vertex);
- }
- skeleton_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex)));
- }
- return skeleton_tree;
- }
-
- Complex_tree get_star_tree(const Simplex& complex) {
- Complex_tree star_tree;
- for (auto f_simplex : simplex_tree_.star_simplex_range(simplex_tree_.find(complex))) {
- Simplex simplex;
- for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) {
- simplex.insert(simplex.begin(), vertex);
- }
- star_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex)));
- }
- return star_tree;
- }
-
- Complex_tree get_coface_tree(const Simplex& complex, int dimension) {
- Complex_tree coface_tree;
- for (auto f_simplex : simplex_tree_.cofaces_simplex_range(simplex_tree_.find(complex), dimension)) {
- Simplex simplex;
- for (auto vertex : simplex_tree_.simplex_vertex_range(f_simplex)) {
- simplex.insert(simplex.begin(), vertex);
- }
- coface_tree.push_back(std::make_pair(simplex, simplex_tree_.filtration(f_simplex)));
- }
- return coface_tree;
- }
-
- // Specific to Witness complex because no inheritance
- Filtration_value filtration() const {
- return simplex_tree_.filtration();
- }
-
- void set_filtration(Filtration_value fil) {
- simplex_tree_.set_filtration(fil);
- }
-
- void initialize_filtration() {
- simplex_tree_.initialize_filtration();
- }
-
- size_t num_vertices() const {
- return simplex_tree_.num_vertices();
- }
-
- size_t num_simplices() {
- return simplex_tree_.num_simplices();
- }
-
- int dimension() const {
- return simplex_tree_.dimension();
- }
-
- void set_dimension(int dimension) {
- simplex_tree_.set_dimension(dimension);
- }
-
std::vector<double> get_point(int vh) {
std::vector<double> vd;
try {
@@ -167,38 +69,12 @@ class Alpha_complex_interface {
return vd;
}
- std::vector<std::pair<int, std::pair<double, double>>> get_persistence(int homology_coeff_field, double min_persistence) {
- if (pcoh_ != nullptr) {
- delete pcoh_;
- }
- pcoh_ = new Persistent_cohomology_interface<Simplex_tree<>>(&simplex_tree_);
- return pcoh_->get_persistence(homology_coeff_field, min_persistence);
- }
-
- std::vector<int> get_betti_numbers() const {
- if (pcoh_ != nullptr) {
- return pcoh_->betti_numbers();
- }
- std::vector<int> betti_numbers;
- return betti_numbers;
- }
-
- std::vector<int> get_persistent_betti_numbers(Filtration_value from, Filtration_value to) const {
- if (pcoh_ != nullptr) {
- return pcoh_->persistent_betti_numbers(from, to);
- }
- std::vector<int> persistent_betti_numbers;
- return persistent_betti_numbers;
- }
-
void create_simplex_tree(Simplex_tree_interface<>& simplex_tree, double max_alpha_square) {
alpha_complex_->create_complex(simplex_tree, max_alpha_square);
simplex_tree.initialize_filtration();
}
private:
- Simplex_tree<> simplex_tree_;
- Persistent_cohomology_interface<Simplex_tree<>>* pcoh_;
Alpha_complex<Dynamic_kernel>* alpha_complex_;
};
diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h
index 06ec6d40..8e9dd966 100644
--- a/src/cython/include/Simplex_tree_interface.h
+++ b/src/cython/include/Simplex_tree_interface.h
@@ -28,6 +28,8 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/Points_off_io.h>
+#include "Persistent_cohomology_interface.h"
+
#include <vector>
#include <utility> // std::pair
#include <iostream>
@@ -69,10 +71,8 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> {
for (auto f_simplex : Simplex_tree<SimplexTreeOptions>::filtration_simplex_range()) {
Simplex simplex;
for (auto vertex : Simplex_tree<SimplexTreeOptions>::simplex_vertex_range(f_simplex)) {
- std::cout << " " << vertex;
simplex.insert(simplex.begin(), vertex);
}
- std::cout << std::endl;
filtered_tree.push_back(std::make_pair(simplex, Simplex_tree<SimplexTreeOptions>::filtration(f_simplex)));
}
return filtered_tree;
@@ -137,6 +137,10 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> {
}
}
+ void create_persistence(Gudhi::Persistent_cohomology_interface<Simplex_tree<SimplexTreeOptions>>* pcoh) {
+ pcoh = new Gudhi::Persistent_cohomology_interface<Simplex_tree<SimplexTreeOptions>>(*this);
+ }
+
};
struct Simplex_tree_options_mini : Simplex_tree_options_full_featured {
diff --git a/src/cython/include/Tangential_complex_interface.h b/src/cython/include/Tangential_complex_interface.h
index 645aad72..e9750e85 100644
--- a/src/cython/include/Tangential_complex_interface.h
+++ b/src/cython/include/Tangential_complex_interface.h
@@ -29,6 +29,7 @@
#include <CGAL/Epick_d.h>
#include "Persistent_cohomology_interface.h"
+#include "Simplex_tree_interface.h"
#include <vector>
#include <utility> // std::pair