multipers 1.1.3__cp310-cp310-macosx_11_0_universal2.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.
Potentially problematic release.
This version of multipers might be problematic. Click here for more details.
- multipers/.dylibs/libtbb.12.12.dylib +0 -0
- multipers/.dylibs/libtbbmalloc.2.12.dylib +0 -0
- multipers/__init__.py +5 -0
- multipers/_old_rank_invariant.pyx +328 -0
- multipers/_signed_measure_meta.py +193 -0
- multipers/data/MOL2.py +350 -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 +68 -0
- multipers/distances.py +172 -0
- multipers/euler_characteristic.cpython-310-darwin.so +0 -0
- multipers/euler_characteristic.pyx +137 -0
- multipers/function_rips.cpython-310-darwin.so +0 -0
- multipers/function_rips.pyx +102 -0
- multipers/hilbert_function.cpython-310-darwin.so +0 -0
- multipers/hilbert_function.pyi +46 -0
- multipers/hilbert_function.pyx +151 -0
- multipers/io.cpython-310-darwin.so +0 -0
- multipers/io.pyx +176 -0
- multipers/ml/__init__.py +0 -0
- multipers/ml/accuracies.py +61 -0
- multipers/ml/convolutions.py +510 -0
- multipers/ml/invariants_with_persistable.py +79 -0
- multipers/ml/kernels.py +128 -0
- multipers/ml/mma.py +657 -0
- multipers/ml/one.py +472 -0
- multipers/ml/point_clouds.py +191 -0
- multipers/ml/signed_betti.py +50 -0
- multipers/ml/signed_measures.py +1479 -0
- multipers/ml/sliced_wasserstein.py +313 -0
- multipers/ml/tools.py +116 -0
- multipers/mma_structures.cpython-310-darwin.so +0 -0
- multipers/mma_structures.pxd +155 -0
- multipers/mma_structures.pyx +651 -0
- multipers/multiparameter_edge_collapse.py +29 -0
- multipers/multiparameter_module_approximation.cpython-310-darwin.so +0 -0
- multipers/multiparameter_module_approximation.pyi +439 -0
- multipers/multiparameter_module_approximation.pyx +311 -0
- multipers/pickle.py +53 -0
- multipers/plots.py +292 -0
- multipers/point_measure_integration.cpython-310-darwin.so +0 -0
- multipers/point_measure_integration.pyx +59 -0
- multipers/rank_invariant.cpython-310-darwin.so +0 -0
- multipers/rank_invariant.pyx +154 -0
- multipers/simplex_tree_multi.cpython-310-darwin.so +0 -0
- multipers/simplex_tree_multi.pxd +121 -0
- multipers/simplex_tree_multi.pyi +715 -0
- multipers/simplex_tree_multi.pyx +1417 -0
- multipers/slicer.cpython-310-darwin.so +0 -0
- multipers/slicer.pxd +94 -0
- multipers/slicer.pyx +276 -0
- multipers/tensor.pxd +13 -0
- multipers/test.pyx +44 -0
- multipers-1.1.3.dist-info/LICENSE +21 -0
- multipers-1.1.3.dist-info/METADATA +22 -0
- multipers-1.1.3.dist-info/RECORD +63 -0
- multipers-1.1.3.dist-info/WHEEL +5 -0
- multipers-1.1.3.dist-info/top_level.txt +1 -0
|
Binary file
|
multipers/slicer.pxd
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
from libcpp.utility cimport pair
|
|
2
|
+
from libcpp cimport bool, int, float
|
|
3
|
+
from libcpp.vector cimport vector
|
|
4
|
+
from libcpp cimport tuple
|
|
5
|
+
|
|
6
|
+
ctypedef float value_type
|
|
7
|
+
ctypedef vector[vector[pair[value_type, value_type]]] Barcode
|
|
8
|
+
ctypedef vector[value_type] point_type
|
|
9
|
+
ctypedef vector[value_type] one_filtration_type
|
|
10
|
+
from libc.stdint cimport intptr_t, uint16_t, uint32_t, int32_t
|
|
11
|
+
from cython cimport uint
|
|
12
|
+
|
|
13
|
+
import numpy as np
|
|
14
|
+
python_value_type=np.float32
|
|
15
|
+
|
|
16
|
+
from libcpp.string cimport string
|
|
17
|
+
|
|
18
|
+
cdef extern from "Simplex_tree_multi_interface.h" namespace "Gudhi::multiparameter":
|
|
19
|
+
cdef cppclass Simplex_tree_multi_interface "Gudhi::multiparameter::Simplex_tree_multi_interface<Gudhi::multiparameter::Simplex_tree_options_multidimensional_filtration>":
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
cdef extern from "gudhi/Simplex_tree/multi_filtrations/Line.h" namespace "Gudhi::multiparameter::multi_filtrations":
|
|
23
|
+
cdef cppclass Line "Gudhi::multiparameter::multi_filtrations::Line<float>":
|
|
24
|
+
Line() except + nogil
|
|
25
|
+
Line(point_type&) except + nogil
|
|
26
|
+
Line(point_type&, point_type&) except + nogil
|
|
27
|
+
|
|
28
|
+
from multipers.mma_structures cimport Finitely_critical_multi_filtration
|
|
29
|
+
|
|
30
|
+
cdef extern from "Persistence_slices_interface.h":
|
|
31
|
+
cdef cppclass SimplicialNoVineMatrixTruc "SimplicialNoVineMatrixTruc":
|
|
32
|
+
SimplicialNoVineMatrixTruc()
|
|
33
|
+
SimplicialNoVineMatrixTruc(Simplex_tree_multi_interface*)
|
|
34
|
+
SimplicialNoVineMatrixTruc& operator=(const SimplicialNoVineMatrixTruc&)
|
|
35
|
+
Barcode get_barcode()
|
|
36
|
+
void push_to[Line](const Line&)
|
|
37
|
+
void set_one_filtration(const one_filtration_type&)
|
|
38
|
+
one_filtration_type get_one_filtration() const
|
|
39
|
+
void compute_persistence()
|
|
40
|
+
uint32_t num_generators()
|
|
41
|
+
string to_str()
|
|
42
|
+
|
|
43
|
+
cdef cppclass SimplicialVineMatrixTruc "SimplicialVineMatrixTruc<>":
|
|
44
|
+
SimplicialVineMatrixTruc()
|
|
45
|
+
SimplicialVineMatrixTruc(Simplex_tree_multi_interface*)
|
|
46
|
+
SimplicialVineMatrixTruc& operator=(const SimplicialVineMatrixTruc&)
|
|
47
|
+
void vineyard_update()
|
|
48
|
+
Barcode get_barcode()
|
|
49
|
+
void push_to[Line](const Line&)
|
|
50
|
+
void set_one_filtration(const one_filtration_type&)
|
|
51
|
+
one_filtration_type get_one_filtration()
|
|
52
|
+
void compute_persistence()
|
|
53
|
+
uint32_t num_generators()
|
|
54
|
+
string to_str()
|
|
55
|
+
|
|
56
|
+
cdef cppclass GeneralVineTruc "GeneralVineTruc<>":
|
|
57
|
+
GeneralVineTruc()
|
|
58
|
+
GeneralVineTruc(const vector[vector[unsigned int]]&, const vector[int]&, const vector[Finitely_critical_multi_filtration]&)
|
|
59
|
+
GeneralVineTruc& operator=(const GeneralVineTruc&)
|
|
60
|
+
void vineyard_update()
|
|
61
|
+
Barcode get_barcode()
|
|
62
|
+
void push_to[Line](const Line&)
|
|
63
|
+
void set_one_filtration(const one_filtration_type&)
|
|
64
|
+
one_filtration_type get_one_filtration()
|
|
65
|
+
void compute_persistence()
|
|
66
|
+
uint32_t num_generators()
|
|
67
|
+
string to_str()
|
|
68
|
+
|
|
69
|
+
cdef cppclass GeneralVineClementTruc "GeneralVineClementTruc<>":
|
|
70
|
+
GeneralVineClementTruc()
|
|
71
|
+
GeneralVineClementTruc(const vector[vector[unsigned int]]&, const vector[int]&, const vector[Finitely_critical_multi_filtration]&)
|
|
72
|
+
GeneralVineClementTruc& operator=(const GeneralVineClementTruc&)
|
|
73
|
+
void vineyard_update()
|
|
74
|
+
Barcode get_barcode()
|
|
75
|
+
void push_to[Line](const Line&)
|
|
76
|
+
void set_one_filtration(const one_filtration_type&)
|
|
77
|
+
one_filtration_type get_one_filtration()
|
|
78
|
+
void compute_persistence()
|
|
79
|
+
uint32_t num_generators()
|
|
80
|
+
string to_str()
|
|
81
|
+
|
|
82
|
+
cdef cppclass SimplicialVineGraphTruc "SimplicialVineGraphTruc":
|
|
83
|
+
SimplicialVineGraphTruc()
|
|
84
|
+
SimplicialVineGraphTruc(Simplex_tree_multi_interface*)
|
|
85
|
+
SimplicialVineGraphTruc& operator=(const SimplicialVineGraphTruc&)
|
|
86
|
+
void vineyard_update()
|
|
87
|
+
Barcode get_barcode()
|
|
88
|
+
void push_to[Line](const Line&)
|
|
89
|
+
void set_one_filtration(const one_filtration_type&)
|
|
90
|
+
one_filtration_type get_one_filtration()
|
|
91
|
+
void compute_persistence()
|
|
92
|
+
uint32_t num_generators()
|
|
93
|
+
string to_str()
|
|
94
|
+
|
multipers/slicer.pyx
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
from multipers.simplex_tree_multi import SimplexTreeMulti
|
|
2
|
+
|
|
3
|
+
from multipers.slicer cimport *
|
|
4
|
+
import numpy as np
|
|
5
|
+
cimport cython
|
|
6
|
+
|
|
7
|
+
cdef class SlicerNoVineSimplcial:
|
|
8
|
+
cdef SimplicialNoVineMatrixTruc truc
|
|
9
|
+
|
|
10
|
+
def get_ptr(self):
|
|
11
|
+
return <intptr_t>(&self.truc)
|
|
12
|
+
def __cinit__(self, st, bool vine=False):
|
|
13
|
+
cdef intptr_t ptr = st.thisptr
|
|
14
|
+
cdef Simplex_tree_multi_interface* st_ptr = <Simplex_tree_multi_interface*>(ptr)
|
|
15
|
+
self.truc = SimplicialNoVineMatrixTruc(st_ptr)
|
|
16
|
+
def get_barcode(self):
|
|
17
|
+
return self.truc.get_barcode()
|
|
18
|
+
def persistence_on_line(self,basepoint,direction=None):
|
|
19
|
+
basepoint = np.asarray(basepoint)
|
|
20
|
+
cdef Line line
|
|
21
|
+
if direction is None:
|
|
22
|
+
line = Line(basepoint)
|
|
23
|
+
else:
|
|
24
|
+
line = Line(basepoint,direction)
|
|
25
|
+
self.truc.push_to[Line](line)
|
|
26
|
+
self.truc.compute_persistence()
|
|
27
|
+
return self.truc.get_barcode()
|
|
28
|
+
def compute_persistence(self,one_filtration=None):
|
|
29
|
+
if one_filtration is not None:
|
|
30
|
+
self.truc.set_one_filtration(one_filtration)
|
|
31
|
+
self.truc.compute_persistence()
|
|
32
|
+
# return self.truc.get_barcode()
|
|
33
|
+
def get_barcode(self):
|
|
34
|
+
return self.truc.get_barcode()
|
|
35
|
+
def sliced_filtration(self,basepoint, direction=None):
|
|
36
|
+
basepoint = np.asarray(basepoint)
|
|
37
|
+
cdef Line line
|
|
38
|
+
if direction is None:
|
|
39
|
+
line = Line(basepoint)
|
|
40
|
+
else:
|
|
41
|
+
line = Line(basepoint,direction)
|
|
42
|
+
self.truc.push_to[Line](line)
|
|
43
|
+
return np.asarray(self.truc.get_one_filtration())
|
|
44
|
+
def __len__(self):
|
|
45
|
+
return self.truc.num_generators()
|
|
46
|
+
def __repr__(self):
|
|
47
|
+
return self.truc.to_str().decode()
|
|
48
|
+
|
|
49
|
+
cdef class SlicerVineSimplcial:
|
|
50
|
+
cdef SimplicialVineMatrixTruc truc
|
|
51
|
+
|
|
52
|
+
def get_ptr(self):
|
|
53
|
+
return <intptr_t>(&self.truc)
|
|
54
|
+
def __cinit__(self, st, bool vine=False):
|
|
55
|
+
cdef intptr_t ptr = st.thisptr
|
|
56
|
+
cdef Simplex_tree_multi_interface* st_ptr = <Simplex_tree_multi_interface*>(ptr)
|
|
57
|
+
self.truc = SimplicialVineMatrixTruc(st_ptr)
|
|
58
|
+
def vine_update(self,basepoint,direction=None):
|
|
59
|
+
basepoint = np.asarray(basepoint)
|
|
60
|
+
cdef Line line
|
|
61
|
+
if direction is None:
|
|
62
|
+
line = Line(basepoint)
|
|
63
|
+
else:
|
|
64
|
+
line = Line(basepoint,direction)
|
|
65
|
+
self.truc.push_to[Line](line)
|
|
66
|
+
self.truc.vineyard_update()
|
|
67
|
+
def get_barcode(self):
|
|
68
|
+
return self.truc.get_barcode()
|
|
69
|
+
def persistence_on_line(self,basepoint,direction=None):
|
|
70
|
+
basepoint = np.asarray(basepoint)
|
|
71
|
+
cdef Line line
|
|
72
|
+
if direction is None:
|
|
73
|
+
line = Line(basepoint)
|
|
74
|
+
else:
|
|
75
|
+
line = Line(basepoint,direction)
|
|
76
|
+
self.truc.push_to[Line](line)
|
|
77
|
+
self.truc.compute_persistence()
|
|
78
|
+
return self.truc.get_barcode()
|
|
79
|
+
def compute_persistence(self,one_filtration=None):
|
|
80
|
+
if one_filtration is not None:
|
|
81
|
+
self.truc.set_one_filtration(one_filtration)
|
|
82
|
+
self.truc.compute_persistence()
|
|
83
|
+
# return self.truc.get_barcode()
|
|
84
|
+
def get_barcode(self):
|
|
85
|
+
return self.truc.get_barcode()
|
|
86
|
+
def sliced_filtration(self,basepoint, direction=None):
|
|
87
|
+
basepoint = np.asarray(basepoint)
|
|
88
|
+
cdef Line line
|
|
89
|
+
if direction is None:
|
|
90
|
+
line = Line(basepoint)
|
|
91
|
+
else:
|
|
92
|
+
line = Line(basepoint,direction)
|
|
93
|
+
self.truc.push_to[Line](line)
|
|
94
|
+
return np.asarray(self.truc.get_one_filtration())
|
|
95
|
+
def __len__(self):
|
|
96
|
+
return self.truc.num_generators()
|
|
97
|
+
def __repr__(self):
|
|
98
|
+
return self.truc.to_str().decode()
|
|
99
|
+
|
|
100
|
+
cdef class SlicerClement:
|
|
101
|
+
cdef GeneralVineClementTruc truc
|
|
102
|
+
def __cinit__(self, generator_maps, generator_dimensions, filtration_values):
|
|
103
|
+
cdef uint32_t num_generators = len(generator_maps)
|
|
104
|
+
cdef vector[vector[uint32_t]] c_generator_maps
|
|
105
|
+
cdef vector[Finitely_critical_multi_filtration] c_filtration_values
|
|
106
|
+
for stuff in generator_maps:
|
|
107
|
+
c_generator_maps.push_back(<vector[uint32_t]>(stuff))
|
|
108
|
+
cdef Finitely_critical_multi_filtration cf
|
|
109
|
+
for f in filtration_values:
|
|
110
|
+
cf.clear()
|
|
111
|
+
for truc in f:
|
|
112
|
+
cf.push_back(truc)
|
|
113
|
+
c_filtration_values.push_back(cf)
|
|
114
|
+
cdef vector[int] c_generator_dimensions = generator_dimensions
|
|
115
|
+
assert num_generators == c_generator_maps.size() == c_filtration_values.size(), "Invalid input, shape do not coincide."
|
|
116
|
+
self.truc = GeneralVineClementTruc(c_generator_maps,c_generator_dimensions, c_filtration_values)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def get_ptr(self):
|
|
120
|
+
return <intptr_t>(&self.truc)
|
|
121
|
+
def vine_update(self,basepoint,direction=None):
|
|
122
|
+
basepoint = np.asarray(basepoint)
|
|
123
|
+
cdef Line line
|
|
124
|
+
if direction is None:
|
|
125
|
+
line = Line(basepoint)
|
|
126
|
+
else:
|
|
127
|
+
line = Line(basepoint,direction)
|
|
128
|
+
self.truc.push_to[Line](line)
|
|
129
|
+
self.truc.vineyard_update()
|
|
130
|
+
def get_barcode(self):
|
|
131
|
+
return self.truc.get_barcode()
|
|
132
|
+
def persistence_on_line(self,basepoint,direction=None):
|
|
133
|
+
basepoint = np.asarray(basepoint)
|
|
134
|
+
cdef Line line
|
|
135
|
+
if direction is None:
|
|
136
|
+
line = Line(basepoint)
|
|
137
|
+
else:
|
|
138
|
+
line = Line(basepoint,direction)
|
|
139
|
+
self.truc.push_to[Line](line)
|
|
140
|
+
self.truc.compute_persistence()
|
|
141
|
+
return self.truc.get_barcode()
|
|
142
|
+
def compute_persistence(self,one_filtration=None):
|
|
143
|
+
if one_filtration is not None:
|
|
144
|
+
self.truc.set_one_filtration(one_filtration)
|
|
145
|
+
self.truc.compute_persistence()
|
|
146
|
+
# return self.truc.get_barcode()
|
|
147
|
+
def get_barcode(self):
|
|
148
|
+
return self.truc.get_barcode()
|
|
149
|
+
def sliced_filtration(self,basepoint, direction=None):
|
|
150
|
+
basepoint = np.asarray(basepoint)
|
|
151
|
+
cdef Line line
|
|
152
|
+
if direction is None:
|
|
153
|
+
line = Line(basepoint)
|
|
154
|
+
else:
|
|
155
|
+
line = Line(basepoint,direction)
|
|
156
|
+
self.truc.push_to[Line](line)
|
|
157
|
+
return np.asarray(self.truc.get_one_filtration())
|
|
158
|
+
def __len__(self):
|
|
159
|
+
return self.truc.num_generators()
|
|
160
|
+
def __repr__(self):
|
|
161
|
+
return self.truc.to_str().decode()
|
|
162
|
+
|
|
163
|
+
cdef class Slicer:
|
|
164
|
+
cdef GeneralVineTruc truc
|
|
165
|
+
def __cinit__(self, generator_maps, generator_dimensions, filtration_values):
|
|
166
|
+
cdef uint32_t num_generators = len(generator_maps)
|
|
167
|
+
cdef vector[vector[uint32_t]] c_generator_maps
|
|
168
|
+
cdef vector[Finitely_critical_multi_filtration] c_filtration_values
|
|
169
|
+
for stuff in generator_maps:
|
|
170
|
+
c_generator_maps.push_back(<vector[uint32_t]>(stuff))
|
|
171
|
+
cdef Finitely_critical_multi_filtration cf
|
|
172
|
+
for f in filtration_values:
|
|
173
|
+
cf.clear()
|
|
174
|
+
for truc in f:
|
|
175
|
+
cf.push_back(truc)
|
|
176
|
+
c_filtration_values.push_back(cf)
|
|
177
|
+
cdef vector[int] c_generator_dimensions = generator_dimensions
|
|
178
|
+
assert num_generators == c_generator_maps.size() == c_filtration_values.size(), "Invalid input, shape do not coincide."
|
|
179
|
+
self.truc = GeneralVineTruc(c_generator_maps,c_generator_dimensions, c_filtration_values)
|
|
180
|
+
|
|
181
|
+
def get_ptr(self):
|
|
182
|
+
return <intptr_t>(&self.truc)
|
|
183
|
+
def vine_update(self,basepoint,direction=None):
|
|
184
|
+
basepoint = np.asarray(basepoint)
|
|
185
|
+
cdef Line line
|
|
186
|
+
if direction is None:
|
|
187
|
+
line = Line(basepoint)
|
|
188
|
+
else:
|
|
189
|
+
line = Line(basepoint,direction)
|
|
190
|
+
self.truc.push_to[Line](line)
|
|
191
|
+
self.truc.vineyard_update()
|
|
192
|
+
def get_barcode(self):
|
|
193
|
+
return self.truc.get_barcode()
|
|
194
|
+
def persistence_on_line(self,basepoint,direction=None):
|
|
195
|
+
basepoint = np.asarray(basepoint)
|
|
196
|
+
cdef Line line
|
|
197
|
+
if direction is None:
|
|
198
|
+
line = Line(basepoint)
|
|
199
|
+
else:
|
|
200
|
+
line = Line(basepoint,direction)
|
|
201
|
+
self.truc.push_to[Line](line)
|
|
202
|
+
self.truc.compute_persistence()
|
|
203
|
+
return self.truc.get_barcode()
|
|
204
|
+
def compute_persistence(self,one_filtration=None):
|
|
205
|
+
if one_filtration is not None:
|
|
206
|
+
self.truc.set_one_filtration(one_filtration)
|
|
207
|
+
self.truc.compute_persistence()
|
|
208
|
+
# return self.truc.get_barcode()
|
|
209
|
+
def get_barcode(self):
|
|
210
|
+
return self.truc.get_barcode()
|
|
211
|
+
def sliced_filtration(self,basepoint, direction=None):
|
|
212
|
+
basepoint = np.asarray(basepoint)
|
|
213
|
+
cdef Line line
|
|
214
|
+
if direction is None:
|
|
215
|
+
line = Line(basepoint)
|
|
216
|
+
else:
|
|
217
|
+
line = Line(basepoint,direction)
|
|
218
|
+
self.truc.push_to[Line](line)
|
|
219
|
+
return np.asarray(self.truc.get_one_filtration())
|
|
220
|
+
def __len__(self):
|
|
221
|
+
return self.truc.num_generators()
|
|
222
|
+
def __repr__(self):
|
|
223
|
+
return self.truc.to_str().decode()
|
|
224
|
+
|
|
225
|
+
cdef class SlicerVineGraph:
|
|
226
|
+
cdef SimplicialVineGraphTruc truc
|
|
227
|
+
def __cinit__(self, st, bool vine=False):
|
|
228
|
+
cdef intptr_t ptr = st.thisptr
|
|
229
|
+
cdef Simplex_tree_multi_interface* st_ptr = <Simplex_tree_multi_interface*>(ptr)
|
|
230
|
+
self.truc = SimplicialVineGraphTruc(st_ptr)
|
|
231
|
+
def vine_update(self,basepoint,direction=None):
|
|
232
|
+
basepoint = np.asarray(basepoint)
|
|
233
|
+
cdef Line line
|
|
234
|
+
if direction is None:
|
|
235
|
+
line = Line(basepoint)
|
|
236
|
+
else:
|
|
237
|
+
line = Line(basepoint,direction)
|
|
238
|
+
self.truc.push_to[Line](line)
|
|
239
|
+
self.truc.vineyard_update()
|
|
240
|
+
def get_barcode(self):
|
|
241
|
+
return self.truc.get_barcode()
|
|
242
|
+
|
|
243
|
+
def get_ptr(self):
|
|
244
|
+
return <intptr_t>(&self.truc)
|
|
245
|
+
def persistence_on_line(self,basepoint,direction=None):
|
|
246
|
+
basepoint = np.asarray(basepoint)
|
|
247
|
+
cdef Line line
|
|
248
|
+
if direction is None:
|
|
249
|
+
line = Line(basepoint)
|
|
250
|
+
else:
|
|
251
|
+
line = Line(basepoint,direction)
|
|
252
|
+
self.truc.push_to[Line](line)
|
|
253
|
+
self.truc.compute_persistence()
|
|
254
|
+
return self.truc.get_barcode()
|
|
255
|
+
def compute_persistence(self,one_filtration=None):
|
|
256
|
+
if one_filtration is not None:
|
|
257
|
+
self.truc.set_one_filtration(one_filtration)
|
|
258
|
+
self.truc.compute_persistence()
|
|
259
|
+
# return self.truc.get_barcode()
|
|
260
|
+
def get_barcode(self):
|
|
261
|
+
return self.truc.get_barcode()
|
|
262
|
+
def sliced_filtration(self,basepoint, direction=None):
|
|
263
|
+
basepoint = np.asarray(basepoint)
|
|
264
|
+
cdef Line line
|
|
265
|
+
if direction is None:
|
|
266
|
+
line = Line(basepoint)
|
|
267
|
+
else:
|
|
268
|
+
line = Line(basepoint,direction)
|
|
269
|
+
self.truc.push_to[Line](line)
|
|
270
|
+
return np.asarray(self.truc.get_one_filtration())
|
|
271
|
+
def __len__(self):
|
|
272
|
+
return self.truc.num_generators()
|
|
273
|
+
def __repr__(self):
|
|
274
|
+
return self.truc.to_str().decode()
|
|
275
|
+
|
|
276
|
+
|
multipers/tensor.pxd
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from libc.stdint cimport uint16_t
|
|
2
|
+
from libcpp.vector cimport vector
|
|
3
|
+
from libcpp cimport bool, float
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
ctypedef float dtype
|
|
7
|
+
ctypedef uint16_t index_type
|
|
8
|
+
|
|
9
|
+
cdef extern from "tensor/tensor.h" namespace "tensor":
|
|
10
|
+
cdef cppclass static_tensor_view[float, uint16_t]:
|
|
11
|
+
static_tensor_view() except + nogil
|
|
12
|
+
static_tensor_view(dtype*,const vector[index_type]&) except + nogil
|
|
13
|
+
const vector[index_type]& get_resolution()
|
multipers/test.pyx
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# cimport multipers.tensor as mt
|
|
2
|
+
from libc.stdint cimport intptr_t, uint16_t
|
|
3
|
+
from libcpp.vector cimport vector
|
|
4
|
+
from libcpp cimport bool, int, float
|
|
5
|
+
from libcpp.utility cimport pair
|
|
6
|
+
from typing import Optional,Iterable,Callable
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
ctypedef float value_type
|
|
10
|
+
# ctypedef uint16_t index_type
|
|
11
|
+
|
|
12
|
+
import numpy as np
|
|
13
|
+
# cimport numpy as cnp
|
|
14
|
+
# cnp.import_array()
|
|
15
|
+
|
|
16
|
+
# cdef extern from "multi_parameter_rank_invariant/rank_invariant.h" namespace "Gudhi::rank_invariant":
|
|
17
|
+
# void get_hilbert_surface(const intptr_t, mt.static_tensor_view, const vector[index_type], const vector[index_type], index_type, index_type, const vector[index_type], bool, bool) except + nogil
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
from multipers.simplex_tree_multi import SimplexTreeMulti
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def numpy_to_tensor(array:np.ndarray):
|
|
24
|
+
cdef vector[index_type] shape = array.shape
|
|
25
|
+
cdef dtype[::1] contigus_array_view = np.ascontiguousarray(array)
|
|
26
|
+
cdef dtype* dtype_ptr = &contigus_array_view[0]
|
|
27
|
+
cdef mt.static_tensor_view tensor
|
|
28
|
+
with nogil:
|
|
29
|
+
tensor = mt.static_tensor_view(dtype_ptr, shape)
|
|
30
|
+
return tensor.get_resolution()
|
|
31
|
+
|
|
32
|
+
# def hilbert2d(simplextree:SimplexTreeMulti, grid_shape:np.ndarray|list, vector[index_type] degrees, bool mobius_inversion):
|
|
33
|
+
# # assert simplextree.num_parameters == 2
|
|
34
|
+
# cdef intptr_t ptr = simplextree.thisptr
|
|
35
|
+
# cdef vector[index_type] c_grid_shape = grid_shape
|
|
36
|
+
# cdef dtype[::1] container = np.zeros(grid_shape, dtype=np.float32).flatten()
|
|
37
|
+
# cdef dtype* container_ptr = &container[0]
|
|
38
|
+
# cdef mt.static_tensor_view c_container = mt.static_tensor_view(container_ptr, c_grid_shape)
|
|
39
|
+
# cdef index_type i = 0
|
|
40
|
+
# cdef index_type j = 1
|
|
41
|
+
# cdef vector[index_type] fixed_values = [[],[]]
|
|
42
|
+
# # get_hilbert_surface(ptr, c_container, c_grid_shape, degrees,i,j,fixed_values, False, False)
|
|
43
|
+
# return container.reshape(grid_shape)
|
|
44
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 David Loiseaux
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: multipers
|
|
3
|
+
Version: 1.1.3
|
|
4
|
+
Summary: Scikit-style Multiparameter persistence toolkit
|
|
5
|
+
Home-page: https://github.com/DavidLapous/multipers
|
|
6
|
+
Author: David Loiseaux
|
|
7
|
+
Author-email: david.loiseaux@inria.fr
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: TDA Persistence Multiparameter sklearn
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
multipers-1.1.3.dist-info/RECORD,,
|
|
2
|
+
multipers-1.1.3.dist-info/LICENSE,sha256=UsQRnvlo_9wpQS9DNt52GEraERHwK2GIRwuqr2Yv5JI,1071
|
|
3
|
+
multipers-1.1.3.dist-info/WHEEL,sha256=R8f5d0NgI09EFUSjYP3BFN0nEj9obV2kaqWcDAGvCLU,115
|
|
4
|
+
multipers-1.1.3.dist-info/top_level.txt,sha256=L9e0AGmhRzrNw9FpuUx-zlqi5NcBOmrI9wYY8kYWr8A,10
|
|
5
|
+
multipers-1.1.3.dist-info/METADATA,sha256=VxRWcEyM-9KguuWMIvy_NvOyuwGFfRysbzp08l9uoFM,928
|
|
6
|
+
multipers/_old_rank_invariant.pyx,sha256=i4olUQ1SMXhvu93pQ9Mrp9hKt0fuK2warsIphavRrZk,13288
|
|
7
|
+
multipers/mma_structures.cpython-310-darwin.so,sha256=FDy7VKJwjGpG8dOPO_sJLC9kDznFEOOzXF-K_05B0SI,698624
|
|
8
|
+
multipers/euler_characteristic.cpython-310-darwin.so,sha256=-pdVRTW1OpWWrFm1FJtfhhJONU7O6rPtULQGz7eq4gc,341168
|
|
9
|
+
multipers/euler_characteristic.pyx,sha256=INOfV0r_fRUzhf6ilWASehihIOsl3-HFdjSPCMcbFNs,6202
|
|
10
|
+
multipers/distances.py,sha256=ggmgYN7IOMrYJoBlBrZ6vo9MsYEKvqR-zi58uxIqk2Y,5531
|
|
11
|
+
multipers/mma_structures.pyx,sha256=7F0WmwkVHr8Pscp8ZawM10uUJ0_f30BqdyJWSGiQo0M,22932
|
|
12
|
+
multipers/multiparameter_module_approximation.pyi,sha256=PvcSIeCjTFDNb4AOotwSFkJEySA2_q1qgb9vgRd4T_4,11241
|
|
13
|
+
multipers/hilbert_function.cpython-310-darwin.so,sha256=ZVPsUmzi1fX1yVL2h3aE7IgL91gP47bsQL_NzLtcbEo,551328
|
|
14
|
+
multipers/slicer.pyx,sha256=dyaEKnzzrPjxfNlGUbQHD4UP-F9fVIHTV4KOmAvDuB4,10558
|
|
15
|
+
multipers/point_measure_integration.cpython-310-darwin.so,sha256=5jg21tYBiRkjfmf-RJQpXt2l8vG2-6K_1J0BepoL3p8,364320
|
|
16
|
+
multipers/function_rips.cpython-310-darwin.so,sha256=cV0y19t9oom50P-JBgLo72CiPnIUfpx6bEXJg54_lrw,509360
|
|
17
|
+
multipers/simplex_tree_multi.pyx,sha256=o_ZyUTFFDQTva0hJfV6IFBEE19EOOjTrZ-OvAudvyyI,58133
|
|
18
|
+
multipers/__init__.py,sha256=TNz05kYYc0akV3__eoIpOmxfGe-z5kHdGrDWYQH2yiI,262
|
|
19
|
+
multipers/io.pyx,sha256=ENHwqqlV1F1hdzLh8CFWdYsbyRV3b2fIrfeCpF4S3Ro,5780
|
|
20
|
+
multipers/hilbert_function.pyx,sha256=1LT_uEft5RkhHS-MQ4RE5YldiU1cUYxZZwvH0kFyHIo,7104
|
|
21
|
+
multipers/multiparameter_edge_collapse.py,sha256=t9w87UPSGxp6Gxgg7C8R7goVK7zKcQf_uThrSYhnbV0,941
|
|
22
|
+
multipers/multiparameter_module_approximation.cpython-310-darwin.so,sha256=KJybj0jXj6Id0McuXbbHhuM6wxX12sn3UyO18NyT5hE,643120
|
|
23
|
+
multipers/plots.py,sha256=7C3XpdqSGtUdx5eHUyPbg20qnXtBjmnG0PizvY3NhE0,9527
|
|
24
|
+
multipers/slicer.cpython-310-darwin.so,sha256=RnYED0BOSq7ISqXN9cSteIro6h3hMQdv7-KTyolPcSo,682224
|
|
25
|
+
multipers/simplex_tree_multi.pxd,sha256=R7OEwYfhYika1MnZg5CuZNB2xOjoyhRdv8TAdbakBeE,6483
|
|
26
|
+
multipers/io.cpython-310-darwin.so,sha256=bSErhS9ulEtTCfUcWNzLl7oIKctbfc9rMZ8LbZjyvAE,387584
|
|
27
|
+
multipers/slicer.pxd,sha256=OniCuW-UCWUhPGXi44DYVfOjiLsRlTjBTy1ZUuYx-FI,3681
|
|
28
|
+
multipers/test.pyx,sha256=-g7WU-jKrZK8H0c-6eAPsfrApjvTKrUoswVYFu8LoV4,1798
|
|
29
|
+
multipers/multiparameter_module_approximation.pyx,sha256=A_ug8cE4n37mYReVUgQgE-qpEHsfzyrOWLrtq_Zxht8,11535
|
|
30
|
+
multipers/pickle.py,sha256=9XAh65HQo_MD663OLbP5-DEG6WNU4zyEJePybDu7Hww,2141
|
|
31
|
+
multipers/_signed_measure_meta.py,sha256=vXidho7MLGpdPwRVcotUlPrA7OXePvffJGSPLIwfRDw,6668
|
|
32
|
+
multipers/tensor.pxd,sha256=MSmaMU0sOP9CHLmg4dym7nOGaI1S4cOdM01TQ9flI54,417
|
|
33
|
+
multipers/mma_structures.pxd,sha256=7Uqo6NkTPOjfLOgTIR6zKe9E4JHpek6l7vChLZd9wpE,7587
|
|
34
|
+
multipers/point_measure_integration.pyx,sha256=RfN4O2GjxlwDXltqZTAoVSg31Q9cLCqK2XGNToOngnc,1919
|
|
35
|
+
multipers/rank_invariant.cpython-310-darwin.so,sha256=4EVoN1KCTcVhwGGLyY5xuBLWRbzUkVJK-p0ZoFGiqp4,505568
|
|
36
|
+
multipers/simplex_tree_multi.cpython-310-darwin.so,sha256=KKI4T0uI9OoFd9bWsbgJx2kAPsG7xb7IXYZUT1GmZ2Y,1074304
|
|
37
|
+
multipers/rank_invariant.pyx,sha256=ORB-ila7Bk5arE6vbbMYytFzfhJ2Wb2vGYSYTyVHOlQ,7350
|
|
38
|
+
multipers/simplex_tree_multi.pyi,sha256=2HbiG_Dwgf965gR__C94uUnNgieM5X5fPfbWjbkNkJ4,26162
|
|
39
|
+
multipers/function_rips.pyx,sha256=C1aAAR-VfM2nRVB5nBuQCWA6IP7O0fbDMmlX9man228,4973
|
|
40
|
+
multipers/hilbert_function.pyi,sha256=Od6PAT53p6ni8-WwRBPhmTz4rR-WhaT45vjGfxyrJrs,1876
|
|
41
|
+
multipers/.dylibs/libtbbmalloc.2.12.dylib,sha256=H2-sLculGFFsMaNwZsOnajsQ6LHX-vSEdLuvRvs1ZIE,306720
|
|
42
|
+
multipers/.dylibs/libtbb.12.12.dylib,sha256=7R7IDD96_V2wWA9dRQu7yDLzueKDiAsOsD7mbRQm0gE,918608
|
|
43
|
+
multipers/ml/one.py,sha256=np5jM8gywm65TsK1yeZ1BDWqP-Ym-7hz4brTXI_0imk,20119
|
|
44
|
+
multipers/ml/point_clouds.py,sha256=whln5c0XRoqZziRwMjXPxTYvFxVFWPHbdUFGcKPv5eo,7304
|
|
45
|
+
multipers/ml/signed_betti.py,sha256=0Gl8nYJv-zN6FTE_JaiARbA-ySzppRDYjFqlnjndpJg,2213
|
|
46
|
+
multipers/ml/accuracies.py,sha256=sPTNmrZ8vpBcWG62d4Jz6U9qunfExnbQUMDDQsLukwI,2331
|
|
47
|
+
multipers/ml/tools.py,sha256=5vLte1GFmAt61xFyTEUG7NwOBbkk8-3RZz9mu0md9Sg,3499
|
|
48
|
+
multipers/ml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
|
+
multipers/ml/convolutions.py,sha256=MG0-f57Mq7peoRUrUdJ_xuhTa4VMEBt-HvQ70dZPfwE,17446
|
|
50
|
+
multipers/ml/signed_measures.py,sha256=Pkwu1PnXHXrm38jWOVh2CHbfV6ARQgJuJZ8wkdBEyNc,55047
|
|
51
|
+
multipers/ml/sliced_wasserstein.py,sha256=4eIMxaPgM0oqZ3H8LcaXvLfnOXgqwWiLnYyjcl4aScU,17079
|
|
52
|
+
multipers/ml/kernels.py,sha256=adnL1Yu-5qO32Je1NFLGEHS0e4EY9OAOnckLUc0dpII,4948
|
|
53
|
+
multipers/ml/invariants_with_persistable.py,sha256=HL0_IIrcJdAmCIqcyHPg0PNLle_pa2esnGQJsK2hnHc,2261
|
|
54
|
+
multipers/ml/mma.py,sha256=NGQ2ppXpuVIxZyfNQ_OIc6pzyiFtgddNqt5YktQTdho,22686
|
|
55
|
+
multipers/data/synthetic.py,sha256=gO3gpK4QuigDeQ75NvTR1TqnVQq5B8cJcB7CoFhJjQo,2018
|
|
56
|
+
multipers/data/pytorch2simplextree.py,sha256=cvOJTUleK_qEbcpygRD77GuQl_0qDsSjjD6e6UFUDD0,3048
|
|
57
|
+
multipers/data/shape3d.py,sha256=AE-vvjKrhKxOwMo-lurUsFqqLjIg5obo-RTbRZF_5Mk,3893
|
|
58
|
+
multipers/data/minimal_presentation_to_st_bf.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
+
multipers/data/MOL2.py,sha256=Deu94qPDQFMf_qNwwtn5zYSYO2KmVBufQfUjq3NDkrI,12988
|
|
60
|
+
multipers/data/__init__.py,sha256=w7uUe4LOHbdbKU4R8MNs7em65wZJN0v5ukoG1otFanQ,24
|
|
61
|
+
multipers/data/UCR.py,sha256=PuT8l3i26y0goBzIESwdgJAe6YFCyDiWSoxECcP5rhs,798
|
|
62
|
+
multipers/data/immuno_regions.py,sha256=BNN81DOwdu6sJTkaSeziAYyx0jd0kuZZB5Se0Fo95vA,903
|
|
63
|
+
multipers/data/graphs.py,sha256=wef36QXuzi2EMQJi6W_sEB3JnShfSAbfylP6-2rLSUA,16346
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
multipers
|