multipers 2.4.0b1__cp312-cp312-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- multipers/.dylibs/libboost_timer.dylib +0 -0
- multipers/.dylibs/libc++.1.0.dylib +0 -0
- multipers/.dylibs/libtbb.12.17.dylib +0 -0
- multipers/__init__.py +33 -0
- multipers/_signed_measure_meta.py +426 -0
- multipers/_slicer_meta.py +231 -0
- multipers/array_api/__init__.py +62 -0
- multipers/array_api/numpy.py +124 -0
- multipers/array_api/torch.py +133 -0
- multipers/data/MOL2.py +458 -0
- multipers/data/UCR.py +18 -0
- multipers/data/__init__.py +1 -0
- multipers/data/graphs.py +466 -0
- multipers/data/immuno_regions.py +27 -0
- multipers/data/minimal_presentation_to_st_bf.py +0 -0
- multipers/data/pytorch2simplextree.py +91 -0
- multipers/data/shape3d.py +101 -0
- multipers/data/synthetic.py +113 -0
- multipers/distances.py +202 -0
- multipers/filtration_conversions.pxd +736 -0
- multipers/filtration_conversions.pxd.tp +226 -0
- multipers/filtrations/__init__.py +21 -0
- multipers/filtrations/density.py +529 -0
- multipers/filtrations/filtrations.py +480 -0
- multipers/filtrations.pxd +534 -0
- multipers/filtrations.pxd.tp +332 -0
- multipers/function_rips.cpython-312-darwin.so +0 -0
- multipers/function_rips.pyx +104 -0
- multipers/grids.cpython-312-darwin.so +0 -0
- multipers/grids.pyx +538 -0
- multipers/gudhi/Persistence_slices_interface.h +213 -0
- multipers/gudhi/Simplex_tree_interface.h +274 -0
- multipers/gudhi/Simplex_tree_multi_interface.h +648 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -0
- multipers/gudhi/gudhi/Debug_utils.h +52 -0
- multipers/gudhi/gudhi/Degree_rips_bifiltration.h +2307 -0
- multipers/gudhi/gudhi/Dynamic_multi_parameter_filtration.h +2524 -0
- multipers/gudhi/gudhi/Fields/Multi_field.h +453 -0
- multipers/gudhi/gudhi/Fields/Multi_field_operators.h +460 -0
- multipers/gudhi/gudhi/Fields/Multi_field_shared.h +444 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small.h +584 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +490 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +580 -0
- multipers/gudhi/gudhi/Fields/Z2_field.h +391 -0
- multipers/gudhi/gudhi/Fields/Z2_field_operators.h +389 -0
- multipers/gudhi/gudhi/Fields/Zp_field.h +493 -0
- multipers/gudhi/gudhi/Fields/Zp_field_operators.h +384 -0
- multipers/gudhi/gudhi/Fields/Zp_field_shared.h +492 -0
- multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -0
- multipers/gudhi/gudhi/Matrix.h +2200 -0
- multipers/gudhi/gudhi/Multi_filtration/Multi_parameter_generator.h +1712 -0
- multipers/gudhi/gudhi/Multi_filtration/multi_filtration_conversions.h +237 -0
- multipers/gudhi/gudhi/Multi_filtration/multi_filtration_utils.h +225 -0
- multipers/gudhi/gudhi/Multi_parameter_filtered_complex.h +485 -0
- multipers/gudhi/gudhi/Multi_parameter_filtration.h +2643 -0
- multipers/gudhi/gudhi/Multi_persistence/Box.h +233 -0
- multipers/gudhi/gudhi/Multi_persistence/Line.h +309 -0
- multipers/gudhi/gudhi/Multi_persistence/Multi_parameter_filtered_complex_pcoh_interface.h +268 -0
- multipers/gudhi/gudhi/Multi_persistence/Persistence_interface_cohomology.h +159 -0
- multipers/gudhi/gudhi/Multi_persistence/Persistence_interface_matrix.h +463 -0
- multipers/gudhi/gudhi/Multi_persistence/Point.h +853 -0
- multipers/gudhi/gudhi/Off_reader.h +173 -0
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +834 -0
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +838 -0
- multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +833 -0
- multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1367 -0
- multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1157 -0
- multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +869 -0
- multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +905 -0
- multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +122 -0
- multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +260 -0
- multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +288 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +170 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +247 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +571 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +182 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +130 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +235 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +312 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1092 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +923 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +914 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +930 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1071 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +203 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +886 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +984 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1213 -0
- multipers/gudhi/gudhi/Persistence_matrix/index_mapper.h +58 -0
- multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +227 -0
- multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +200 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +166 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +319 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +562 -0
- multipers/gudhi/gudhi/Persistence_on_a_line.h +152 -0
- multipers/gudhi/gudhi/Persistence_on_rectangle.h +617 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -0
- multipers/gudhi/gudhi/Persistent_cohomology.h +769 -0
- multipers/gudhi/gudhi/Points_off_io.h +171 -0
- multipers/gudhi/gudhi/Projective_cover_kernel.h +379 -0
- multipers/gudhi/gudhi/Simple_object_pool.h +69 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +559 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +121 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -0
- multipers/gudhi/gudhi/Simplex_tree/filtration_value_utils.h +155 -0
- multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -0
- multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -0
- multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +60 -0
- multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +105 -0
- multipers/gudhi/gudhi/Simplex_tree.h +3170 -0
- multipers/gudhi/gudhi/Slicer.h +848 -0
- multipers/gudhi/gudhi/Thread_safe_slicer.h +393 -0
- multipers/gudhi/gudhi/distance_functions.h +62 -0
- multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -0
- multipers/gudhi/gudhi/multi_simplex_tree_helpers.h +147 -0
- multipers/gudhi/gudhi/persistence_interval.h +263 -0
- multipers/gudhi/gudhi/persistence_matrix_options.h +188 -0
- multipers/gudhi/gudhi/reader_utils.h +367 -0
- multipers/gudhi/gudhi/simple_mdspan.h +484 -0
- multipers/gudhi/gudhi/slicer_helpers.h +779 -0
- multipers/gudhi/tmp_h0_pers/mma_interface_h0.h +223 -0
- multipers/gudhi/tmp_h0_pers/naive_merge_tree.h +536 -0
- multipers/io.cpython-312-darwin.so +0 -0
- multipers/io.pyx +472 -0
- multipers/ml/__init__.py +0 -0
- multipers/ml/accuracies.py +90 -0
- multipers/ml/invariants_with_persistable.py +79 -0
- multipers/ml/kernels.py +176 -0
- multipers/ml/mma.py +713 -0
- multipers/ml/one.py +472 -0
- multipers/ml/point_clouds.py +352 -0
- multipers/ml/signed_measures.py +1667 -0
- multipers/ml/sliced_wasserstein.py +461 -0
- multipers/ml/tools.py +113 -0
- multipers/mma_structures.cpython-312-darwin.so +0 -0
- multipers/mma_structures.pxd +134 -0
- multipers/mma_structures.pyx +1483 -0
- multipers/mma_structures.pyx.tp +1126 -0
- multipers/multi_parameter_rank_invariant/diff_helpers.h +85 -0
- multipers/multi_parameter_rank_invariant/euler_characteristic.h +95 -0
- multipers/multi_parameter_rank_invariant/function_rips.h +317 -0
- multipers/multi_parameter_rank_invariant/hilbert_function.h +761 -0
- multipers/multi_parameter_rank_invariant/persistence_slices.h +149 -0
- multipers/multi_parameter_rank_invariant/rank_invariant.h +350 -0
- multipers/multiparameter_edge_collapse.py +41 -0
- multipers/multiparameter_module_approximation/approximation.h +2541 -0
- multipers/multiparameter_module_approximation/debug.h +107 -0
- multipers/multiparameter_module_approximation/format_python-cpp.h +292 -0
- multipers/multiparameter_module_approximation/utilities.h +428 -0
- multipers/multiparameter_module_approximation.cpython-312-darwin.so +0 -0
- multipers/multiparameter_module_approximation.pyx +286 -0
- multipers/ops.cpython-312-darwin.so +0 -0
- multipers/ops.pyx +231 -0
- multipers/pickle.py +89 -0
- multipers/plots.py +550 -0
- multipers/point_measure.cpython-312-darwin.so +0 -0
- multipers/point_measure.pyx +409 -0
- multipers/simplex_tree_multi.cpython-312-darwin.so +0 -0
- multipers/simplex_tree_multi.pxd +136 -0
- multipers/simplex_tree_multi.pyx +11719 -0
- multipers/simplex_tree_multi.pyx.tp +2102 -0
- multipers/slicer.cpython-312-darwin.so +0 -0
- multipers/slicer.pxd +2097 -0
- multipers/slicer.pxd.tp +263 -0
- multipers/slicer.pyx +13042 -0
- multipers/slicer.pyx.tp +1259 -0
- multipers/tensor/tensor.h +672 -0
- multipers/tensor.pxd +13 -0
- multipers/test.pyx +44 -0
- multipers/tests/__init__.py +70 -0
- multipers/torch/__init__.py +1 -0
- multipers/torch/diff_grids.py +240 -0
- multipers/torch/rips_density.py +310 -0
- multipers/vector_interface.pxd +46 -0
- multipers-2.4.0b1.dist-info/METADATA +131 -0
- multipers-2.4.0b1.dist-info/RECORD +184 -0
- multipers-2.4.0b1.dist-info/WHEEL +6 -0
- multipers-2.4.0b1.dist-info/licenses/LICENSE +21 -0
- multipers-2.4.0b1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
{{py:
|
|
2
|
+
import pickle
|
|
3
|
+
|
|
4
|
+
with open("build/tmp/_filtration_names.pkl", "rb") as f:
|
|
5
|
+
Filtrations=pickle.load(f)
|
|
6
|
+
}}
|
|
7
|
+
from libcpp.utility cimport pair
|
|
8
|
+
from libcpp cimport bool
|
|
9
|
+
from libcpp.vector cimport vector
|
|
10
|
+
from libcpp cimport tuple
|
|
11
|
+
from libc.stdint cimport uintptr_t,intptr_t
|
|
12
|
+
from cpython cimport Py_buffer
|
|
13
|
+
from libc.stdint cimport int32_t, int64_t
|
|
14
|
+
|
|
15
|
+
cdef extern from "gudhi/Persistence_slices_interface.h" namespace "multipers::tmp_interface":
|
|
16
|
+
{{for f in Filtrations}}
|
|
17
|
+
cdef cppclass {{f["python"]}} "{{f['c']}}":
|
|
18
|
+
{{f["python"]}}() except + nogil
|
|
19
|
+
{{f["python"]}}(int) except + nogil
|
|
20
|
+
{{f["python"]}}(int, {{f["c_value_type"]}}) except + nogil
|
|
21
|
+
{{f["python"]}}(vector[{{f["c_value_type"]}}]&) except + nogil
|
|
22
|
+
{{f["python"]}}(vector[{{f["c_value_type"]}}].iterator, vector[{{f["c_value_type"]}}].iterator, int) except + nogil
|
|
23
|
+
{{f["python"]}}& operator=(const {{f["python"]}}&) except + nogil
|
|
24
|
+
{{f["c_value_type"]}}& operator()(size_t, size_t) nogil
|
|
25
|
+
size_t num_parameters() nogil
|
|
26
|
+
size_t num_generators() nogil
|
|
27
|
+
size_t num_entries() nogil
|
|
28
|
+
void set_num_generators(size_t) nogil
|
|
29
|
+
@staticmethod
|
|
30
|
+
{{f["python"]}} inf(int)
|
|
31
|
+
@staticmethod
|
|
32
|
+
{{f["python"]}} minus_inf(int)
|
|
33
|
+
@staticmethod
|
|
34
|
+
{{f["python"]}} nan(int)
|
|
35
|
+
bool is_plus_inf() nogil
|
|
36
|
+
bool is_minus_inf() nogil
|
|
37
|
+
bool is_nan() nogil
|
|
38
|
+
bool is_finite() nogil
|
|
39
|
+
bool add_generator(vector[{{f["c_value_type"]}}] &x) nogil
|
|
40
|
+
bool add_generator(vector[{{f["c_value_type"]}}] x) nogil
|
|
41
|
+
void add_guaranteed_generator(vector[{{f["c_value_type"]}}] &x) nogil
|
|
42
|
+
void simplify() nogil
|
|
43
|
+
void remove_empty_generators(bool) nogil
|
|
44
|
+
bool push_to_least_common_upper_bound(vector[{{f["c_value_type"]}}] &, bool) nogil
|
|
45
|
+
bool push_to_least_common_upper_bound(const {{f["python"]}} &, bool) nogil
|
|
46
|
+
bool pull_to_greatest_common_lower_bound(vector[{{f["c_value_type"]}}] &, bool) nogil
|
|
47
|
+
{{endfor}}
|
|
48
|
+
|
|
49
|
+
cdef extern from "gudhi/Persistence_slices_interface.h" namespace "multipers::tmp_interface":
|
|
50
|
+
cdef cppclass One_critical_filtration[T]:
|
|
51
|
+
## Copied from cython vector
|
|
52
|
+
# ctypedef size_t size_type
|
|
53
|
+
# ctypedef ptrdiff_t difference_type
|
|
54
|
+
# ctypedef T value_type
|
|
55
|
+
|
|
56
|
+
One_critical_filtration() except + nogil
|
|
57
|
+
One_critical_filtration(int) except + nogil
|
|
58
|
+
One_critical_filtration(int, T) except + nogil
|
|
59
|
+
One_critical_filtration(vector[T]&) except + nogil
|
|
60
|
+
One_critical_filtration(vector[T].iterator, vector[T].iterator, int) except + nogil
|
|
61
|
+
One_critical_filtration[T]& operator=(const One_critical_filtration[T]&) except + nogil
|
|
62
|
+
T& operator()(size_t, size_t) nogil
|
|
63
|
+
size_t num_parameters() nogil
|
|
64
|
+
size_t num_generators() nogil
|
|
65
|
+
size_t num_entries() nogil
|
|
66
|
+
void set_num_generators(size_t) nogil
|
|
67
|
+
@staticmethod
|
|
68
|
+
One_critical_filtration inf(int)
|
|
69
|
+
@staticmethod
|
|
70
|
+
One_critical_filtration minus_inf(int)
|
|
71
|
+
@staticmethod
|
|
72
|
+
One_critical_filtration nan(int)
|
|
73
|
+
bool is_plus_inf() nogil
|
|
74
|
+
bool is_minus_inf() nogil
|
|
75
|
+
bool is_nan() nogil
|
|
76
|
+
bool is_finite() nogil
|
|
77
|
+
bool add_generator(vector[T] &x) nogil
|
|
78
|
+
bool add_generator(vector[T] x) nogil
|
|
79
|
+
void add_guaranteed_generator(vector[T] &x) nogil
|
|
80
|
+
void simplify() nogil
|
|
81
|
+
void remove_empty_generators(bool) nogil
|
|
82
|
+
bool push_to_least_common_upper_bound(vector[T] &, bool) nogil
|
|
83
|
+
bool push_to_least_common_upper_bound(const One_critical_filtration &, bool) nogil
|
|
84
|
+
bool pull_to_greatest_common_lower_bound(vector[T] &, bool) nogil
|
|
85
|
+
# bool pull_to_greatest_common_lower_bound(const One_critical_filtration &, bool) nogil
|
|
86
|
+
|
|
87
|
+
cdef extern from "gudhi/Persistence_slices_interface.h" namespace "multipers::tmp_interface":
|
|
88
|
+
cdef cppclass Multi_critical_filtration[T]:
|
|
89
|
+
## Copied from cython vector
|
|
90
|
+
# ctypedef size_t size_type
|
|
91
|
+
# ctypedef ptrdiff_t difference_type
|
|
92
|
+
# ctypedef T value_type
|
|
93
|
+
|
|
94
|
+
Multi_critical_filtration() except + nogil
|
|
95
|
+
Multi_critical_filtration(int) except + nogil
|
|
96
|
+
Multi_critical_filtration(int, T) except + nogil
|
|
97
|
+
Multi_critical_filtration(vector[T]&) except + nogil
|
|
98
|
+
Multi_critical_filtration(vector[T].iterator, vector[T].iterator, int) except + nogil
|
|
99
|
+
Multi_critical_filtration[T]& operator=(const Multi_critical_filtration[T]&) except + nogil
|
|
100
|
+
T& operator()(size_t, size_t) nogil
|
|
101
|
+
size_t num_parameters() nogil
|
|
102
|
+
size_t num_generators() nogil
|
|
103
|
+
size_t num_entries() nogil
|
|
104
|
+
void set_num_generators(size_t) nogil
|
|
105
|
+
@staticmethod
|
|
106
|
+
Multi_critical_filtration inf(int)
|
|
107
|
+
@staticmethod
|
|
108
|
+
Multi_critical_filtration minus_inf(int)
|
|
109
|
+
@staticmethod
|
|
110
|
+
Multi_critical_filtration nan(int)
|
|
111
|
+
bool is_plus_inf() nogil
|
|
112
|
+
bool is_minus_inf() nogil
|
|
113
|
+
bool is_nan() nogil
|
|
114
|
+
bool is_finite() nogil
|
|
115
|
+
bool add_generator(vector[T] &x) nogil
|
|
116
|
+
bool add_generator(vector[T] x) nogil
|
|
117
|
+
void add_guaranteed_generator(vector[T] &x) nogil
|
|
118
|
+
void simplify() nogil
|
|
119
|
+
void remove_empty_generators(bool) nogil
|
|
120
|
+
# "push_to_least_common_upper_bound<std::vector<T>>"
|
|
121
|
+
bool push_to_least_common_upper_bound(vector[T] &, bool) nogil
|
|
122
|
+
bool push_to_least_common_upper_bound(const Multi_critical_filtration[T] &, bool) nogil
|
|
123
|
+
bool pull_to_greatest_common_lower_bound(vector[T] &, bool) nogil
|
|
124
|
+
# bool pull_to_greatest_common_lower_bound(const Multi_critical_filtration[T] &, bool) nogil
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
cdef extern from "gudhi/Multi_persistence/Point.h" namespace "Gudhi::multi_persistence":
|
|
128
|
+
cdef cppclass Point[T]:
|
|
129
|
+
ctypedef size_t size_type
|
|
130
|
+
ctypedef ptrdiff_t difference_type
|
|
131
|
+
ctypedef T value_type
|
|
132
|
+
ctypedef T& reference
|
|
133
|
+
ctypedef T* pointer
|
|
134
|
+
|
|
135
|
+
cppclass const_iterator
|
|
136
|
+
cppclass iterator:
|
|
137
|
+
iterator() except +
|
|
138
|
+
iterator(iterator&) except +
|
|
139
|
+
value_type& operator*()
|
|
140
|
+
iterator operator++()
|
|
141
|
+
iterator operator--()
|
|
142
|
+
iterator operator++(int)
|
|
143
|
+
iterator operator--(int)
|
|
144
|
+
iterator operator+(size_type)
|
|
145
|
+
iterator operator-(size_type)
|
|
146
|
+
difference_type operator-(iterator)
|
|
147
|
+
difference_type operator-(const_iterator)
|
|
148
|
+
bint operator==(iterator)
|
|
149
|
+
bint operator==(const_iterator)
|
|
150
|
+
bint operator!=(iterator)
|
|
151
|
+
bint operator!=(const_iterator)
|
|
152
|
+
bint operator<(iterator)
|
|
153
|
+
bint operator<(const_iterator)
|
|
154
|
+
bint operator>(iterator)
|
|
155
|
+
bint operator>(const_iterator)
|
|
156
|
+
bint operator<=(iterator)
|
|
157
|
+
bint operator<=(const_iterator)
|
|
158
|
+
bint operator>=(iterator)
|
|
159
|
+
bint operator>=(const_iterator)
|
|
160
|
+
cppclass const_iterator:
|
|
161
|
+
const_iterator() except +
|
|
162
|
+
const_iterator(iterator&) except +
|
|
163
|
+
const_iterator(const_iterator&) except +
|
|
164
|
+
operator=(iterator&) except +
|
|
165
|
+
const value_type& operator*()
|
|
166
|
+
const_iterator operator++()
|
|
167
|
+
const_iterator operator--()
|
|
168
|
+
const_iterator operator++(int)
|
|
169
|
+
const_iterator operator--(int)
|
|
170
|
+
const_iterator operator+(size_type)
|
|
171
|
+
const_iterator operator-(size_type)
|
|
172
|
+
difference_type operator-(iterator)
|
|
173
|
+
difference_type operator-(const_iterator)
|
|
174
|
+
bint operator==(iterator)
|
|
175
|
+
bint operator==(const_iterator)
|
|
176
|
+
bint operator!=(iterator)
|
|
177
|
+
bint operator!=(const_iterator)
|
|
178
|
+
bint operator<(iterator)
|
|
179
|
+
bint operator<(const_iterator)
|
|
180
|
+
bint operator>(iterator)
|
|
181
|
+
bint operator>(const_iterator)
|
|
182
|
+
bint operator<=(iterator)
|
|
183
|
+
bint operator<=(const_iterator)
|
|
184
|
+
bint operator>=(iterator)
|
|
185
|
+
bint operator>=(const_iterator)
|
|
186
|
+
|
|
187
|
+
cppclass const_reverse_iterator
|
|
188
|
+
cppclass reverse_iterator:
|
|
189
|
+
reverse_iterator() except +
|
|
190
|
+
reverse_iterator(reverse_iterator&) except +
|
|
191
|
+
value_type& operator*()
|
|
192
|
+
reverse_iterator operator++()
|
|
193
|
+
reverse_iterator operator--()
|
|
194
|
+
reverse_iterator operator++(int)
|
|
195
|
+
reverse_iterator operator--(int)
|
|
196
|
+
reverse_iterator operator+(size_type)
|
|
197
|
+
reverse_iterator operator-(size_type)
|
|
198
|
+
difference_type operator-(iterator)
|
|
199
|
+
difference_type operator-(const_iterator)
|
|
200
|
+
bint operator==(reverse_iterator)
|
|
201
|
+
bint operator==(const_reverse_iterator)
|
|
202
|
+
bint operator!=(reverse_iterator)
|
|
203
|
+
bint operator!=(const_reverse_iterator)
|
|
204
|
+
bint operator<(reverse_iterator)
|
|
205
|
+
bint operator<(const_reverse_iterator)
|
|
206
|
+
bint operator>(reverse_iterator)
|
|
207
|
+
bint operator>(const_reverse_iterator)
|
|
208
|
+
bint operator<=(reverse_iterator)
|
|
209
|
+
bint operator<=(const_reverse_iterator)
|
|
210
|
+
bint operator>=(reverse_iterator)
|
|
211
|
+
bint operator>=(const_reverse_iterator)
|
|
212
|
+
cppclass const_reverse_iterator:
|
|
213
|
+
const_reverse_iterator() except +
|
|
214
|
+
const_reverse_iterator(reverse_iterator&) except +
|
|
215
|
+
operator=(reverse_iterator&) except +
|
|
216
|
+
const value_type& operator*()
|
|
217
|
+
const_reverse_iterator operator++()
|
|
218
|
+
const_reverse_iterator operator--()
|
|
219
|
+
const_reverse_iterator operator++(int)
|
|
220
|
+
const_reverse_iterator operator--(int)
|
|
221
|
+
const_reverse_iterator operator+(size_type)
|
|
222
|
+
const_reverse_iterator operator-(size_type)
|
|
223
|
+
difference_type operator-(iterator)
|
|
224
|
+
difference_type operator-(const_iterator)
|
|
225
|
+
bint operator==(reverse_iterator)
|
|
226
|
+
bint operator==(const_reverse_iterator)
|
|
227
|
+
bint operator!=(reverse_iterator)
|
|
228
|
+
bint operator!=(const_reverse_iterator)
|
|
229
|
+
bint operator<(reverse_iterator)
|
|
230
|
+
bint operator<(const_reverse_iterator)
|
|
231
|
+
bint operator>(reverse_iterator)
|
|
232
|
+
bint operator>(const_reverse_iterator)
|
|
233
|
+
bint operator<=(reverse_iterator)
|
|
234
|
+
bint operator<=(const_reverse_iterator)
|
|
235
|
+
bint operator>=(reverse_iterator)
|
|
236
|
+
bint operator>=(const_reverse_iterator)
|
|
237
|
+
|
|
238
|
+
Point() except + nogil
|
|
239
|
+
Point(size_type) except + nogil
|
|
240
|
+
Point(size_type, const T &) except + nogil
|
|
241
|
+
Point(const vector[T]&) except + nogil
|
|
242
|
+
Point& operator=(Point&) except + nogil
|
|
243
|
+
reference at(size_type) except +
|
|
244
|
+
reference operator[](size_type)
|
|
245
|
+
reference front()
|
|
246
|
+
reference back()
|
|
247
|
+
pointer data()
|
|
248
|
+
const value_type* const_data "data"()
|
|
249
|
+
iterator begin()
|
|
250
|
+
const_iterator const_begin "begin"()
|
|
251
|
+
const_iterator cbegin()
|
|
252
|
+
iterator end()
|
|
253
|
+
const_iterator const_end "end"()
|
|
254
|
+
const_iterator cend()
|
|
255
|
+
reverse_iterator rbegin()
|
|
256
|
+
const_reverse_iterator const_rbegin "rbegin"()
|
|
257
|
+
const_reverse_iterator crbegin()
|
|
258
|
+
reverse_iterator rend()
|
|
259
|
+
const_reverse_iterator const_rend "rend"()
|
|
260
|
+
const_reverse_iterator crend()
|
|
261
|
+
size_type size()
|
|
262
|
+
|
|
263
|
+
bint operator<(const Point &, const Point &)
|
|
264
|
+
bint operator<=(const Point &, const Point &)
|
|
265
|
+
bint operator>(const Point &, const Point &)
|
|
266
|
+
bint operator>=(const Point &, const Point &)
|
|
267
|
+
bint operator==(const Point &, const Point &)
|
|
268
|
+
bint operator!=(const Point &, const Point &)
|
|
269
|
+
Point operator-(const Point &)
|
|
270
|
+
Point operator-(Point, const Point &)
|
|
271
|
+
Point operator-(Point, double)
|
|
272
|
+
Point operator-(Point, float)
|
|
273
|
+
Point operator-(Point, int)
|
|
274
|
+
Point operator-(double, Point)
|
|
275
|
+
Point operator-(float, Point)
|
|
276
|
+
Point operator-(int, Point)
|
|
277
|
+
Point operator+(Point, const Point &)
|
|
278
|
+
Point operator+(Point, double)
|
|
279
|
+
Point operator+(Point, float)
|
|
280
|
+
Point operator+(Point, int)
|
|
281
|
+
Point operator+(double, Point)
|
|
282
|
+
Point operator+(float, Point)
|
|
283
|
+
Point operator+(int, Point)
|
|
284
|
+
Point operator*(Point, const Point &)
|
|
285
|
+
Point operator*(Point, double)
|
|
286
|
+
Point operator*(Point, float)
|
|
287
|
+
Point operator*(Point, int)
|
|
288
|
+
Point operator*(double, Point)
|
|
289
|
+
Point operator*(float, Point)
|
|
290
|
+
Point operator*(int, Point)
|
|
291
|
+
Point operator/(Point, const Point &)
|
|
292
|
+
Point operator/(Point, double)
|
|
293
|
+
Point operator/(Point, float)
|
|
294
|
+
Point operator/(Point, int)
|
|
295
|
+
Point operator/(double, Point)
|
|
296
|
+
Point operator/(float, Point)
|
|
297
|
+
Point operator/(int, Point)
|
|
298
|
+
|
|
299
|
+
cdef extern from "gudhi/Multi_persistence/Box.h" namespace "Gudhi::multi_persistence":
|
|
300
|
+
cdef cppclass Box[T=*]:
|
|
301
|
+
ctypedef Point[T] corner_type
|
|
302
|
+
Box() except +
|
|
303
|
+
# Box(corner_type&, corner_type&) nogil
|
|
304
|
+
# Box(pair[Point[T], Point[T]]&) nogil
|
|
305
|
+
Box(vector[T]&, vector[T]&) nogil
|
|
306
|
+
Box(pair[vector[T], vector[T]]&) nogil
|
|
307
|
+
void inflate(T) nogil
|
|
308
|
+
# const corner_type& get_lower_corner() nogil
|
|
309
|
+
# const corner_type& get_upper_corner() nogil
|
|
310
|
+
const vector[T]& get_lower_corner() nogil
|
|
311
|
+
const vector[T]& get_upper_corner() nogil
|
|
312
|
+
# bool contains(corner_type&) nogil
|
|
313
|
+
bool contains(vector[T]&) nogil
|
|
314
|
+
# pair[corner_type, corner_type] get_bounding_corners() nogil
|
|
315
|
+
pair[vector[T], vector[T]] get_bounding_corners() nogil
|
|
316
|
+
|
|
317
|
+
cdef extern from "gudhi/Multi_persistence/Line.h" namespace "Gudhi::multi_persistence":
|
|
318
|
+
cdef cppclass Line[T=*]:
|
|
319
|
+
ctypedef Point[T] point_type
|
|
320
|
+
Line() except + nogil
|
|
321
|
+
# Line(point_type&) except + nogil
|
|
322
|
+
# Line(point_type&, point_type&) except + nogil
|
|
323
|
+
Line(vector[T]&) except + nogil
|
|
324
|
+
Line(vector[T]&, vector[T]&) except + nogil
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
# ------ useful types:
|
|
331
|
+
# ctypedef One_critical_filtration[float] Generator
|
|
332
|
+
# ctypedef Multi_critical_filtration[float] kcritical
|
|
Binary file
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# cimport multipers.tensor as mt
|
|
2
|
+
from libc.stdint cimport intptr_t, uint16_t, uint32_t, int32_t
|
|
3
|
+
from libcpp.vector cimport vector
|
|
4
|
+
from libcpp cimport bool, int, float
|
|
5
|
+
from libcpp.utility cimport pair, tuple
|
|
6
|
+
from typing import Optional,Iterable,Callable
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
cimport numpy as cnp
|
|
10
|
+
cnp.import_array()
|
|
11
|
+
|
|
12
|
+
ctypedef double value_type
|
|
13
|
+
python_value_type=np.float64
|
|
14
|
+
|
|
15
|
+
ctypedef int32_t indices_type # uint fails for some reason
|
|
16
|
+
python_indices_type=np.int32
|
|
17
|
+
|
|
18
|
+
ctypedef int32_t tensor_dtype
|
|
19
|
+
python_tensor_dtype = np.int32
|
|
20
|
+
|
|
21
|
+
ctypedef pair[vector[vector[indices_type]], vector[tensor_dtype]] signed_measure_type
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from multipers.simplex_tree_multi import _SimplexTreeMulti_Flat_Kf64
|
|
25
|
+
from gudhi.simplex_tree import SimplexTree
|
|
26
|
+
|
|
27
|
+
cdef extern from "multi_parameter_rank_invariant/function_rips.h" namespace "Gudhi::multiparameter::function_rips":
|
|
28
|
+
void compute_function_rips_surface_python(const intptr_t, tensor_dtype* , const vector[indices_type], indices_type,indices_type, bool, bool, indices_type) except + nogil
|
|
29
|
+
signed_measure_type compute_function_rips_signed_measure_python(const intptr_t, tensor_dtype* , const vector[indices_type], indices_type,indices_type, bool, bool, indices_type) except + nogil
|
|
30
|
+
void get_degree_rips_st_python(const intptr_t,const intptr_t, const vector[int]) except + nogil
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
import multipers.grids as mpg
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_degree_rips(st, vector[int] degrees):
|
|
38
|
+
assert isinstance(st,SimplexTree), "Input has to be a Gudhi simplextree for now."
|
|
39
|
+
assert st.dimension() == 1, "Simplextree has to be of dimension 1. You can use the `prune_above_dimension` method."
|
|
40
|
+
degree_rips_st = _SimplexTreeMulti_Flat_Kf64(num_parameters=degrees.size())
|
|
41
|
+
cdef intptr_t simplextree_ptr = st.thisptr
|
|
42
|
+
cdef intptr_t st_multi_ptr = degree_rips_st.thisptr
|
|
43
|
+
with nogil:
|
|
44
|
+
get_degree_rips_st_python(simplextree_ptr, st_multi_ptr, degrees)
|
|
45
|
+
return degree_rips_st
|
|
46
|
+
# cdef int max_degree = out.second
|
|
47
|
+
# cdef bool inf_flag = filtrations[-1] == np.inf
|
|
48
|
+
# if inf_flag:
|
|
49
|
+
# filtrations = filtrations[:-1]
|
|
50
|
+
# filtrations, = mpg.compute_grid([filtrations],strategy=grid_strategy,resolution=resolution)
|
|
51
|
+
# if inf_flag:
|
|
52
|
+
# filtrations = np.concatenate([filtrations, [np.inf]])
|
|
53
|
+
# degree_rips_st.grid_squeeze([filtrations, degrees], inplace=True, coordinate_values=True)
|
|
54
|
+
# degree_rips_st.filtration_grid = mpg.sanitize_grid([filtrations, np.asarray(degrees)])
|
|
55
|
+
# # degree_rips_st._is_function_simplextree=True
|
|
56
|
+
# return degree_rips_st,max_degree
|
|
57
|
+
|
|
58
|
+
def function_rips_surface(st_multi, vector[indices_type] homological_degrees, bool mobius_inversion=True, bool zero_pad=False, indices_type n_jobs=0):
|
|
59
|
+
assert st_multi.is_squeezed, "Squeeze first !"
|
|
60
|
+
cdef intptr_t st_multi_ptr = st_multi.thisptr
|
|
61
|
+
cdef indices_type I = len(st_multi.filtration_grid[0])
|
|
62
|
+
cdef indices_type J = st_multi.num_parameters
|
|
63
|
+
container_shape = (homological_degrees.size(),I,J)
|
|
64
|
+
container_array = np.ascontiguousarray(np.zeros(container_shape, dtype=python_tensor_dtype).flatten())
|
|
65
|
+
assert len(container_array) < np.iinfo(np.uint32).max, "Too large container. Raise an issue on github if you encounter this issue. (Due to tensor's operator[])"
|
|
66
|
+
cdef tensor_dtype[::1] container = container_array
|
|
67
|
+
cdef tensor_dtype* container_ptr = &container[0]
|
|
68
|
+
with nogil:
|
|
69
|
+
compute_function_rips_surface_python(st_multi_ptr,container_ptr, homological_degrees, I,J, mobius_inversion, zero_pad, n_jobs)
|
|
70
|
+
filtration_grid = st_multi.filtration_grid
|
|
71
|
+
if filtration_grid[0][-1] == np.inf:
|
|
72
|
+
filtration_grid[0][-1] = filtration_grid[0][-2]
|
|
73
|
+
return filtration_grid, container_array.reshape(container_shape)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def function_rips_signed_measure(st_multi, vector[indices_type] homological_degrees, bool mobius_inversion=True, bool zero_pad=False, indices_type n_jobs=0, bool reconvert = True):
|
|
78
|
+
assert st_multi.is_squeezed
|
|
79
|
+
cdef intptr_t st_multi_ptr = st_multi.thisptr
|
|
80
|
+
cdef indices_type I = len(st_multi.filtration_grid[0])
|
|
81
|
+
cdef indices_type J = st_multi.num_parameters
|
|
82
|
+
container_shape = (homological_degrees.size(),I,J)
|
|
83
|
+
container_array = np.ascontiguousarray(np.zeros(container_shape, dtype=python_tensor_dtype).flatten())
|
|
84
|
+
assert len(container_array) < np.iinfo(np.uint32).max, "Too large container. Raise an issue on github if you encounter this issue. (Due to tensor's operator[])"
|
|
85
|
+
cdef tensor_dtype[::1] container = container_array
|
|
86
|
+
cdef tensor_dtype* container_ptr = &container[0]
|
|
87
|
+
cdef signed_measure_type out
|
|
88
|
+
# TODO nogil
|
|
89
|
+
with nogil:
|
|
90
|
+
out = compute_function_rips_signed_measure_python(st_multi_ptr,container_ptr, homological_degrees, I,J, mobius_inversion, zero_pad, n_jobs)
|
|
91
|
+
pts, weights = np.asarray(out.first, dtype=int).reshape(-1, 3), np.asarray(out.second, dtype=int)
|
|
92
|
+
|
|
93
|
+
degree_indices = [np.argwhere(pts[:,0] == degree_index).flatten() for degree_index, degree in enumerate(homological_degrees)] ## TODO : maybe optimize
|
|
94
|
+
sms = [(pts[id,1:],weights[id]) for id in degree_indices]
|
|
95
|
+
if not reconvert: return sms
|
|
96
|
+
|
|
97
|
+
grid_conversion = st_multi.filtration_grid
|
|
98
|
+
for degree_index,(pts,weights) in enumerate(sms):
|
|
99
|
+
coords = np.empty(shape=pts.shape, dtype=float)
|
|
100
|
+
for i in range(coords.shape[1]):
|
|
101
|
+
coords[:,i] = np.asarray(grid_conversion[i])[pts[:,i]]
|
|
102
|
+
sms[degree_index]=(coords, weights)
|
|
103
|
+
|
|
104
|
+
return sms
|
|
Binary file
|