diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-09 10:22:37 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-09 10:22:37 +0000 |
commit | 6d66260b62aa5c780e3ac2f0f191992aca016e24 (patch) | |
tree | bf60619c23c20e93b052b8b981b722840678b9dc /src/cython/include | |
parent | 30890785a1b1516cbcfbf5c9b41e4657794d3fb2 (diff) |
Strong witness cythonization
Biblio for doc simplification
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2184 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: c191c6b79bb14f799d6cd08ac59a6b007a7874dc
Diffstat (limited to 'src/cython/include')
-rw-r--r-- | src/cython/include/Simplex_tree_interface.h | 7 | ||||
-rw-r--r-- | src/cython/include/Strong_witness_complex_interface.h | 71 |
2 files changed, 78 insertions, 0 deletions
diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index 19e02ca4..4f3096c0 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -59,6 +59,13 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { return (result.second); } + // Do not interface this function, only used in strong witness interface for complex creation + bool insert_simplex_and_subfaces(const std::vector<std::size_t>& complex, Filtration_value filtration = 0) { + Insertion_result result = Simplex_tree<SimplexTreeOptions>::insert_simplex_and_subfaces(complex, filtration); + Simplex_tree<SimplexTreeOptions>::initialize_filtration(); + return (result.second); + } + Filtration_value simplex_filtration(const Simplex& complex) { return Simplex_tree<SimplexTreeOptions>::filtration(Simplex_tree<SimplexTreeOptions>::find(complex)); } diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h new file mode 100644 index 00000000..e59e58ea --- /dev/null +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -0,0 +1,71 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2016 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef STRONG_WITNESS_COMPLEX_INTERFACE_H +#define STRONG_WITNESS_COMPLEX_INTERFACE_H + +#include <gudhi/Simplex_tree.h> +#include <gudhi/Strong_witness_complex.h> + +#include "Simplex_tree_interface.h" + +#include <vector> +#include <utility> // std::pair +#include <iostream> +#include <cstddef> + +namespace Gudhi { + +namespace witness_complex { + +class Strong_witness_complex_interface { + using Nearest_landmark_range = std::vector<std::pair<std::size_t, double>>; + using Nearest_landmark_table = std::vector<Nearest_landmark_range>; + + public: + Strong_witness_complex_interface(Nearest_landmark_table& nlt) { + witness_complex_ = new Strong_witness_complex<Nearest_landmark_table>(nlt); + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, + std::size_t limit_dimension) { + witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension); + simplex_tree->initialize_filtration(); + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, + double max_alpha_square) { + witness_complex_->create_complex(*simplex_tree, max_alpha_square, std::numeric_limits<std::size_t>::max()); + simplex_tree->initialize_filtration(); + } + + private: + Strong_witness_complex<Nearest_landmark_table>* witness_complex_; + +}; + +} // namespace witness_complex + +} // namespace Gudhi + +#endif // STRONG_WITNESS_COMPLEX_INTERFACE_H + |