multipers 2.3.3b4__cp310-cp310-win_amd64.whl → 2.3.3b5__cp310-cp310-win_amd64.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/_signed_measure_meta.py +25 -8
- multipers/array_api/__init__.py +4 -2
- multipers/array_api/numpy.py +2 -0
- multipers/array_api/torch.py +1 -0
- multipers/function_rips.cp310-win_amd64.pyd +0 -0
- multipers/grids.cp310-win_amd64.pyd +0 -0
- multipers/io.cp310-win_amd64.pyd +0 -0
- multipers/mma_structures.cp310-win_amd64.pyd +0 -0
- multipers/multiparameter_module_approximation.cp310-win_amd64.pyd +0 -0
- multipers/plots.py +2 -2
- multipers/point_measure.cp310-win_amd64.pyd +0 -0
- multipers/point_measure.pyx +71 -2
- multipers/simplex_tree_multi.cp310-win_amd64.pyd +0 -0
- multipers/slicer.cp310-win_amd64.pyd +0 -0
- multipers/slicer.pxd +20 -20
- multipers/slicer.pyx +22 -22
- {multipers-2.3.3b4.dist-info → multipers-2.3.3b5.dist-info}/METADATA +1 -1
- {multipers-2.3.3b4.dist-info → multipers-2.3.3b5.dist-info}/RECORD +21 -21
- {multipers-2.3.3b4.dist-info → multipers-2.3.3b5.dist-info}/WHEEL +0 -0
- {multipers-2.3.3b4.dist-info → multipers-2.3.3b5.dist-info}/licenses/LICENSE +0 -0
- {multipers-2.3.3b4.dist-info → multipers-2.3.3b5.dist-info}/top_level.txt +0 -0
|
@@ -3,7 +3,6 @@ from typing import Optional, Union
|
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
|
|
6
|
-
import multipers as mp
|
|
7
6
|
from multipers.grids import compute_grid, sms_in_grid
|
|
8
7
|
from multipers.plots import plot_signed_measures
|
|
9
8
|
from multipers.point_measure import clean_sms, zero_out_sms
|
|
@@ -31,7 +30,7 @@ def signed_measure(
|
|
|
31
30
|
verbose: bool = False,
|
|
32
31
|
n_jobs: int = -1,
|
|
33
32
|
expand_collapse: bool = False,
|
|
34
|
-
backend: Optional[str] = None,
|
|
33
|
+
backend: Optional[str] = None, # deprecated
|
|
35
34
|
grid: Optional[Iterable] = None,
|
|
36
35
|
coordinate_measure: bool = False,
|
|
37
36
|
num_collapses: int = 0, # TODO : deprecate
|
|
@@ -99,12 +98,21 @@ def signed_measure(
|
|
|
99
98
|
- Rank: Same as Hilbert.
|
|
100
99
|
"""
|
|
101
100
|
if backend is not None:
|
|
102
|
-
raise ValueError(
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
raise ValueError(
|
|
102
|
+
"backend is deprecated. reduce the complex before this function."
|
|
103
|
+
)
|
|
104
|
+
if num_collapses > 0:
|
|
105
|
+
raise ValueError(
|
|
106
|
+
"num_collapses is deprecated. reduce the complex before this function."
|
|
107
|
+
)
|
|
105
108
|
## TODO : add timings in verbose
|
|
106
109
|
if len(filtered_complex) == 0:
|
|
107
|
-
return [
|
|
110
|
+
return [
|
|
111
|
+
(
|
|
112
|
+
np.empty((0, 2), dtype=filtered_complex.dtype),
|
|
113
|
+
np.empty(shape=(0,), dtype=int),
|
|
114
|
+
)
|
|
115
|
+
]
|
|
108
116
|
if grid_conversion is not None:
|
|
109
117
|
grid = tuple(f for f in grid_conversion)
|
|
110
118
|
raise DeprecationWarning(
|
|
@@ -134,6 +142,8 @@ def signed_measure(
|
|
|
134
142
|
"rank",
|
|
135
143
|
"euler_characteristic",
|
|
136
144
|
"hilbert_function",
|
|
145
|
+
"rectangle",
|
|
146
|
+
"hook",
|
|
137
147
|
]
|
|
138
148
|
|
|
139
149
|
assert (
|
|
@@ -256,7 +266,7 @@ def signed_measure(
|
|
|
256
266
|
# if verbose:
|
|
257
267
|
# print("Done.")
|
|
258
268
|
else: # No backend
|
|
259
|
-
if invariant is not None and "rank" in invariant:
|
|
269
|
+
if invariant is not None and ("rank" in invariant or "hook" in invariant or "rectangle" in invariant):
|
|
260
270
|
degrees = np.asarray(degrees, dtype=int)
|
|
261
271
|
if verbose:
|
|
262
272
|
print("Computing rank...", end="")
|
|
@@ -269,6 +279,10 @@ def signed_measure(
|
|
|
269
279
|
ignore_inf=ignore_infinite_filtration_values,
|
|
270
280
|
)
|
|
271
281
|
fix_mass_default = False
|
|
282
|
+
|
|
283
|
+
if "hook" in invariant:
|
|
284
|
+
from multipers.point_measure import rectangle_to_hook_minimal_signed_barcode
|
|
285
|
+
sms = [rectangle_to_hook_minimal_signed_barcode(pts,w) for pts,w in sms]
|
|
272
286
|
if verbose:
|
|
273
287
|
print("Done.")
|
|
274
288
|
elif filtered_complex_.is_minpres:
|
|
@@ -315,7 +329,7 @@ def signed_measure(
|
|
|
315
329
|
if verbose:
|
|
316
330
|
print("Input is a simplextree.")
|
|
317
331
|
## we still have a simplextree here
|
|
318
|
-
if invariant in ["rank_invariant", "rank"]:
|
|
332
|
+
if invariant in ["rank_invariant", "rank", "hook", "rectangle"]:
|
|
319
333
|
if verbose:
|
|
320
334
|
print("Computing rank invariant...", end="")
|
|
321
335
|
assert (
|
|
@@ -331,6 +345,9 @@ def signed_measure(
|
|
|
331
345
|
expand_collapse=expand_collapse,
|
|
332
346
|
)
|
|
333
347
|
fix_mass_default = False
|
|
348
|
+
if "hook" in invariant:
|
|
349
|
+
from multipers.point_measure import rectangle_to_hook_minimal_signed_barcode
|
|
350
|
+
sms = [rectangle_to_hook_minimal_signed_barcode(pts,w) for pts,w in sms]
|
|
334
351
|
if verbose:
|
|
335
352
|
print("Done.")
|
|
336
353
|
elif len(degrees) == 1 and degrees[0] is None:
|
multipers/array_api/__init__.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import multipers.array_api.numpy as npapi
|
|
2
|
+
|
|
3
3
|
|
|
4
|
+
def api_from_tensor(x, *, verbose: bool = False):
|
|
4
5
|
if npapi.is_promotable(x):
|
|
5
6
|
if verbose:
|
|
6
7
|
print("using numpy backend")
|
|
@@ -38,6 +39,7 @@ def api_from_tensors(*args):
|
|
|
38
39
|
return torchapi
|
|
39
40
|
raise ValueError(f"Incompatible types got {[type(x) for x in args]=}.")
|
|
40
41
|
|
|
42
|
+
|
|
41
43
|
def to_numpy(x):
|
|
42
44
|
api = api_from_tensor(x)
|
|
43
45
|
return api.asnumpy(x)
|
multipers/array_api/numpy.py
CHANGED
multipers/array_api/torch.py
CHANGED
|
Binary file
|
|
Binary file
|
multipers/io.cp310-win_amd64.pyd
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
multipers/plots.py
CHANGED
|
@@ -84,7 +84,7 @@ def _plot_signed_measure_4(
|
|
|
84
84
|
pts = np.clip(pts, a_min=-np.inf, a_max=np.array((*threshold, *threshold))[None, :])
|
|
85
85
|
alpha_rescaling = 0
|
|
86
86
|
for rectangle, weight in zip(pts, weights):
|
|
87
|
-
if rectangle[2]
|
|
87
|
+
if rectangle[2] >= x_smoothing * rectangle[0]:
|
|
88
88
|
alpha_rescaling = max(
|
|
89
89
|
alpha_rescaling,
|
|
90
90
|
(rectangle[2] / x_smoothing - rectangle[0])
|
|
@@ -93,7 +93,7 @@ def _plot_signed_measure_4(
|
|
|
93
93
|
# draw the rectangles
|
|
94
94
|
for rectangle, weight in zip(pts, weights):
|
|
95
95
|
# draw only the rectangles that have not been reduced to the empty set
|
|
96
|
-
if rectangle[2]
|
|
96
|
+
if rectangle[2] >= x_smoothing * rectangle[0]:
|
|
97
97
|
# make the alpha channel proportional to the rectangle's area
|
|
98
98
|
if area_alpha:
|
|
99
99
|
_plot_rectangle(
|
|
Binary file
|
multipers/point_measure.pyx
CHANGED
|
@@ -11,6 +11,7 @@ from collections import defaultdict
|
|
|
11
11
|
cnp.import_array()
|
|
12
12
|
from scipy import sparse
|
|
13
13
|
|
|
14
|
+
from multipers.array_api import api_from_tensor
|
|
14
15
|
|
|
15
16
|
import multipers.grids as mpg
|
|
16
17
|
|
|
@@ -31,7 +32,6 @@ import cython
|
|
|
31
32
|
cimport cython
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
|
|
35
35
|
# from scipy.sparse import coo_array
|
|
36
36
|
# from scipy.ndimage import convolve1d
|
|
37
37
|
|
|
@@ -169,7 +169,7 @@ def sparsify(x):
|
|
|
169
169
|
|
|
170
170
|
@cython.boundscheck(False)
|
|
171
171
|
@cython.wraparound(False)
|
|
172
|
-
def
|
|
172
|
+
def clean_signed_measure_old(some_float[:,:] pts, some_int[:] weights, dtype = np.float32):
|
|
173
173
|
"""
|
|
174
174
|
Sum the diracs at the same locations. i.e.,
|
|
175
175
|
returns the minimal sized measure to represent the input.
|
|
@@ -190,6 +190,14 @@ def clean_signed_measure(some_float[:,:] pts, some_int[:] weights, dtype = np.fl
|
|
|
190
190
|
new_weights = new_weights[idx]
|
|
191
191
|
return (new_pts, new_weights)
|
|
192
192
|
|
|
193
|
+
def clean_signed_measure(pts, w, dtype=np.int32):
|
|
194
|
+
api = api_from_tensor(pts)
|
|
195
|
+
_, idx, inv = np.unique(api.asnumpy(pts), return_index=True, return_inverse=True, axis=0)
|
|
196
|
+
new_w = np.bincount(inv, weights=w).astype(w.dtype)
|
|
197
|
+
pts, w = pts[idx], new_w
|
|
198
|
+
idx = w!=0
|
|
199
|
+
return pts[idx],w[idx]
|
|
200
|
+
|
|
193
201
|
def clean_sms(sms):
|
|
194
202
|
"""
|
|
195
203
|
Sum the diracs at the same locations. i.e.,
|
|
@@ -324,3 +332,64 @@ def estimate_rank_from_rank_sm(sm:tuple, a, b)->np.int64:
|
|
|
324
332
|
return w[idx].sum()
|
|
325
333
|
|
|
326
334
|
|
|
335
|
+
def rectangle_to_hook_minimal_signed_barcode(pts,w,):
|
|
336
|
+
if pts.shape[1] != 4:
|
|
337
|
+
raise NotImplementedError(
|
|
338
|
+
"Only works for 2-parameter persistence modules for the moment."
|
|
339
|
+
)
|
|
340
|
+
api = api_from_tensor(pts)
|
|
341
|
+
pts = api.astensor(pts)
|
|
342
|
+
w = np.asarray(w)
|
|
343
|
+
## [a,b], [a, a0b1], [a,b0a1], proj, V,H
|
|
344
|
+
|
|
345
|
+
projectives_idx = (pts[:,3] == np.inf) * (pts[:,2] == np.inf)
|
|
346
|
+
pts_proj = pts[projectives_idx]
|
|
347
|
+
w_proj = w[projectives_idx]
|
|
348
|
+
pts = pts[~projectives_idx]
|
|
349
|
+
w = w[~projectives_idx]
|
|
350
|
+
# print("projectives:", pts_proj)
|
|
351
|
+
|
|
352
|
+
vert_blocks_idx = pts[:,3] == np.inf
|
|
353
|
+
pts_V = pts[vert_blocks_idx]
|
|
354
|
+
w_V = w[vert_blocks_idx]
|
|
355
|
+
pts_V[:,3] = pts_V[:,1]
|
|
356
|
+
pts = pts[~vert_blocks_idx]
|
|
357
|
+
w = w[~vert_blocks_idx]
|
|
358
|
+
# print("vertical:", pts_V)
|
|
359
|
+
|
|
360
|
+
h_idx = pts[:,2] == np.inf
|
|
361
|
+
pts_H = pts[h_idx]
|
|
362
|
+
w_H = w[h_idx]
|
|
363
|
+
pts_H[:,2] = pts_H[:,0]
|
|
364
|
+
pts = pts[~h_idx]
|
|
365
|
+
w = w[~h_idx]
|
|
366
|
+
# print("horizontal:", pts_H)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
new_w = api.cat([-w, w, w, w_proj,w_V,w_H])
|
|
370
|
+
|
|
371
|
+
pts_b0a1 = api.tensor(pts)
|
|
372
|
+
pts_b0a1[:,3] = pts[:,1]
|
|
373
|
+
pts_a0b1 = api.tensor(pts)
|
|
374
|
+
pts_a0b1[:,2] = pts[:,0]
|
|
375
|
+
|
|
376
|
+
new_pts = api.cat([
|
|
377
|
+
pts,
|
|
378
|
+
pts_b0a1,
|
|
379
|
+
pts_a0b1,
|
|
380
|
+
pts_proj,
|
|
381
|
+
pts_V,
|
|
382
|
+
pts_H
|
|
383
|
+
], axis=0)
|
|
384
|
+
# pts,w = new_pts,new_w
|
|
385
|
+
pts,w = clean_signed_measure(new_pts,new_w)
|
|
386
|
+
|
|
387
|
+
# Everything infinite is handled separately anyway
|
|
388
|
+
# inf0 = pts[:,2] == np.inf
|
|
389
|
+
# inf1 = pts[:,3] == np.inf
|
|
390
|
+
# pts[inf0,3] = pts[inf0,1]
|
|
391
|
+
# pts[inf1,2] = pts[inf1,0]
|
|
392
|
+
# pts,w = clean_signed_measure(pts,w)
|
|
393
|
+
|
|
394
|
+
return pts,w
|
|
395
|
+
|
|
Binary file
|
|
Binary file
|
multipers/slicer.pxd
CHANGED
|
@@ -2013,51 +2013,51 @@ cdef extern from "multiparameter_module_approximation/approximation.h" namespace
|
|
|
2013
2013
|
|
|
2014
2014
|
import multipers.slicer as mps
|
|
2015
2015
|
from cython.operator cimport dereference
|
|
2016
|
-
cdef inline Module[
|
|
2016
|
+
cdef inline Module[double] _multiparameter_module_approximation_f64(object slicer, One_critical_filtration[double] direction, double max_error, Box[double] box, bool threshold, bool complete, bool verbose):
|
|
2017
2017
|
import multipers.slicer as mps
|
|
2018
2018
|
cdef intptr_t slicer_ptr = <intptr_t>(slicer.get_ptr())
|
|
2019
|
-
cdef Module[
|
|
2019
|
+
cdef Module[double] mod
|
|
2020
2020
|
if False:
|
|
2021
2021
|
pass
|
|
2022
|
-
elif isinstance(slicer, mps.
|
|
2022
|
+
elif isinstance(slicer, mps._KSlicer_Matrix0_vine_f64):
|
|
2023
2023
|
with nogil:
|
|
2024
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2024
|
+
mod = multiparameter_module_approximation(dereference(<C_KSlicer_Matrix0_vine_f64*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2025
2025
|
return mod
|
|
2026
|
-
elif isinstance(slicer, mps.
|
|
2026
|
+
elif isinstance(slicer, mps._KSlicer_Matrix1_vine_f64):
|
|
2027
2027
|
with nogil:
|
|
2028
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2028
|
+
mod = multiparameter_module_approximation(dereference(<C_KSlicer_Matrix1_vine_f64*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2029
2029
|
return mod
|
|
2030
|
-
elif isinstance(slicer, mps.
|
|
2030
|
+
elif isinstance(slicer, mps._Slicer_Matrix0_vine_f64):
|
|
2031
2031
|
with nogil:
|
|
2032
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2032
|
+
mod = multiparameter_module_approximation(dereference(<C_Slicer_Matrix0_vine_f64*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2033
2033
|
return mod
|
|
2034
|
-
elif isinstance(slicer, mps.
|
|
2034
|
+
elif isinstance(slicer, mps._Slicer_Matrix1_vine_f64):
|
|
2035
2035
|
with nogil:
|
|
2036
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2036
|
+
mod = multiparameter_module_approximation(dereference(<C_Slicer_Matrix1_vine_f64*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2037
2037
|
return mod
|
|
2038
2038
|
else:
|
|
2039
2039
|
raise ValueError(f"Unsupported slicer type {type(slicer)}")
|
|
2040
|
-
cdef inline Module[
|
|
2040
|
+
cdef inline Module[float] _multiparameter_module_approximation_f32(object slicer, One_critical_filtration[float] direction, float max_error, Box[float] box, bool threshold, bool complete, bool verbose):
|
|
2041
2041
|
import multipers.slicer as mps
|
|
2042
2042
|
cdef intptr_t slicer_ptr = <intptr_t>(slicer.get_ptr())
|
|
2043
|
-
cdef Module[
|
|
2043
|
+
cdef Module[float] mod
|
|
2044
2044
|
if False:
|
|
2045
2045
|
pass
|
|
2046
|
-
elif isinstance(slicer, mps.
|
|
2046
|
+
elif isinstance(slicer, mps._KSlicer_Matrix0_vine_f32):
|
|
2047
2047
|
with nogil:
|
|
2048
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2048
|
+
mod = multiparameter_module_approximation(dereference(<C_KSlicer_Matrix0_vine_f32*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2049
2049
|
return mod
|
|
2050
|
-
elif isinstance(slicer, mps.
|
|
2050
|
+
elif isinstance(slicer, mps._KSlicer_Matrix1_vine_f32):
|
|
2051
2051
|
with nogil:
|
|
2052
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2052
|
+
mod = multiparameter_module_approximation(dereference(<C_KSlicer_Matrix1_vine_f32*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2053
2053
|
return mod
|
|
2054
|
-
elif isinstance(slicer, mps.
|
|
2054
|
+
elif isinstance(slicer, mps._Slicer_Matrix0_vine_f32):
|
|
2055
2055
|
with nogil:
|
|
2056
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2056
|
+
mod = multiparameter_module_approximation(dereference(<C_Slicer_Matrix0_vine_f32*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2057
2057
|
return mod
|
|
2058
|
-
elif isinstance(slicer, mps.
|
|
2058
|
+
elif isinstance(slicer, mps._Slicer_Matrix1_vine_f32):
|
|
2059
2059
|
with nogil:
|
|
2060
|
-
mod = multiparameter_module_approximation(dereference(<
|
|
2060
|
+
mod = multiparameter_module_approximation(dereference(<C_Slicer_Matrix1_vine_f32*>(slicer_ptr)), direction, max_error, box, threshold, complete, verbose)
|
|
2061
2061
|
return mod
|
|
2062
2062
|
else:
|
|
2063
2063
|
raise ValueError(f"Unsupported slicer type {type(slicer)}")
|
multipers/slicer.pyx
CHANGED
|
@@ -19876,7 +19876,7 @@ cdef extern from "gudhi/cubical_to_boundary.h" namespace "":
|
|
|
19876
19876
|
void _to_boundary(const vector[unsigned int]&, vector[vector[unsigned int]]&, vector[int]&) except + nogil
|
|
19877
19877
|
void get_vertices(unsigned int, cset[unsigned int]&, const vector[vector[unsigned int]]&) nogil
|
|
19878
19878
|
|
|
19879
|
-
def
|
|
19879
|
+
def _from_bitmapf32(image, **slicer_kwargs):
|
|
19880
19880
|
from multipers import Slicer
|
|
19881
19881
|
dtype = slicer_kwargs.get("dtype", image.dtype)
|
|
19882
19882
|
slicer_kwargs["dtype"] = dtype
|
|
@@ -19894,9 +19894,9 @@ def _from_bitmapf64(image, **slicer_kwargs):
|
|
|
19894
19894
|
cdef cset[unsigned int] vertices
|
|
19895
19895
|
|
|
19896
19896
|
cdef unsigned int num_gens = gen_dims.size()
|
|
19897
|
-
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.
|
|
19898
|
-
cdef
|
|
19899
|
-
cdef
|
|
19897
|
+
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.float32) - _Slicer._inf_value()
|
|
19898
|
+
cdef float[:,:] F = filtration_values
|
|
19899
|
+
cdef float[:,:] c_img = image.reshape(-1,num_parameters)
|
|
19900
19900
|
with nogil:
|
|
19901
19901
|
for i in range(num_gens):
|
|
19902
19902
|
# with gil:
|
|
@@ -19914,7 +19914,7 @@ def _from_bitmapf64(image, **slicer_kwargs):
|
|
|
19914
19914
|
# print(f"F = {np.asarray(F[i])}")
|
|
19915
19915
|
slicer = _Slicer(gen_maps, gen_dims, filtration_values)
|
|
19916
19916
|
return slicer
|
|
19917
|
-
def
|
|
19917
|
+
def _from_bitmapi32(image, **slicer_kwargs):
|
|
19918
19918
|
from multipers import Slicer
|
|
19919
19919
|
dtype = slicer_kwargs.get("dtype", image.dtype)
|
|
19920
19920
|
slicer_kwargs["dtype"] = dtype
|
|
@@ -19932,9 +19932,9 @@ def _from_bitmapi64(image, **slicer_kwargs):
|
|
|
19932
19932
|
cdef cset[unsigned int] vertices
|
|
19933
19933
|
|
|
19934
19934
|
cdef unsigned int num_gens = gen_dims.size()
|
|
19935
|
-
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.
|
|
19936
|
-
cdef
|
|
19937
|
-
cdef
|
|
19935
|
+
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.int32) - _Slicer._inf_value()
|
|
19936
|
+
cdef int32_t[:,:] F = filtration_values
|
|
19937
|
+
cdef int32_t[:,:] c_img = image.reshape(-1,num_parameters)
|
|
19938
19938
|
with nogil:
|
|
19939
19939
|
for i in range(num_gens):
|
|
19940
19940
|
# with gil:
|
|
@@ -19952,7 +19952,7 @@ def _from_bitmapi64(image, **slicer_kwargs):
|
|
|
19952
19952
|
# print(f"F = {np.asarray(F[i])}")
|
|
19953
19953
|
slicer = _Slicer(gen_maps, gen_dims, filtration_values)
|
|
19954
19954
|
return slicer
|
|
19955
|
-
def
|
|
19955
|
+
def _from_bitmapi64(image, **slicer_kwargs):
|
|
19956
19956
|
from multipers import Slicer
|
|
19957
19957
|
dtype = slicer_kwargs.get("dtype", image.dtype)
|
|
19958
19958
|
slicer_kwargs["dtype"] = dtype
|
|
@@ -19970,9 +19970,9 @@ def _from_bitmapi32(image, **slicer_kwargs):
|
|
|
19970
19970
|
cdef cset[unsigned int] vertices
|
|
19971
19971
|
|
|
19972
19972
|
cdef unsigned int num_gens = gen_dims.size()
|
|
19973
|
-
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.
|
|
19974
|
-
cdef
|
|
19975
|
-
cdef
|
|
19973
|
+
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.int64) - _Slicer._inf_value()
|
|
19974
|
+
cdef int64_t[:,:] F = filtration_values
|
|
19975
|
+
cdef int64_t[:,:] c_img = image.reshape(-1,num_parameters)
|
|
19976
19976
|
with nogil:
|
|
19977
19977
|
for i in range(num_gens):
|
|
19978
19978
|
# with gil:
|
|
@@ -19990,7 +19990,7 @@ def _from_bitmapi32(image, **slicer_kwargs):
|
|
|
19990
19990
|
# print(f"F = {np.asarray(F[i])}")
|
|
19991
19991
|
slicer = _Slicer(gen_maps, gen_dims, filtration_values)
|
|
19992
19992
|
return slicer
|
|
19993
|
-
def
|
|
19993
|
+
def _from_bitmapf64(image, **slicer_kwargs):
|
|
19994
19994
|
from multipers import Slicer
|
|
19995
19995
|
dtype = slicer_kwargs.get("dtype", image.dtype)
|
|
19996
19996
|
slicer_kwargs["dtype"] = dtype
|
|
@@ -20008,9 +20008,9 @@ def _from_bitmapf32(image, **slicer_kwargs):
|
|
|
20008
20008
|
cdef cset[unsigned int] vertices
|
|
20009
20009
|
|
|
20010
20010
|
cdef unsigned int num_gens = gen_dims.size()
|
|
20011
|
-
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.
|
|
20012
|
-
cdef
|
|
20013
|
-
cdef
|
|
20011
|
+
filtration_values = np.zeros(shape=(num_gens, num_parameters), dtype = np.float64) - _Slicer._inf_value()
|
|
20012
|
+
cdef double[:,:] F = filtration_values
|
|
20013
|
+
cdef double[:,:] c_img = image.reshape(-1,num_parameters)
|
|
20014
20014
|
with nogil:
|
|
20015
20015
|
for i in range(num_gens):
|
|
20016
20016
|
# with gil:
|
|
@@ -20031,14 +20031,14 @@ def _from_bitmapf32(image, **slicer_kwargs):
|
|
|
20031
20031
|
|
|
20032
20032
|
def from_bitmap(img, **kwargs):
|
|
20033
20033
|
img = np.asarray(img)
|
|
20034
|
-
if img.dtype == np.float64:
|
|
20035
|
-
return _from_bitmapf64(img, **kwargs)
|
|
20036
|
-
if img.dtype == np.int64:
|
|
20037
|
-
return _from_bitmapi64(img, **kwargs)
|
|
20038
|
-
if img.dtype == np.int32:
|
|
20039
|
-
return _from_bitmapi32(img, **kwargs)
|
|
20040
20034
|
if img.dtype == np.float32:
|
|
20041
20035
|
return _from_bitmapf32(img, **kwargs)
|
|
20036
|
+
if img.dtype == np.int32:
|
|
20037
|
+
return _from_bitmapi32(img, **kwargs)
|
|
20038
|
+
if img.dtype == np.int64:
|
|
20039
|
+
return _from_bitmapi64(img, **kwargs)
|
|
20040
|
+
if img.dtype == np.float64:
|
|
20041
|
+
return _from_bitmapf64(img, **kwargs)
|
|
20042
20042
|
raise ValueError(f"Invalid dtype. Got {img.dtype=}, was expecting {available_dtype=}.")
|
|
20043
20043
|
|
|
20044
20044
|
def from_function_delaunay(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: multipers
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.3b5
|
|
4
4
|
Summary: Multiparameter Topological Persistence for Machine Learning
|
|
5
5
|
Author-email: David Loiseaux <david.lapous@proton.me>, Hannah Schreiber <hannah.schreiber@inria.fr>
|
|
6
6
|
Maintainer-email: David Loiseaux <david.lapous@proton.me>
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
multipers/__init__.py,sha256=y4BfbXAY2M2yZYob758IegZHwIbRgmKrph6lwe6WR6Q,733
|
|
2
|
-
multipers/_signed_measure_meta.py,sha256=
|
|
2
|
+
multipers/_signed_measure_meta.py,sha256=fscSXOekUX_TkxucOKpb3oNJoct_IrjMZcqiwxPvmSY,17930
|
|
3
3
|
multipers/_slicer_meta.py,sha256=mjIGR-B6HnQLSiMowEQ8EWQkD_IF3bBnDVzvwrZugZ4,7203
|
|
4
4
|
multipers/distances.py,sha256=uAZj2GtUQp50OxN2qU7sl2JqsmJ74IG9j5tZapLO2Us,6220
|
|
5
5
|
multipers/filtration_conversions.pxd,sha256=Je7a3F4zS1PQn6Ul1YCXgA6p39X2FouStru-XtN-aOw,10800
|
|
6
6
|
multipers/filtration_conversions.pxd.tp,sha256=_9tUvZVUA7J_RUM3q7BxY48fYgDHCUA7Xhy4nBfLLs0,3309
|
|
7
7
|
multipers/filtrations.pxd,sha256=08ONkZNCjs8Nme8lcD9myPz-K662sA-EDpSwzgC2_ts,9461
|
|
8
|
-
multipers/function_rips.cp310-win_amd64.pyd,sha256=
|
|
8
|
+
multipers/function_rips.cp310-win_amd64.pyd,sha256=TDyyzw9eN85SozGdg6Aqy9vgrO_jeKUiA8Xf2HPnv0M,329728
|
|
9
9
|
multipers/function_rips.pyx,sha256=j5NjbK3YrAv_2s8YHB1JB0k6m9NC7RQCSFlJe-w_kgE,5252
|
|
10
|
-
multipers/grids.cp310-win_amd64.pyd,sha256=
|
|
10
|
+
multipers/grids.cp310-win_amd64.pyd,sha256=jDpMdmmTSRfwHGAJmOGwIf5ErPl4CdUYJcSWlc0a8O0,478720
|
|
11
11
|
multipers/grids.pyx,sha256=ONN_RKkuxqwb9IaS9gd42FUGaiBLc8QWcd3L-ubZjKE,16575
|
|
12
|
-
multipers/io.cp310-win_amd64.pyd,sha256=
|
|
12
|
+
multipers/io.cp310-win_amd64.pyd,sha256=z4BQuigRTtDKshw620zayhmFpIa4a8nii5ff75kGN6s,223232
|
|
13
13
|
multipers/io.pyx,sha256=pQBH_rSqaCZqDSxTLnhlyECP3fLbX2tR_RKJHydHm_0,22210
|
|
14
|
-
multipers/mma_structures.cp310-win_amd64.pyd,sha256=
|
|
14
|
+
multipers/mma_structures.cp310-win_amd64.pyd,sha256=P12FSaq7bI6mi5WW0U6j-_HySnmRhmY3LOiXGMujXVE,1324544
|
|
15
15
|
multipers/mma_structures.pxd,sha256=jh1QnQRidt_VK0CK7losQi6rAl_1qG5DNuR23J42pUA,6595
|
|
16
16
|
multipers/mma_structures.pyx,sha256=4zNC6ePfFKMvx0MrH-FqJVouyTMciRc49oevKDnsJhI,109530
|
|
17
17
|
multipers/mma_structures.pyx.tp,sha256=hWuuk9USDFa8CbQVRHNjWSAdGgpkWKvSCNjTtVuSzwM,42299
|
|
18
18
|
multipers/multiparameter_edge_collapse.py,sha256=MFt0eKQQSv2354omeIqOmzASYTKIMsYdxZHFZauQr8g,1229
|
|
19
|
-
multipers/multiparameter_module_approximation.cp310-win_amd64.pyd,sha256
|
|
19
|
+
multipers/multiparameter_module_approximation.cp310-win_amd64.pyd,sha256=-nOjq5SvC53Ub9_9RjqCIhcSRZ9rqt8Jbd_3axzU3SU,447488
|
|
20
20
|
multipers/multiparameter_module_approximation.pyx,sha256=wp7la7Z9wBngnfw6WOVddf93mPyXf4HfNT6dKW2Z0r0,9030
|
|
21
21
|
multipers/pickle.py,sha256=YYVt4iHiD16E1x5Yn_4mX6P5P8rKi56pNGjJo5IzPhc,2579
|
|
22
|
-
multipers/plots.py,sha256=
|
|
23
|
-
multipers/point_measure.cp310-win_amd64.pyd,sha256=
|
|
24
|
-
multipers/point_measure.pyx,sha256=
|
|
25
|
-
multipers/simplex_tree_multi.cp310-win_amd64.pyd,sha256=
|
|
22
|
+
multipers/plots.py,sha256=zkJww-QCU7Ru22KhIa5xIi9zztWm-_tYjO0enP8ahBs,14721
|
|
23
|
+
multipers/point_measure.cp310-win_amd64.pyd,sha256=67Fgpe6ov73lq5UfUOWjI4N4fDVBVHR-lkM8UgZmjmE,620032
|
|
24
|
+
multipers/point_measure.pyx,sha256=ovpyvjMdOPBOK_0TT0VoK4b2t8m5InFdKmRBB6biTts,14077
|
|
25
|
+
multipers/simplex_tree_multi.cp310-win_amd64.pyd,sha256=XJWdN5V0wGEjdNVaorcOLLLG21GnNMM6U2HZI8__X_U,3756032
|
|
26
26
|
multipers/simplex_tree_multi.pxd,sha256=KpyDEQNPoMC2sOU9-d4LtrGXx_UVCJGxMJ1kk1AzHgU,6631
|
|
27
27
|
multipers/simplex_tree_multi.pyx,sha256=reHyva5AR1lOQyiCs2_jQ2XfwHtktcQ1nmY_BNmyxhk,498156
|
|
28
28
|
multipers/simplex_tree_multi.pyx.tp,sha256=fUTuIscfDlNjsImWU1YALVZ1Mf9OEkdl-IFKcRQqalI,89202
|
|
29
|
-
multipers/slicer.cp310-win_amd64.pyd,sha256=
|
|
30
|
-
multipers/slicer.pxd,sha256=
|
|
29
|
+
multipers/slicer.cp310-win_amd64.pyd,sha256=7e7m0il8Y8CHUUh2Krb4YvDnXcxfzU6nxjYiT4OgWPY,11618816
|
|
30
|
+
multipers/slicer.pxd,sha256=fzA-lL_QWyUMf9rRSpcKG35QNS9UXEmVC9r7kR0geho,185230
|
|
31
31
|
multipers/slicer.pxd.tp,sha256=fLOUPtPGqiY9o1fPDyc_whBrgKLh_6HVfvl7OtE-34Y,10243
|
|
32
|
-
multipers/slicer.pyx,sha256=
|
|
32
|
+
multipers/slicer.pyx,sha256=SYjCsYtPY-16fwABZvZncNJ3tKU5shVkx_WCvqs467U,894041
|
|
33
33
|
multipers/slicer.pyx.tp,sha256=jZOdsHKMpq0nclmvlzkZUDzdjffT3_mFDVY_mnsl9Es,44523
|
|
34
34
|
multipers/tbb12.dll,sha256=6AsPR4GauU53hj2xqJNM0SfLkCKCDskjy-uKeS01tCk,338944
|
|
35
35
|
multipers/tbbbind_2_5.dll,sha256=8TtH7JJZlCEKF0UwfyJoiyrFt9utOI_x5AFOxpP-pGw,23040
|
|
@@ -37,9 +37,9 @@ multipers/tbbmalloc.dll,sha256=1MRBYYNzNcooog8__yuLq40l7kSgZ4lkNZhDFfTWM8A,11264
|
|
|
37
37
|
multipers/tbbmalloc_proxy.dll,sha256=fcM6szEVHayvxKW8sPUTWoqEZx1_4FbWni81hbOcbi4,31232
|
|
38
38
|
multipers/tensor.pxd,sha256=MSmaMU0sOP9CHLmg4dym7nOGaI1S4cOdM01TQ9flI54,417
|
|
39
39
|
multipers/test.pyx,sha256=-g7WU-jKrZK8H0c-6eAPsfrApjvTKrUoswVYFu8LoV4,1798
|
|
40
|
-
multipers/array_api/__init__.py,sha256=
|
|
41
|
-
multipers/array_api/numpy.py,sha256=
|
|
42
|
-
multipers/array_api/torch.py,sha256=
|
|
40
|
+
multipers/array_api/__init__.py,sha256=072Lk60jfw3re6iCY3EorteHEoQ7vbUgpMpuGCpfh04,1109
|
|
41
|
+
multipers/array_api/numpy.py,sha256=hhCyMH_jNZhCJeY35RX498AWgHSryZ8DCCgfnzZ1cek,677
|
|
42
|
+
multipers/array_api/torch.py,sha256=J-OjqM4rDLvjSjY2uriBdUcOOb75p-IF17C5stdJHVg,589
|
|
43
43
|
multipers/data/MOL2.py,sha256=nLZHy2OSFN9Z2uJKsbqWOEG2R7G-uH6dCLHG48UjvR4,15428
|
|
44
44
|
multipers/data/UCR.py,sha256=PuT8l3i26y0goBzIESwdgJAe6YFCyDiWSoxECcP5rhs,798
|
|
45
45
|
multipers/data/__init__.py,sha256=w7uUe4LOHbdbKU4R8MNs7em65wZJN0v5ukoG1otFanQ,24
|
|
@@ -178,8 +178,8 @@ multipers/tests/__init__.py,sha256=-7Fj-zFAfBJv18trg0CPglQTmYu_ehySZGqtJzPlN8U,1
|
|
|
178
178
|
multipers/torch/__init__.py,sha256=OLxIiZ389uCqehpUxBPUI_x1SYu531onc4tiTscAuIw,27
|
|
179
179
|
multipers/torch/diff_grids.py,sha256=2YK-c351tBpj8sfzjf26fbE1l0xlWse7oVVfDHD3zwM,7492
|
|
180
180
|
multipers/torch/rips_density.py,sha256=H-kmSzY8hXhmVn15Oltc71DHs1IUHg5oPRgNyWW8L4Q,11706
|
|
181
|
-
multipers-2.3.
|
|
182
|
-
multipers-2.3.
|
|
183
|
-
multipers-2.3.
|
|
184
|
-
multipers-2.3.
|
|
185
|
-
multipers-2.3.
|
|
181
|
+
multipers-2.3.3b5.dist-info/licenses/LICENSE,sha256=UsQRnvlo_9wpQS9DNt52GEraERHwK2GIRwuqr2Yv5JI,1071
|
|
182
|
+
multipers-2.3.3b5.dist-info/METADATA,sha256=bsID4OmdjPhV5Hi8YB2y1x9Sr5SWsjTmQ5XN-Oeysjg,9817
|
|
183
|
+
multipers-2.3.3b5.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
|
|
184
|
+
multipers-2.3.3b5.dist-info/top_level.txt,sha256=L9e0AGmhRzrNw9FpuUx-zlqi5NcBOmrI9wYY8kYWr8A,10
|
|
185
|
+
multipers-2.3.3b5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|