-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiparameter simplextree #817
base: master
Are you sure you want to change the base?
Changes from 3 commits
6f3aa21
8abadb5
8ab7de0
8e6ef26
9525fe7
3ab6d2c
87821b9
7ac6fab
a603ef7
0b0cd34
a4ea7d0
a7d1609
ff0c9b9
44c89a4
3129205
cb5eb3c
18054a3
a67628c
3b5734b
44abf0d
dcfc551
79a42b4
79c52cd
962f6e3
b73577f
5bb12cc
4f89234
6267d41
f4b355a
32a6a49
36de642
82ce7d0
8fd1ccd
b212c16
655fd08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1754,6 +1754,17 @@ class Simplex_tree { | |
/** \brief Upper bound on the dimension of the simplicial complex.*/ | ||
int dimension_; | ||
bool dimension_to_be_lowered_ = false; | ||
|
||
//MULTIPERS STUFF | ||
public: | ||
void set_number_of_parameters(unsigned int num){ | ||
number_of_parameters_ = num; | ||
} | ||
unsigned int get_number_of_parameters() const{ | ||
return number_of_parameters_; | ||
} | ||
private: | ||
unsigned int number_of_parameters_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One extra integer is acceptable, but I wonder if we could make it exist or not depending on the template parameter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't find anywhere else to put it. Its not possible on the SimplexTree options (static). I can put it in the python class, but that would imply passing this integer to c++ each time a c++ function is called. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One possibility would be |
||
}; | ||
|
||
// Print a Simplex_tree in os. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,11 +31,14 @@ struct Simplex_tree_node_explicit_storage : SimplexTree::Filtration_simplex_base | |
typedef typename SimplexTree::Filtration_value Filtration_value; | ||
typedef typename SimplexTree::Simplex_key Simplex_key; | ||
|
||
Simplex_tree_node_explicit_storage(Siblings * sib = nullptr, | ||
Filtration_value filtration = 0) | ||
Simplex_tree_node_explicit_storage(Siblings * sib, | ||
Filtration_value filtration) //MULTIPERS : init to 0 not possible | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure it will compile with the standard simplextree ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
: children_(sib) { | ||
this->assign_filtration(filtration); | ||
} | ||
Simplex_tree_node_explicit_storage() // Empty constructor necessary | ||
: children_(nullptr) { | ||
} | ||
|
||
/* | ||
* Assign children to the node | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. | ||
# See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. | ||
# Author(s): Vincent Rouvreau | ||
# | ||
# Copyright (C) 2016 Inria | ||
# | ||
# Modification(s): | ||
# - 2022 David Loiseaux, Hannah Schreiber: adapt for multipersistence. | ||
# - YYYY/MM Author: Description of the modification | ||
|
||
from cython cimport numeric | ||
from libcpp.vector cimport vector | ||
from libcpp.utility cimport pair | ||
from libcpp cimport bool | ||
from libcpp.string cimport string | ||
|
||
__author__ = "Vincent Rouvreau" | ||
__copyright__ = "Copyright (C) 2016 Inria" | ||
__license__ = "MIT" | ||
|
||
ctypedef int dimension_type | ||
ctypedef vector[double] point_type | ||
ctypedef double filtration_value_type | ||
ctypedef vector[double] filtration_type | ||
ctypedef vector[int] simplex_type | ||
ctypedef vector[simplex_type] simplex_list | ||
ctypedef vector[pair[pair[int,int], pair[double, double]]] edge_list | ||
ctypedef vector[int] euler_char_list | ||
|
||
cdef extern from "Simplex_tree_interface_multi.h" namespace "Gudhi": | ||
cdef cppclass Simplex_tree_options_multidimensional_filtration: | ||
pass | ||
|
||
cdef cppclass Simplex_tree_multi_simplex_handle "Gudhi::Simplex_tree_interface<Gudhi::Simplex_tree_options_multidimensional_filtration>::Simplex_handle": | ||
pass | ||
|
||
cdef cppclass Simplex_tree_multi_simplices_iterator "Gudhi::Simplex_tree_interface<Gudhi::Simplex_tree_options_multidimensional_filtration>::Complex_simplex_iterator": | ||
Simplex_tree_multi_simplices_iterator() nogil | ||
Simplex_tree_multi_simplex_handle& operator*() nogil | ||
Simplex_tree_multi_simplices_iterator operator++() nogil | ||
bint operator!=(Simplex_tree_multi_simplices_iterator) nogil | ||
|
||
cdef cppclass Simplex_tree_multi_skeleton_iterator "Gudhi::Simplex_tree_interface<Gudhi::Simplex_tree_options_multidimensional_filtration>::Skeleton_simplex_iterator": | ||
Simplex_tree_multi_skeleton_iterator() nogil | ||
Simplex_tree_multi_simplex_handle& operator*() nogil | ||
Simplex_tree_multi_skeleton_iterator operator++() nogil | ||
bint operator!=(Simplex_tree_multi_skeleton_iterator) nogil | ||
|
||
cdef cppclass Simplex_tree_multi_boundary_iterator "Gudhi::Simplex_tree_interface<Gudhi::Simplex_tree_options_multidimensional_filtration>::Boundary_simplex_iterator": | ||
Simplex_tree_multi_boundary_iterator() nogil | ||
Simplex_tree_multi_simplex_handle& operator*() nogil | ||
Simplex_tree_multi_boundary_iterator operator++() nogil | ||
bint operator!=(Simplex_tree_multi_boundary_iterator) nogil | ||
|
||
|
||
cdef cppclass Simplex_tree_multi_interface "Gudhi::Simplex_tree_interface<Gudhi::Simplex_tree_options_multidimensional_filtration>": | ||
Simplex_tree_multi_interface() nogil | ||
Simplex_tree_multi_interface(Simplex_tree_multi_interface&) nogil | ||
filtration_type simplex_filtration(vector[int] simplex) nogil | ||
void assign_simplex_filtration(vector[int] simplex, filtration_type filtration) nogil | ||
void initialize_filtration() nogil | ||
int num_vertices() nogil | ||
int num_simplices() nogil | ||
void set_dimension(int dimension) nogil | ||
dimension_type dimension() nogil | ||
dimension_type upper_bound_dimension() nogil | ||
bool find_simplex(vector[int] simplex) nogil | ||
bool insert(vector[int] simplex, filtration_type filtration) nogil | ||
vector[pair[simplex_type, filtration_type]] get_star(vector[int] simplex) nogil | ||
vector[pair[simplex_type, filtration_type]] get_cofaces(vector[int] simplex, int dimension) nogil | ||
void expansion(int max_dim) nogil except + | ||
void remove_maximal_simplex(simplex_type simplex) nogil | ||
bool prune_above_filtration(filtration_type filtration) nogil | ||
# bool make_filtration_non_decreasing() nogil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am surprised how few modifications there are in Simplex_tree.h. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, all function that are not related to either persistence, or relying on filtration comparison, usually work without any issue. I'm not sure the |
||
# void compute_extended_filtration() nogil | ||
Simplex_tree_multi_interface* collapse_edges(int nb_collapse_iteration) nogil except + | ||
void reset_filtration(filtration_type filtration, int dimension) nogil | ||
bint operator==(Simplex_tree_multi_interface) nogil | ||
# Iterators over Simplex tree | ||
pair[simplex_type, filtration_type] get_simplex_and_filtration(Simplex_tree_multi_simplex_handle f_simplex) nogil | ||
Simplex_tree_multi_simplices_iterator get_simplices_iterator_begin() nogil | ||
Simplex_tree_multi_simplices_iterator get_simplices_iterator_end() nogil | ||
vector[Simplex_tree_multi_simplex_handle].const_iterator get_filtration_iterator_begin() nogil | ||
vector[Simplex_tree_multi_simplex_handle].const_iterator get_filtration_iterator_end() nogil | ||
Simplex_tree_multi_skeleton_iterator get_skeleton_iterator_begin(int dimension) nogil | ||
Simplex_tree_multi_skeleton_iterator get_skeleton_iterator_end(int dimension) nogil | ||
pair[Simplex_tree_multi_boundary_iterator, Simplex_tree_multi_boundary_iterator] get_boundary_iterators(vector[int] simplex) nogil except + | ||
# Expansion with blockers | ||
ctypedef bool (*blocker_func_t)(vector[int], void *user_data) | ||
void expansion_with_blockers_callback(int dimension, blocker_func_t user_func, void *user_data) | ||
|
||
## MULTIPERS STUFF | ||
void reset_keys() nogil | ||
int get_key(const simplex_type) nogil | ||
void set_key(simplex_type, int) nogil | ||
void fill_lowerstar(vector[double], int) nogil | ||
simplex_list get_simplices_of_dimension(int) nogil | ||
edge_list get_edge_list() nogil | ||
euler_char_list euler_char(vector[filtration_type]) nogil | ||
void resize_all_filtrations(int) nogil | ||
void set_number_of_parameters(int) nogil | ||
int get_number_of_parameters() nogil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent with the option strategy of the simplex tree so far, this (except for the
inf_
) should be put in a mixin with a dummy likestruct Filtration_simplex_base_real
andstruct Filtration_simplex_base_dummy
.