multipers 2.2.3__cp311-cp311-win_amd64.whl → 2.3.0__cp311-cp311-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/__init__.py +33 -31
- multipers/_signed_measure_meta.py +430 -430
- multipers/_slicer_meta.py +211 -212
- multipers/data/MOL2.py +458 -458
- multipers/data/UCR.py +18 -18
- multipers/data/graphs.py +466 -466
- multipers/data/immuno_regions.py +27 -27
- multipers/data/pytorch2simplextree.py +90 -90
- multipers/data/shape3d.py +101 -101
- multipers/data/synthetic.py +113 -111
- multipers/distances.py +198 -198
- multipers/filtration_conversions.pxd.tp +84 -84
- multipers/filtrations/__init__.py +18 -0
- multipers/filtrations/filtrations.py +289 -0
- multipers/filtrations.pxd +224 -224
- multipers/function_rips.cp311-win_amd64.pyd +0 -0
- multipers/function_rips.pyx +105 -105
- multipers/grids.cp311-win_amd64.pyd +0 -0
- multipers/grids.pyx +350 -350
- multipers/gudhi/Persistence_slices_interface.h +132 -132
- multipers/gudhi/Simplex_tree_interface.h +239 -245
- multipers/gudhi/Simplex_tree_multi_interface.h +516 -561
- multipers/gudhi/cubical_to_boundary.h +59 -59
- multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -450
- multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -1070
- multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -579
- multipers/gudhi/gudhi/Debug_utils.h +45 -45
- multipers/gudhi/gudhi/Fields/Multi_field.h +484 -484
- multipers/gudhi/gudhi/Fields/Multi_field_operators.h +455 -455
- multipers/gudhi/gudhi/Fields/Multi_field_shared.h +450 -450
- multipers/gudhi/gudhi/Fields/Multi_field_small.h +531 -531
- multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +507 -507
- multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +531 -531
- multipers/gudhi/gudhi/Fields/Z2_field.h +355 -355
- multipers/gudhi/gudhi/Fields/Z2_field_operators.h +376 -376
- multipers/gudhi/gudhi/Fields/Zp_field.h +420 -420
- multipers/gudhi/gudhi/Fields/Zp_field_operators.h +400 -400
- multipers/gudhi/gudhi/Fields/Zp_field_shared.h +418 -418
- multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -337
- multipers/gudhi/gudhi/Matrix.h +2107 -2107
- multipers/gudhi/gudhi/Multi_critical_filtration.h +1038 -1038
- multipers/gudhi/gudhi/Multi_persistence/Box.h +171 -171
- multipers/gudhi/gudhi/Multi_persistence/Line.h +282 -282
- multipers/gudhi/gudhi/Off_reader.h +173 -173
- multipers/gudhi/gudhi/One_critical_filtration.h +1432 -1431
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +769 -769
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +686 -686
- multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +842 -842
- multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1350 -1350
- multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1105 -1105
- multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +859 -859
- multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +910 -910
- multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +139 -139
- multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +230 -230
- multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +211 -211
- multipers/gudhi/gudhi/Persistence_matrix/boundary_cell_position_to_id_mapper.h +60 -60
- multipers/gudhi/gudhi/Persistence_matrix/boundary_face_position_to_id_mapper.h +60 -60
- multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +136 -136
- multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +190 -190
- multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +616 -616
- multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +150 -150
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +106 -106
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +219 -219
- multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +327 -327
- multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1140 -1140
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +934 -934
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +934 -934
- multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +980 -980
- multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1092 -1092
- multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +192 -192
- multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +921 -921
- multipers/gudhi/gudhi/Persistence_matrix/columns/small_vector_column.h +1093 -1093
- multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +1012 -1012
- multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1244 -1244
- multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +186 -186
- multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +164 -164
- multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +156 -156
- multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +376 -376
- multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +540 -540
- multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -118
- multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -173
- multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -128
- multipers/gudhi/gudhi/Persistent_cohomology.h +745 -745
- multipers/gudhi/gudhi/Points_off_io.h +171 -171
- multipers/gudhi/gudhi/Simple_object_pool.h +69 -69
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +463 -463
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -83
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +106 -106
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -277
- multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -62
- multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -27
- multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +62 -62
- multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +157 -157
- multipers/gudhi/gudhi/Simplex_tree.h +2794 -2794
- multipers/gudhi/gudhi/Simplex_tree_multi.h +152 -163
- multipers/gudhi/gudhi/distance_functions.h +62 -62
- multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -104
- multipers/gudhi/gudhi/persistence_interval.h +253 -253
- multipers/gudhi/gudhi/persistence_matrix_options.h +170 -170
- multipers/gudhi/gudhi/reader_utils.h +367 -367
- multipers/gudhi/mma_interface_coh.h +256 -255
- multipers/gudhi/mma_interface_h0.h +223 -231
- multipers/gudhi/mma_interface_matrix.h +284 -282
- multipers/gudhi/naive_merge_tree.h +536 -575
- multipers/gudhi/scc_io.h +310 -289
- multipers/gudhi/truc.h +890 -888
- multipers/io.cp311-win_amd64.pyd +0 -0
- multipers/io.pyx +711 -711
- multipers/ml/accuracies.py +90 -90
- multipers/ml/convolutions.py +520 -520
- multipers/ml/invariants_with_persistable.py +79 -79
- multipers/ml/kernels.py +176 -176
- multipers/ml/mma.py +713 -714
- multipers/ml/one.py +472 -472
- multipers/ml/point_clouds.py +352 -346
- multipers/ml/signed_measures.py +1589 -1589
- multipers/ml/sliced_wasserstein.py +461 -461
- multipers/ml/tools.py +113 -113
- multipers/mma_structures.cp311-win_amd64.pyd +0 -0
- multipers/mma_structures.pxd +127 -127
- multipers/mma_structures.pyx +4 -4
- multipers/mma_structures.pyx.tp +1085 -1085
- multipers/multi_parameter_rank_invariant/diff_helpers.h +84 -93
- multipers/multi_parameter_rank_invariant/euler_characteristic.h +97 -97
- multipers/multi_parameter_rank_invariant/function_rips.h +322 -322
- multipers/multi_parameter_rank_invariant/hilbert_function.h +769 -769
- multipers/multi_parameter_rank_invariant/persistence_slices.h +148 -148
- multipers/multi_parameter_rank_invariant/rank_invariant.h +369 -369
- multipers/multiparameter_edge_collapse.py +41 -41
- multipers/multiparameter_module_approximation/approximation.h +2296 -2295
- multipers/multiparameter_module_approximation/combinatory.h +129 -129
- multipers/multiparameter_module_approximation/debug.h +107 -107
- multipers/multiparameter_module_approximation/format_python-cpp.h +286 -286
- multipers/multiparameter_module_approximation/heap_column.h +238 -238
- multipers/multiparameter_module_approximation/images.h +79 -79
- multipers/multiparameter_module_approximation/list_column.h +174 -174
- multipers/multiparameter_module_approximation/list_column_2.h +232 -232
- multipers/multiparameter_module_approximation/ru_matrix.h +347 -347
- multipers/multiparameter_module_approximation/set_column.h +135 -135
- multipers/multiparameter_module_approximation/structure_higher_dim_barcode.h +36 -36
- multipers/multiparameter_module_approximation/unordered_set_column.h +166 -166
- multipers/multiparameter_module_approximation/utilities.h +403 -419
- multipers/multiparameter_module_approximation/vector_column.h +223 -223
- multipers/multiparameter_module_approximation/vector_matrix.h +331 -331
- multipers/multiparameter_module_approximation/vineyards.h +464 -464
- multipers/multiparameter_module_approximation/vineyards_trajectories.h +649 -649
- multipers/multiparameter_module_approximation.cp311-win_amd64.pyd +0 -0
- multipers/multiparameter_module_approximation.pyx +216 -217
- multipers/pickle.py +90 -53
- multipers/plots.py +342 -334
- multipers/point_measure.cp311-win_amd64.pyd +0 -0
- multipers/point_measure.pyx +322 -320
- multipers/simplex_tree_multi.cp311-win_amd64.pyd +0 -0
- multipers/simplex_tree_multi.pxd +133 -133
- multipers/simplex_tree_multi.pyx +18 -15
- multipers/simplex_tree_multi.pyx.tp +1939 -1935
- multipers/slicer.cp311-win_amd64.pyd +0 -0
- multipers/slicer.pxd +81 -20
- multipers/slicer.pxd.tp +215 -214
- multipers/slicer.pyx +1091 -308
- multipers/slicer.pyx.tp +924 -914
- multipers/tensor/tensor.h +672 -672
- multipers/tensor.pxd +13 -13
- multipers/test.pyx +44 -44
- multipers/tests/__init__.py +57 -57
- multipers/torch/diff_grids.py +217 -217
- multipers/torch/rips_density.py +310 -304
- {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/LICENSE +21 -21
- {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/METADATA +21 -11
- multipers-2.3.0.dist-info/RECORD +182 -0
- multipers/tests/test_diff_helper.py +0 -73
- multipers/tests/test_hilbert_function.py +0 -82
- multipers/tests/test_mma.py +0 -83
- multipers/tests/test_point_clouds.py +0 -49
- multipers/tests/test_python-cpp_conversion.py +0 -82
- multipers/tests/test_signed_betti.py +0 -181
- multipers/tests/test_signed_measure.py +0 -89
- multipers/tests/test_simplextreemulti.py +0 -221
- multipers/tests/test_slicer.py +0 -221
- multipers-2.2.3.dist-info/RECORD +0 -189
- {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/WHEEL +0 -0
- {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/top_level.txt +0 -0
multipers/ml/tools.py
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
from types import FunctionType
|
|
2
|
-
from typing import Iterable
|
|
3
|
-
|
|
4
|
-
import numpy as np
|
|
5
|
-
from joblib import Parallel, delayed
|
|
6
|
-
from sklearn.base import BaseEstimator, TransformerMixin
|
|
7
|
-
|
|
8
|
-
import multipers as mp
|
|
9
|
-
from multipers.simplex_tree_multi import SimplexTreeMulti
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def get_simplex_tree_from_delayed(x) -> mp.SimplexTreeMulti:
|
|
13
|
-
f, args, kwargs = x
|
|
14
|
-
return f(*args, **kwargs)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def get_simplextree(x) -> mp.SimplexTreeMulti:
|
|
18
|
-
if isinstance(x, mp.SimplexTreeMulti):
|
|
19
|
-
return x
|
|
20
|
-
if len(x) == 3 and isinstance(x[0], FunctionType):
|
|
21
|
-
return get_simplex_tree_from_delayed(x)
|
|
22
|
-
else:
|
|
23
|
-
raise TypeError("Not a valid SimplexTree !")
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def filtration_grid_to_coordinates(F, return_resolution):
|
|
27
|
-
# computes the mesh as a coordinate list
|
|
28
|
-
mesh = np.meshgrid(*F)
|
|
29
|
-
coordinates = np.concatenate([stuff.flatten()[:, None] for stuff in mesh], axis=1)
|
|
30
|
-
if return_resolution:
|
|
31
|
-
return coordinates, tuple(len(f) for f in F)
|
|
32
|
-
return coordinates
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def get_filtration_weights_grid(
|
|
36
|
-
num_parameters: int = 2,
|
|
37
|
-
resolution: int | Iterable[int] = 3,
|
|
38
|
-
*,
|
|
39
|
-
min: float = 0,
|
|
40
|
-
max: float = 20,
|
|
41
|
-
dtype=float,
|
|
42
|
-
remove_homothetie: bool = True,
|
|
43
|
-
weights=None,
|
|
44
|
-
):
|
|
45
|
-
"""
|
|
46
|
-
Provides a grid of weights, for filtration rescaling.
|
|
47
|
-
- num parameter : the dimension of the grid tensor
|
|
48
|
-
- resolution : the size of each coordinate
|
|
49
|
-
- min : minimum weight
|
|
50
|
-
- max : maximum weight
|
|
51
|
-
- weights : custom weights (instead of linspace between min and max)
|
|
52
|
-
- dtype : the type of the grid values (useful for int weights)
|
|
53
|
-
"""
|
|
54
|
-
from itertools import product
|
|
55
|
-
|
|
56
|
-
# if isinstance(resolution, int):
|
|
57
|
-
try:
|
|
58
|
-
float(resolution)
|
|
59
|
-
resolution = [resolution] * num_parameters
|
|
60
|
-
except:
|
|
61
|
-
pass
|
|
62
|
-
if weights is None:
|
|
63
|
-
weights = [
|
|
64
|
-
np.linspace(start=min, stop=max, num=r, dtype=dtype) for r in resolution
|
|
65
|
-
]
|
|
66
|
-
try:
|
|
67
|
-
float(weights[0]) # same weights for each filtrations
|
|
68
|
-
weights = [weights] * num_parameters
|
|
69
|
-
except:
|
|
70
|
-
None
|
|
71
|
-
out = np.asarray(list(product(*weights)))
|
|
72
|
-
if remove_homothetie:
|
|
73
|
-
_, indices = np.unique(
|
|
74
|
-
[x / x.max() for x in out if x.max() != 0], axis=0, return_index=True
|
|
75
|
-
)
|
|
76
|
-
out = out[indices]
|
|
77
|
-
return list(out)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class SimplexTreeEdgeCollapser(BaseEstimator, TransformerMixin):
|
|
81
|
-
def __init__(
|
|
82
|
-
self,
|
|
83
|
-
num_collapses: int = 0,
|
|
84
|
-
full: bool = False,
|
|
85
|
-
max_dimension: int | None = None,
|
|
86
|
-
n_jobs: int = 1,
|
|
87
|
-
) -> None:
|
|
88
|
-
super().__init__()
|
|
89
|
-
self.full = full
|
|
90
|
-
self.num_collapses = num_collapses
|
|
91
|
-
self.max_dimension = max_dimension
|
|
92
|
-
self.n_jobs = n_jobs
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
def fit(self, X: np.ndarray | list, y=None):
|
|
96
|
-
return self
|
|
97
|
-
|
|
98
|
-
def transform(self, X):
|
|
99
|
-
edges_list = Parallel(n_jobs=-1, prefer="threads")(
|
|
100
|
-
delayed(mp.SimplextreeMulti.get_edge_list)(x) for x in X
|
|
101
|
-
)
|
|
102
|
-
collapsed_edge_lists = Parallel(n_jobs=self.n_jobs)(
|
|
103
|
-
delayed(mp._collapse_edge_list)(
|
|
104
|
-
edges, full=self.full, num=self.num_collapses
|
|
105
|
-
)
|
|
106
|
-
for edges in edges_list
|
|
107
|
-
)
|
|
108
|
-
collapsed_simplextrees = Parallel(n_jobs=-1, prefer="threads")(
|
|
109
|
-
delayed(mp.SimplexTreeMulti._reconstruct_from_edge_list)(
|
|
110
|
-
collapsed_edge_lists, swap=True, expand_dim=self.max_dimension
|
|
111
|
-
)
|
|
112
|
-
)
|
|
113
|
-
return collapsed_simplextrees
|
|
1
|
+
from types import FunctionType
|
|
2
|
+
from typing import Iterable
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
from joblib import Parallel, delayed
|
|
6
|
+
from sklearn.base import BaseEstimator, TransformerMixin
|
|
7
|
+
|
|
8
|
+
import multipers as mp
|
|
9
|
+
from multipers.simplex_tree_multi import SimplexTreeMulti
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_simplex_tree_from_delayed(x) -> mp.SimplexTreeMulti:
|
|
13
|
+
f, args, kwargs = x
|
|
14
|
+
return f(*args, **kwargs)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_simplextree(x) -> mp.SimplexTreeMulti:
|
|
18
|
+
if isinstance(x, mp.SimplexTreeMulti):
|
|
19
|
+
return x
|
|
20
|
+
if len(x) == 3 and isinstance(x[0], FunctionType):
|
|
21
|
+
return get_simplex_tree_from_delayed(x)
|
|
22
|
+
else:
|
|
23
|
+
raise TypeError("Not a valid SimplexTree !")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def filtration_grid_to_coordinates(F, return_resolution):
|
|
27
|
+
# computes the mesh as a coordinate list
|
|
28
|
+
mesh = np.meshgrid(*F)
|
|
29
|
+
coordinates = np.concatenate([stuff.flatten()[:, None] for stuff in mesh], axis=1)
|
|
30
|
+
if return_resolution:
|
|
31
|
+
return coordinates, tuple(len(f) for f in F)
|
|
32
|
+
return coordinates
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_filtration_weights_grid(
|
|
36
|
+
num_parameters: int = 2,
|
|
37
|
+
resolution: int | Iterable[int] = 3,
|
|
38
|
+
*,
|
|
39
|
+
min: float = 0,
|
|
40
|
+
max: float = 20,
|
|
41
|
+
dtype=float,
|
|
42
|
+
remove_homothetie: bool = True,
|
|
43
|
+
weights=None,
|
|
44
|
+
):
|
|
45
|
+
"""
|
|
46
|
+
Provides a grid of weights, for filtration rescaling.
|
|
47
|
+
- num parameter : the dimension of the grid tensor
|
|
48
|
+
- resolution : the size of each coordinate
|
|
49
|
+
- min : minimum weight
|
|
50
|
+
- max : maximum weight
|
|
51
|
+
- weights : custom weights (instead of linspace between min and max)
|
|
52
|
+
- dtype : the type of the grid values (useful for int weights)
|
|
53
|
+
"""
|
|
54
|
+
from itertools import product
|
|
55
|
+
|
|
56
|
+
# if isinstance(resolution, int):
|
|
57
|
+
try:
|
|
58
|
+
float(resolution)
|
|
59
|
+
resolution = [resolution] * num_parameters
|
|
60
|
+
except:
|
|
61
|
+
pass
|
|
62
|
+
if weights is None:
|
|
63
|
+
weights = [
|
|
64
|
+
np.linspace(start=min, stop=max, num=r, dtype=dtype) for r in resolution
|
|
65
|
+
]
|
|
66
|
+
try:
|
|
67
|
+
float(weights[0]) # same weights for each filtrations
|
|
68
|
+
weights = [weights] * num_parameters
|
|
69
|
+
except:
|
|
70
|
+
None
|
|
71
|
+
out = np.asarray(list(product(*weights)))
|
|
72
|
+
if remove_homothetie:
|
|
73
|
+
_, indices = np.unique(
|
|
74
|
+
[x / x.max() for x in out if x.max() != 0], axis=0, return_index=True
|
|
75
|
+
)
|
|
76
|
+
out = out[indices]
|
|
77
|
+
return list(out)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class SimplexTreeEdgeCollapser(BaseEstimator, TransformerMixin):
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
num_collapses: int = 0,
|
|
84
|
+
full: bool = False,
|
|
85
|
+
max_dimension: int | None = None,
|
|
86
|
+
n_jobs: int = 1,
|
|
87
|
+
) -> None:
|
|
88
|
+
super().__init__()
|
|
89
|
+
self.full = full
|
|
90
|
+
self.num_collapses = num_collapses
|
|
91
|
+
self.max_dimension = max_dimension
|
|
92
|
+
self.n_jobs = n_jobs
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
def fit(self, X: np.ndarray | list, y=None):
|
|
96
|
+
return self
|
|
97
|
+
|
|
98
|
+
def transform(self, X):
|
|
99
|
+
edges_list = Parallel(n_jobs=-1, prefer="threads")(
|
|
100
|
+
delayed(mp.SimplextreeMulti.get_edge_list)(x) for x in X
|
|
101
|
+
)
|
|
102
|
+
collapsed_edge_lists = Parallel(n_jobs=self.n_jobs)(
|
|
103
|
+
delayed(mp._collapse_edge_list)(
|
|
104
|
+
edges, full=self.full, num=self.num_collapses
|
|
105
|
+
)
|
|
106
|
+
for edges in edges_list
|
|
107
|
+
)
|
|
108
|
+
collapsed_simplextrees = Parallel(n_jobs=-1, prefer="threads")(
|
|
109
|
+
delayed(mp.SimplexTreeMulti._reconstruct_from_edge_list)(
|
|
110
|
+
collapsed_edge_lists, swap=True, expand_dim=self.max_dimension
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
return collapsed_simplextrees
|
|
Binary file
|
multipers/mma_structures.pxd
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
from libcpp.utility cimport pair
|
|
2
|
-
from libcpp cimport bool
|
|
3
|
-
from libcpp.vector cimport vector
|
|
4
|
-
from libc.stdint cimport uintptr_t,intptr_t
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
from multipers.filtrations cimport *
|
|
9
|
-
ctypedef vector[unsigned int] boundary_type
|
|
10
|
-
ctypedef vector[boundary_type] boundary_matrix
|
|
11
|
-
ctypedef vector[int] simplex_type
|
|
12
|
-
|
|
13
|
-
cdef extern from "multiparameter_module_approximation/approximation.h" namespace "Gudhi::multiparameter::mma":
|
|
14
|
-
cdef cppclass Summand[T=*]:
|
|
15
|
-
ctypedef vector[T] corner_type
|
|
16
|
-
ctypedef T value_type
|
|
17
|
-
|
|
18
|
-
ctypedef pair[vector[T],vector[T]] interval
|
|
19
|
-
Summand() except +
|
|
20
|
-
Summand(vector[One_critical_filtration[T]]&, vector[One_critical_filtration[T]]&, int) except + nogil
|
|
21
|
-
T get_interleaving() nogil
|
|
22
|
-
T get_local_weight(const vector[T]&, const T) nogil
|
|
23
|
-
void add_bar(T, T, const vector[T]&, vector[T]&, vector[T]&, const bool, const interval&) nogil
|
|
24
|
-
vector[One_critical_filtration[T]] get_birth_list() nogil
|
|
25
|
-
vector[One_critical_filtration[T]] get_death_list() nogil
|
|
26
|
-
void complete_birth(const T) nogil
|
|
27
|
-
void complete_death(const T) nogil
|
|
28
|
-
int get_dimension() nogil const
|
|
29
|
-
void set_dimension(int) nogil
|
|
30
|
-
bool contains(const vector[T]&) nogil const
|
|
31
|
-
Box[T] get_bounds() nogil const
|
|
32
|
-
void rescale(const vector[T]&) nogil
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
cdef extern from "multiparameter_module_approximation/utilities.h" namespace "Gudhi::multiparameter::mma":
|
|
39
|
-
cdef cppclass MultiDiagram_point[T=*]:
|
|
40
|
-
ctypedef T value_type
|
|
41
|
-
ctypedef One_critical_filtration[double] filtration_type
|
|
42
|
-
MultiDiagram_point() except + nogil
|
|
43
|
-
MultiDiagram_point(int , T , T ) except + nogil
|
|
44
|
-
const T& get_birth() nogil const
|
|
45
|
-
const T& get_death() nogil const
|
|
46
|
-
int get_dimension() nogil const
|
|
47
|
-
|
|
48
|
-
cdef extern from "multiparameter_module_approximation/utilities.h" namespace "Gudhi::multiparameter::mma":
|
|
49
|
-
cdef cppclass MultiDiagram[T=*, value_type=*]:
|
|
50
|
-
MultiDiagram() except + nogil
|
|
51
|
-
ctypedef pair[vector[T], vector[T]] bar
|
|
52
|
-
ctypedef vector[bar] barcode
|
|
53
|
-
ctypedef vector[float] multipers_bar
|
|
54
|
-
ctypedef vector[multipers_bar] multipers_barcode
|
|
55
|
-
|
|
56
|
-
vector[pair[vector[value_type],vector[value_type]]] get_points(const int) const
|
|
57
|
-
vector[vector[double]] to_multipers(const int) nogil const
|
|
58
|
-
vector[MultiDiagram_point[T]].const_iterator begin()
|
|
59
|
-
vector[MultiDiagram_point[T]].const_iterator end()
|
|
60
|
-
unsigned int size() const
|
|
61
|
-
MultiDiagram_point[T]& at(unsigned int) nogil
|
|
62
|
-
|
|
63
|
-
cdef extern from "multiparameter_module_approximation/utilities.h" namespace "Gudhi::multiparameter::mma":
|
|
64
|
-
cdef cppclass MultiDiagrams[T=*, value_type=*]:
|
|
65
|
-
MultiDiagrams() except + nogil
|
|
66
|
-
ctypedef pair[vector[pair[double, double]], vector[unsigned int]] plot_interface_type
|
|
67
|
-
ctypedef vector[T] corner_type
|
|
68
|
-
ctypedef pair[corner_type, corner_type] bar
|
|
69
|
-
ctypedef vector[bar] barcode
|
|
70
|
-
ctypedef vector[T] multipers_bar
|
|
71
|
-
ctypedef vector[multipers_bar] multipers_barcode
|
|
72
|
-
ctypedef vector[barcode] barcodes
|
|
73
|
-
vector[vector[vector[double]]] to_multipers() nogil const
|
|
74
|
-
MultiDiagram[T, value_type]& at(const unsigned int) nogil
|
|
75
|
-
unsigned int size() nogil const
|
|
76
|
-
vector[MultiDiagram[T, value_type]].const_iterator begin()
|
|
77
|
-
vector[MultiDiagram[T, value_type]].const_iterator end()
|
|
78
|
-
plot_interface_type _for_python_plot(int, double) nogil
|
|
79
|
-
vector[vector[pair[vector[value_type], vector[value_type]]]] get_points() nogil
|
|
80
|
-
|
|
81
|
-
cdef extern from "multiparameter_module_approximation/approximation.h" namespace "Gudhi::multiparameter::mma":
|
|
82
|
-
cdef cppclass Module[T=*]:
|
|
83
|
-
ctypedef vector[vector[T]] image_type
|
|
84
|
-
Module() except + nogil
|
|
85
|
-
void resize(unsigned int) nogil
|
|
86
|
-
Summand[T]& at(unsigned int) nogil
|
|
87
|
-
vector[Summand[T]].iterator begin()
|
|
88
|
-
vector[Summand[T]].iterator end()
|
|
89
|
-
void clean(const bool) nogil
|
|
90
|
-
void fill(const T) nogil
|
|
91
|
-
# vector[image_type] get_vectorization(const T,const T, unsigned int,unsigned int,const Box&)
|
|
92
|
-
# image_type get_vectorization_in_dimension(const int,const T,unsigned int,unsigned int,const Box&)
|
|
93
|
-
void add_summand(Summand[T]) nogil
|
|
94
|
-
void add_summand(Summand[T], int) nogil
|
|
95
|
-
unsigned int size() const
|
|
96
|
-
Box[T] get_box() const
|
|
97
|
-
Box[T] get_bounds() nogil const
|
|
98
|
-
void set_box(Box[T]) nogil
|
|
99
|
-
int get_dimension() const
|
|
100
|
-
vector[pair[vector[vector[T]], vector[vector[T]]]] get_corners_of_dimension(unsigned int) nogil
|
|
101
|
-
image_type get_vectorization_in_dimension(const int, const T, const T, const bool, Box[T]&, unsigned int, unsigned int) nogil
|
|
102
|
-
vector[image_type] get_vectorization(const T, const T, const bool, Box[T], unsigned int, unsigned int) nogil
|
|
103
|
-
MultiDiagram[One_critical_filtration[T], T] get_barcode(Line[T]&, const int, const bool) nogil
|
|
104
|
-
vector[vector[pair[T,T]]] get_barcode2(Line[T]&, const int) nogil
|
|
105
|
-
MultiDiagrams[One_critical_filtration[T],T] get_barcodes(const vector[One_critical_filtration[T]]& , const int, const bool ) nogil
|
|
106
|
-
vector[vector[vector[pair[T,T]]]] get_barcodes2(const vector[Line[T]]& , const int, ) nogil
|
|
107
|
-
image_type get_landscape(const int,const unsigned int,Box[T],const vector[unsigned int]&) nogil
|
|
108
|
-
vector[image_type] get_landscapes(const int,const vector[unsigned int],Box[T],const vector[unsigned int]&) nogil
|
|
109
|
-
vector[int] euler_curve(const vector[One_critical_filtration[T]]&) nogil
|
|
110
|
-
void rescale(vector[T]&, int) nogil
|
|
111
|
-
void translate(vector[T]&, int) nogil
|
|
112
|
-
vector[vector[T]] compute_pixels(vector[vector[T]], vector[int], Box[T], T, T, bool,int) nogil
|
|
113
|
-
vector[vector[pair[vector[vector[int]],vector[vector[int]]]]] to_idx(vector[vector[T]]) nogil
|
|
114
|
-
vector[vector[vector[int]]] to_flat_idx(vector[vector[T]]) nogil
|
|
115
|
-
vector[vector[vector[int]]] compute_distances_idx_to(vector[vector[T]],bool, int) nogil
|
|
116
|
-
vector[vector[T]] compute_distances_to(vector[vector[T]],bool, int) nogil
|
|
117
|
-
vector[T] get_interleavings(Box[T]) nogil
|
|
118
|
-
vector[int] get_degree_splits() nogil
|
|
119
|
-
void compute_distances_to(T*,vector[vector[T]],bool, int) nogil
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
cdef inline list[tuple[list[double],list[double]]] _bc2py(vector[pair[vector[double],vector[double]]] bc):
|
|
127
|
-
return bc
|
|
1
|
+
from libcpp.utility cimport pair
|
|
2
|
+
from libcpp cimport bool
|
|
3
|
+
from libcpp.vector cimport vector
|
|
4
|
+
from libc.stdint cimport uintptr_t,intptr_t
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
from multipers.filtrations cimport *
|
|
9
|
+
ctypedef vector[unsigned int] boundary_type
|
|
10
|
+
ctypedef vector[boundary_type] boundary_matrix
|
|
11
|
+
ctypedef vector[int] simplex_type
|
|
12
|
+
|
|
13
|
+
cdef extern from "multiparameter_module_approximation/approximation.h" namespace "Gudhi::multiparameter::mma":
|
|
14
|
+
cdef cppclass Summand[T=*]:
|
|
15
|
+
ctypedef vector[T] corner_type
|
|
16
|
+
ctypedef T value_type
|
|
17
|
+
|
|
18
|
+
ctypedef pair[vector[T],vector[T]] interval
|
|
19
|
+
Summand() except +
|
|
20
|
+
Summand(vector[One_critical_filtration[T]]&, vector[One_critical_filtration[T]]&, int) except + nogil
|
|
21
|
+
T get_interleaving() nogil
|
|
22
|
+
T get_local_weight(const vector[T]&, const T) nogil
|
|
23
|
+
void add_bar(T, T, const vector[T]&, vector[T]&, vector[T]&, const bool, const interval&) nogil
|
|
24
|
+
vector[One_critical_filtration[T]] get_birth_list() nogil
|
|
25
|
+
vector[One_critical_filtration[T]] get_death_list() nogil
|
|
26
|
+
void complete_birth(const T) nogil
|
|
27
|
+
void complete_death(const T) nogil
|
|
28
|
+
int get_dimension() nogil const
|
|
29
|
+
void set_dimension(int) nogil
|
|
30
|
+
bool contains(const vector[T]&) nogil const
|
|
31
|
+
Box[T] get_bounds() nogil const
|
|
32
|
+
void rescale(const vector[T]&) nogil
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
cdef extern from "multiparameter_module_approximation/utilities.h" namespace "Gudhi::multiparameter::mma":
|
|
39
|
+
cdef cppclass MultiDiagram_point[T=*]:
|
|
40
|
+
ctypedef T value_type
|
|
41
|
+
ctypedef One_critical_filtration[double] filtration_type
|
|
42
|
+
MultiDiagram_point() except + nogil
|
|
43
|
+
MultiDiagram_point(int , T , T ) except + nogil
|
|
44
|
+
const T& get_birth() nogil const
|
|
45
|
+
const T& get_death() nogil const
|
|
46
|
+
int get_dimension() nogil const
|
|
47
|
+
|
|
48
|
+
cdef extern from "multiparameter_module_approximation/utilities.h" namespace "Gudhi::multiparameter::mma":
|
|
49
|
+
cdef cppclass MultiDiagram[T=*, value_type=*]:
|
|
50
|
+
MultiDiagram() except + nogil
|
|
51
|
+
ctypedef pair[vector[T], vector[T]] bar
|
|
52
|
+
ctypedef vector[bar] barcode
|
|
53
|
+
ctypedef vector[float] multipers_bar
|
|
54
|
+
ctypedef vector[multipers_bar] multipers_barcode
|
|
55
|
+
|
|
56
|
+
vector[pair[vector[value_type],vector[value_type]]] get_points(const int) const
|
|
57
|
+
vector[vector[double]] to_multipers(const int) nogil const
|
|
58
|
+
vector[MultiDiagram_point[T]].const_iterator begin()
|
|
59
|
+
vector[MultiDiagram_point[T]].const_iterator end()
|
|
60
|
+
unsigned int size() const
|
|
61
|
+
MultiDiagram_point[T]& at(unsigned int) nogil
|
|
62
|
+
|
|
63
|
+
cdef extern from "multiparameter_module_approximation/utilities.h" namespace "Gudhi::multiparameter::mma":
|
|
64
|
+
cdef cppclass MultiDiagrams[T=*, value_type=*]:
|
|
65
|
+
MultiDiagrams() except + nogil
|
|
66
|
+
ctypedef pair[vector[pair[double, double]], vector[unsigned int]] plot_interface_type
|
|
67
|
+
ctypedef vector[T] corner_type
|
|
68
|
+
ctypedef pair[corner_type, corner_type] bar
|
|
69
|
+
ctypedef vector[bar] barcode
|
|
70
|
+
ctypedef vector[T] multipers_bar
|
|
71
|
+
ctypedef vector[multipers_bar] multipers_barcode
|
|
72
|
+
ctypedef vector[barcode] barcodes
|
|
73
|
+
vector[vector[vector[double]]] to_multipers() nogil const
|
|
74
|
+
MultiDiagram[T, value_type]& at(const unsigned int) nogil
|
|
75
|
+
unsigned int size() nogil const
|
|
76
|
+
vector[MultiDiagram[T, value_type]].const_iterator begin()
|
|
77
|
+
vector[MultiDiagram[T, value_type]].const_iterator end()
|
|
78
|
+
plot_interface_type _for_python_plot(int, double) nogil
|
|
79
|
+
vector[vector[pair[vector[value_type], vector[value_type]]]] get_points() nogil
|
|
80
|
+
|
|
81
|
+
cdef extern from "multiparameter_module_approximation/approximation.h" namespace "Gudhi::multiparameter::mma":
|
|
82
|
+
cdef cppclass Module[T=*]:
|
|
83
|
+
ctypedef vector[vector[T]] image_type
|
|
84
|
+
Module() except + nogil
|
|
85
|
+
void resize(unsigned int) nogil
|
|
86
|
+
Summand[T]& at(unsigned int) nogil
|
|
87
|
+
vector[Summand[T]].iterator begin()
|
|
88
|
+
vector[Summand[T]].iterator end()
|
|
89
|
+
void clean(const bool) nogil
|
|
90
|
+
void fill(const T) nogil
|
|
91
|
+
# vector[image_type] get_vectorization(const T,const T, unsigned int,unsigned int,const Box&)
|
|
92
|
+
# image_type get_vectorization_in_dimension(const int,const T,unsigned int,unsigned int,const Box&)
|
|
93
|
+
void add_summand(Summand[T]) nogil
|
|
94
|
+
void add_summand(Summand[T], int) nogil
|
|
95
|
+
unsigned int size() const
|
|
96
|
+
Box[T] get_box() const
|
|
97
|
+
Box[T] get_bounds() nogil const
|
|
98
|
+
void set_box(Box[T]) nogil
|
|
99
|
+
int get_dimension() const
|
|
100
|
+
vector[pair[vector[vector[T]], vector[vector[T]]]] get_corners_of_dimension(unsigned int) nogil
|
|
101
|
+
image_type get_vectorization_in_dimension(const int, const T, const T, const bool, Box[T]&, unsigned int, unsigned int) nogil
|
|
102
|
+
vector[image_type] get_vectorization(const T, const T, const bool, Box[T], unsigned int, unsigned int) nogil
|
|
103
|
+
MultiDiagram[One_critical_filtration[T], T] get_barcode(Line[T]&, const int, const bool) nogil
|
|
104
|
+
vector[vector[pair[T,T]]] get_barcode2(Line[T]&, const int) nogil
|
|
105
|
+
MultiDiagrams[One_critical_filtration[T],T] get_barcodes(const vector[One_critical_filtration[T]]& , const int, const bool ) nogil
|
|
106
|
+
vector[vector[vector[pair[T,T]]]] get_barcodes2(const vector[Line[T]]& , const int, ) nogil
|
|
107
|
+
image_type get_landscape(const int,const unsigned int,Box[T],const vector[unsigned int]&) nogil
|
|
108
|
+
vector[image_type] get_landscapes(const int,const vector[unsigned int],Box[T],const vector[unsigned int]&) nogil
|
|
109
|
+
vector[int] euler_curve(const vector[One_critical_filtration[T]]&) nogil
|
|
110
|
+
void rescale(vector[T]&, int) nogil
|
|
111
|
+
void translate(vector[T]&, int) nogil
|
|
112
|
+
vector[vector[T]] compute_pixels(vector[vector[T]], vector[int], Box[T], T, T, bool,int) nogil
|
|
113
|
+
vector[vector[pair[vector[vector[int]],vector[vector[int]]]]] to_idx(vector[vector[T]]) nogil
|
|
114
|
+
vector[vector[vector[int]]] to_flat_idx(vector[vector[T]]) nogil
|
|
115
|
+
vector[vector[vector[int]]] compute_distances_idx_to(vector[vector[T]],bool, int) nogil
|
|
116
|
+
vector[vector[T]] compute_distances_to(vector[vector[T]],bool, int) nogil
|
|
117
|
+
vector[T] get_interleavings(Box[T]) nogil
|
|
118
|
+
vector[int] get_degree_splits() nogil
|
|
119
|
+
void compute_distances_to(T*,vector[vector[T]],bool, int) nogil
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
cdef inline list[tuple[list[double],list[double]]] _bc2py(vector[pair[vector[double],vector[double]]] bc):
|
|
127
|
+
return bc
|
multipers/mma_structures.pyx
CHANGED
|
@@ -363,7 +363,7 @@ cdef class PyModule_f64:
|
|
|
363
363
|
axes = [plt.gca()]
|
|
364
364
|
for dim_idx in range(ndim):
|
|
365
365
|
if not separated:
|
|
366
|
-
plt.sca(axes[dim_idx])
|
|
366
|
+
plt.sca(axes[dim_idx])
|
|
367
367
|
self.plot(dims[dim_idx],box=box, separated = separated, **kwargs)
|
|
368
368
|
return
|
|
369
369
|
corners = self.cmod.get_corners_of_dimension(degree)
|
|
@@ -1315,7 +1315,7 @@ cdef class PyModule_f32:
|
|
|
1315
1315
|
axes = [plt.gca()]
|
|
1316
1316
|
for dim_idx in range(ndim):
|
|
1317
1317
|
if not separated:
|
|
1318
|
-
plt.sca(axes[dim_idx])
|
|
1318
|
+
plt.sca(axes[dim_idx])
|
|
1319
1319
|
self.plot(dims[dim_idx],box=box, separated = separated, **kwargs)
|
|
1320
1320
|
return
|
|
1321
1321
|
corners = self.cmod.get_corners_of_dimension(degree)
|
|
@@ -2267,7 +2267,7 @@ cdef class PyModule_i32:
|
|
|
2267
2267
|
axes = [plt.gca()]
|
|
2268
2268
|
for dim_idx in range(ndim):
|
|
2269
2269
|
if not separated:
|
|
2270
|
-
plt.sca(axes[dim_idx])
|
|
2270
|
+
plt.sca(axes[dim_idx])
|
|
2271
2271
|
self.plot(dims[dim_idx],box=box, separated = separated, **kwargs)
|
|
2272
2272
|
return
|
|
2273
2273
|
corners = self.cmod.get_corners_of_dimension(degree)
|
|
@@ -2635,7 +2635,7 @@ cdef class PyModule_i64:
|
|
|
2635
2635
|
axes = [plt.gca()]
|
|
2636
2636
|
for dim_idx in range(ndim):
|
|
2637
2637
|
if not separated:
|
|
2638
|
-
plt.sca(axes[dim_idx])
|
|
2638
|
+
plt.sca(axes[dim_idx])
|
|
2639
2639
|
self.plot(dims[dim_idx],box=box, separated = separated, **kwargs)
|
|
2640
2640
|
return
|
|
2641
2641
|
corners = self.cmod.get_corners_of_dimension(degree)
|