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.

Files changed (182) hide show
  1. multipers/__init__.py +33 -31
  2. multipers/_signed_measure_meta.py +430 -430
  3. multipers/_slicer_meta.py +211 -212
  4. multipers/data/MOL2.py +458 -458
  5. multipers/data/UCR.py +18 -18
  6. multipers/data/graphs.py +466 -466
  7. multipers/data/immuno_regions.py +27 -27
  8. multipers/data/pytorch2simplextree.py +90 -90
  9. multipers/data/shape3d.py +101 -101
  10. multipers/data/synthetic.py +113 -111
  11. multipers/distances.py +198 -198
  12. multipers/filtration_conversions.pxd.tp +84 -84
  13. multipers/filtrations/__init__.py +18 -0
  14. multipers/filtrations/filtrations.py +289 -0
  15. multipers/filtrations.pxd +224 -224
  16. multipers/function_rips.cp311-win_amd64.pyd +0 -0
  17. multipers/function_rips.pyx +105 -105
  18. multipers/grids.cp311-win_amd64.pyd +0 -0
  19. multipers/grids.pyx +350 -350
  20. multipers/gudhi/Persistence_slices_interface.h +132 -132
  21. multipers/gudhi/Simplex_tree_interface.h +239 -245
  22. multipers/gudhi/Simplex_tree_multi_interface.h +516 -561
  23. multipers/gudhi/cubical_to_boundary.h +59 -59
  24. multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -450
  25. multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -1070
  26. multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -579
  27. multipers/gudhi/gudhi/Debug_utils.h +45 -45
  28. multipers/gudhi/gudhi/Fields/Multi_field.h +484 -484
  29. multipers/gudhi/gudhi/Fields/Multi_field_operators.h +455 -455
  30. multipers/gudhi/gudhi/Fields/Multi_field_shared.h +450 -450
  31. multipers/gudhi/gudhi/Fields/Multi_field_small.h +531 -531
  32. multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +507 -507
  33. multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +531 -531
  34. multipers/gudhi/gudhi/Fields/Z2_field.h +355 -355
  35. multipers/gudhi/gudhi/Fields/Z2_field_operators.h +376 -376
  36. multipers/gudhi/gudhi/Fields/Zp_field.h +420 -420
  37. multipers/gudhi/gudhi/Fields/Zp_field_operators.h +400 -400
  38. multipers/gudhi/gudhi/Fields/Zp_field_shared.h +418 -418
  39. multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -337
  40. multipers/gudhi/gudhi/Matrix.h +2107 -2107
  41. multipers/gudhi/gudhi/Multi_critical_filtration.h +1038 -1038
  42. multipers/gudhi/gudhi/Multi_persistence/Box.h +171 -171
  43. multipers/gudhi/gudhi/Multi_persistence/Line.h +282 -282
  44. multipers/gudhi/gudhi/Off_reader.h +173 -173
  45. multipers/gudhi/gudhi/One_critical_filtration.h +1432 -1431
  46. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +769 -769
  47. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +686 -686
  48. multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +842 -842
  49. multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1350 -1350
  50. multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1105 -1105
  51. multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +859 -859
  52. multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +910 -910
  53. multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +139 -139
  54. multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +230 -230
  55. multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +211 -211
  56. multipers/gudhi/gudhi/Persistence_matrix/boundary_cell_position_to_id_mapper.h +60 -60
  57. multipers/gudhi/gudhi/Persistence_matrix/boundary_face_position_to_id_mapper.h +60 -60
  58. multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +136 -136
  59. multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +190 -190
  60. multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +616 -616
  61. multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +150 -150
  62. multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +106 -106
  63. multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +219 -219
  64. multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +327 -327
  65. multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1140 -1140
  66. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +934 -934
  67. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +934 -934
  68. multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +980 -980
  69. multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1092 -1092
  70. multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +192 -192
  71. multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +921 -921
  72. multipers/gudhi/gudhi/Persistence_matrix/columns/small_vector_column.h +1093 -1093
  73. multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +1012 -1012
  74. multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1244 -1244
  75. multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +186 -186
  76. multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +164 -164
  77. multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +156 -156
  78. multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +376 -376
  79. multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +540 -540
  80. multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -118
  81. multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -173
  82. multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -128
  83. multipers/gudhi/gudhi/Persistent_cohomology.h +745 -745
  84. multipers/gudhi/gudhi/Points_off_io.h +171 -171
  85. multipers/gudhi/gudhi/Simple_object_pool.h +69 -69
  86. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +463 -463
  87. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -83
  88. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +106 -106
  89. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -277
  90. multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -62
  91. multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -27
  92. multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +62 -62
  93. multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +157 -157
  94. multipers/gudhi/gudhi/Simplex_tree.h +2794 -2794
  95. multipers/gudhi/gudhi/Simplex_tree_multi.h +152 -163
  96. multipers/gudhi/gudhi/distance_functions.h +62 -62
  97. multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -104
  98. multipers/gudhi/gudhi/persistence_interval.h +253 -253
  99. multipers/gudhi/gudhi/persistence_matrix_options.h +170 -170
  100. multipers/gudhi/gudhi/reader_utils.h +367 -367
  101. multipers/gudhi/mma_interface_coh.h +256 -255
  102. multipers/gudhi/mma_interface_h0.h +223 -231
  103. multipers/gudhi/mma_interface_matrix.h +284 -282
  104. multipers/gudhi/naive_merge_tree.h +536 -575
  105. multipers/gudhi/scc_io.h +310 -289
  106. multipers/gudhi/truc.h +890 -888
  107. multipers/io.cp311-win_amd64.pyd +0 -0
  108. multipers/io.pyx +711 -711
  109. multipers/ml/accuracies.py +90 -90
  110. multipers/ml/convolutions.py +520 -520
  111. multipers/ml/invariants_with_persistable.py +79 -79
  112. multipers/ml/kernels.py +176 -176
  113. multipers/ml/mma.py +713 -714
  114. multipers/ml/one.py +472 -472
  115. multipers/ml/point_clouds.py +352 -346
  116. multipers/ml/signed_measures.py +1589 -1589
  117. multipers/ml/sliced_wasserstein.py +461 -461
  118. multipers/ml/tools.py +113 -113
  119. multipers/mma_structures.cp311-win_amd64.pyd +0 -0
  120. multipers/mma_structures.pxd +127 -127
  121. multipers/mma_structures.pyx +4 -4
  122. multipers/mma_structures.pyx.tp +1085 -1085
  123. multipers/multi_parameter_rank_invariant/diff_helpers.h +84 -93
  124. multipers/multi_parameter_rank_invariant/euler_characteristic.h +97 -97
  125. multipers/multi_parameter_rank_invariant/function_rips.h +322 -322
  126. multipers/multi_parameter_rank_invariant/hilbert_function.h +769 -769
  127. multipers/multi_parameter_rank_invariant/persistence_slices.h +148 -148
  128. multipers/multi_parameter_rank_invariant/rank_invariant.h +369 -369
  129. multipers/multiparameter_edge_collapse.py +41 -41
  130. multipers/multiparameter_module_approximation/approximation.h +2296 -2295
  131. multipers/multiparameter_module_approximation/combinatory.h +129 -129
  132. multipers/multiparameter_module_approximation/debug.h +107 -107
  133. multipers/multiparameter_module_approximation/format_python-cpp.h +286 -286
  134. multipers/multiparameter_module_approximation/heap_column.h +238 -238
  135. multipers/multiparameter_module_approximation/images.h +79 -79
  136. multipers/multiparameter_module_approximation/list_column.h +174 -174
  137. multipers/multiparameter_module_approximation/list_column_2.h +232 -232
  138. multipers/multiparameter_module_approximation/ru_matrix.h +347 -347
  139. multipers/multiparameter_module_approximation/set_column.h +135 -135
  140. multipers/multiparameter_module_approximation/structure_higher_dim_barcode.h +36 -36
  141. multipers/multiparameter_module_approximation/unordered_set_column.h +166 -166
  142. multipers/multiparameter_module_approximation/utilities.h +403 -419
  143. multipers/multiparameter_module_approximation/vector_column.h +223 -223
  144. multipers/multiparameter_module_approximation/vector_matrix.h +331 -331
  145. multipers/multiparameter_module_approximation/vineyards.h +464 -464
  146. multipers/multiparameter_module_approximation/vineyards_trajectories.h +649 -649
  147. multipers/multiparameter_module_approximation.cp311-win_amd64.pyd +0 -0
  148. multipers/multiparameter_module_approximation.pyx +216 -217
  149. multipers/pickle.py +90 -53
  150. multipers/plots.py +342 -334
  151. multipers/point_measure.cp311-win_amd64.pyd +0 -0
  152. multipers/point_measure.pyx +322 -320
  153. multipers/simplex_tree_multi.cp311-win_amd64.pyd +0 -0
  154. multipers/simplex_tree_multi.pxd +133 -133
  155. multipers/simplex_tree_multi.pyx +18 -15
  156. multipers/simplex_tree_multi.pyx.tp +1939 -1935
  157. multipers/slicer.cp311-win_amd64.pyd +0 -0
  158. multipers/slicer.pxd +81 -20
  159. multipers/slicer.pxd.tp +215 -214
  160. multipers/slicer.pyx +1091 -308
  161. multipers/slicer.pyx.tp +924 -914
  162. multipers/tensor/tensor.h +672 -672
  163. multipers/tensor.pxd +13 -13
  164. multipers/test.pyx +44 -44
  165. multipers/tests/__init__.py +57 -57
  166. multipers/torch/diff_grids.py +217 -217
  167. multipers/torch/rips_density.py +310 -304
  168. {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/LICENSE +21 -21
  169. {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/METADATA +21 -11
  170. multipers-2.3.0.dist-info/RECORD +182 -0
  171. multipers/tests/test_diff_helper.py +0 -73
  172. multipers/tests/test_hilbert_function.py +0 -82
  173. multipers/tests/test_mma.py +0 -83
  174. multipers/tests/test_point_clouds.py +0 -49
  175. multipers/tests/test_python-cpp_conversion.py +0 -82
  176. multipers/tests/test_signed_betti.py +0 -181
  177. multipers/tests/test_signed_measure.py +0 -89
  178. multipers/tests/test_simplextreemulti.py +0 -221
  179. multipers/tests/test_slicer.py +0 -221
  180. multipers-2.2.3.dist-info/RECORD +0 -189
  181. {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/WHEEL +0 -0
  182. {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
@@ -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
@@ -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]) if ndim > 1 else plt.sca(axes)
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]) if ndim > 1 else plt.sca(axes)
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]) if ndim > 1 else plt.sca(axes)
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]) if ndim > 1 else plt.sca(axes)
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)