multipers 2.3.4__cp312-cp312-win_amd64.whl → 2.3.5b2__cp312-cp312-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 +50 -84
- multipers/array_api/numpy.py +7 -0
- multipers/array_api/torch.py +7 -2
- multipers/filtrations/filtrations.py +2 -0
- multipers/function_rips.cp312-win_amd64.pyd +0 -0
- multipers/grids.cp312-win_amd64.pyd +0 -0
- multipers/grids.pyx +57 -19
- multipers/io.cp312-win_amd64.pyd +0 -0
- multipers/mma_structures.cp312-win_amd64.pyd +0 -0
- multipers/multi_parameter_rank_invariant/function_rips.h +1 -1
- multipers/multiparameter_module_approximation/approximation.h +8 -2
- multipers/multiparameter_module_approximation.cp312-win_amd64.pyd +0 -0
- multipers/plots.py +3 -2
- multipers/point_measure.cp312-win_amd64.pyd +0 -0
- multipers/point_measure.pyx +1 -1
- multipers/simplex_tree_multi.cp312-win_amd64.pyd +0 -0
- multipers/simplex_tree_multi.pyx +88 -56
- multipers/simplex_tree_multi.pyx.tp +23 -7
- multipers/slicer.cp312-win_amd64.pyd +0 -0
- multipers/slicer.pxd +60 -60
- multipers/slicer.pxd.tp +1 -1
- multipers/slicer.pyx +2054 -1139
- multipers/slicer.pyx.tp +100 -43
- multipers/tbb12.dll +0 -0
- multipers/tbbbind_2_5.dll +0 -0
- multipers/tbbmalloc.dll +0 -0
- multipers/tbbmalloc_proxy.dll +0 -0
- {multipers-2.3.4.dist-info → multipers-2.3.5b2.dist-info}/METADATA +1 -1
- {multipers-2.3.4.dist-info → multipers-2.3.5b2.dist-info}/RECORD +32 -32
- {multipers-2.3.4.dist-info → multipers-2.3.5b2.dist-info}/WHEEL +0 -0
- {multipers-2.3.4.dist-info → multipers-2.3.5b2.dist-info}/licenses/LICENSE +0 -0
- {multipers-2.3.4.dist-info → multipers-2.3.5b2.dist-info}/top_level.txt +0 -0
multipers/simplex_tree_multi.pyx
CHANGED
|
@@ -479,10 +479,9 @@ cdef class SimplexTreeMulti_KFi32:
|
|
|
479
479
|
preincrement(it)
|
|
480
480
|
|
|
481
481
|
|
|
482
|
+
def _get_raw_filtration(self):
|
|
483
|
+
raise NotImplementedError("Not implemented for multicritical filtrations")
|
|
482
484
|
|
|
483
|
-
def persistence_approximation(self, **kwargs):
|
|
484
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
485
|
-
return module_approximation(self, **kwargs)
|
|
486
485
|
|
|
487
486
|
|
|
488
487
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -916,7 +915,6 @@ cdef class SimplexTreeMulti_KFi32:
|
|
|
916
915
|
self,
|
|
917
916
|
filtration_grid:np.ndarray|list|None=None,
|
|
918
917
|
bool coordinate_values=True,
|
|
919
|
-
bool force=False,
|
|
920
918
|
str strategy:_available_strategies = "exact",
|
|
921
919
|
resolution:Optional[int|list[int]] = None,
|
|
922
920
|
bool coordinates = False,
|
|
@@ -932,8 +930,6 @@ cdef class SimplexTreeMulti_KFi32:
|
|
|
932
930
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
933
931
|
:type coordinate_values: bool
|
|
934
932
|
"""
|
|
935
|
-
if not force and self.is_squeezed:
|
|
936
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
937
933
|
|
|
938
934
|
if grid_strategy is not None:
|
|
939
935
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -943,7 +939,7 @@ cdef class SimplexTreeMulti_KFi32:
|
|
|
943
939
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
944
940
|
temp = self.unsqueeze()
|
|
945
941
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
946
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
942
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
947
943
|
|
|
948
944
|
#TODO : multi-critical
|
|
949
945
|
if filtration_grid is None:
|
|
@@ -1777,10 +1773,25 @@ cdef class SimplexTreeMulti_Fi32:
|
|
|
1777
1773
|
preincrement(it)
|
|
1778
1774
|
|
|
1779
1775
|
|
|
1776
|
+
def _get_raw_filtration(self):
|
|
1777
|
+
if self.is_squeezed:
|
|
1778
|
+
raise NotImplementedError("Not implemented for squeezed filtrations")
|
|
1779
|
+
cdef int num_parameters = self.num_parameters
|
|
1780
|
+
cdef int32_t[:,:] current_filtration = np.empty((self.num_simplices, self.num_parameters), dtype=self.dtype)
|
|
1781
|
+
|
|
1782
|
+
cdef Simplex_tree_multi_simplices_iterator[Fi32] it = self.get_ptr().get_simplices_iterator_begin()
|
|
1783
|
+
cdef Simplex_tree_multi_simplices_iterator[Fi32] end = self.get_ptr().get_simplices_iterator_end()
|
|
1784
|
+
|
|
1785
|
+
cdef int i=0
|
|
1786
|
+
with nogil:
|
|
1787
|
+
while it != end:
|
|
1788
|
+
pair_sf = <pair[simplex_type, Fi32*]> self.get_ptr().get_simplex_and_filtration(dereference(it))
|
|
1789
|
+
for j in range(num_parameters):
|
|
1790
|
+
current_filtration[i,j] = dereference(pair_sf.second)[j]
|
|
1791
|
+
preincrement(it)
|
|
1792
|
+
i = i+1
|
|
1793
|
+
return np.asarray(current_filtration, dtype=self.dtype)
|
|
1780
1794
|
|
|
1781
|
-
def persistence_approximation(self, **kwargs):
|
|
1782
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
1783
|
-
return module_approximation(self, **kwargs)
|
|
1784
1795
|
|
|
1785
1796
|
|
|
1786
1797
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -2357,7 +2368,6 @@ cdef class SimplexTreeMulti_Fi32:
|
|
|
2357
2368
|
self,
|
|
2358
2369
|
filtration_grid:np.ndarray|list|None=None,
|
|
2359
2370
|
bool coordinate_values=True,
|
|
2360
|
-
bool force=False,
|
|
2361
2371
|
str strategy:_available_strategies = "exact",
|
|
2362
2372
|
resolution:Optional[int|list[int]] = None,
|
|
2363
2373
|
bool coordinates = False,
|
|
@@ -2373,8 +2383,6 @@ cdef class SimplexTreeMulti_Fi32:
|
|
|
2373
2383
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
2374
2384
|
:type coordinate_values: bool
|
|
2375
2385
|
"""
|
|
2376
|
-
if not force and self.is_squeezed:
|
|
2377
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
2378
2386
|
|
|
2379
2387
|
if grid_strategy is not None:
|
|
2380
2388
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -2384,7 +2392,7 @@ cdef class SimplexTreeMulti_Fi32:
|
|
|
2384
2392
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
2385
2393
|
temp = self.unsqueeze()
|
|
2386
2394
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
2387
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
2395
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
2388
2396
|
|
|
2389
2397
|
#TODO : multi-critical
|
|
2390
2398
|
if filtration_grid is None:
|
|
@@ -3106,10 +3114,9 @@ cdef class SimplexTreeMulti_KFi64:
|
|
|
3106
3114
|
preincrement(it)
|
|
3107
3115
|
|
|
3108
3116
|
|
|
3117
|
+
def _get_raw_filtration(self):
|
|
3118
|
+
raise NotImplementedError("Not implemented for multicritical filtrations")
|
|
3109
3119
|
|
|
3110
|
-
def persistence_approximation(self, **kwargs):
|
|
3111
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
3112
|
-
return module_approximation(self, **kwargs)
|
|
3113
3120
|
|
|
3114
3121
|
|
|
3115
3122
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -3543,7 +3550,6 @@ cdef class SimplexTreeMulti_KFi64:
|
|
|
3543
3550
|
self,
|
|
3544
3551
|
filtration_grid:np.ndarray|list|None=None,
|
|
3545
3552
|
bool coordinate_values=True,
|
|
3546
|
-
bool force=False,
|
|
3547
3553
|
str strategy:_available_strategies = "exact",
|
|
3548
3554
|
resolution:Optional[int|list[int]] = None,
|
|
3549
3555
|
bool coordinates = False,
|
|
@@ -3559,8 +3565,6 @@ cdef class SimplexTreeMulti_KFi64:
|
|
|
3559
3565
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
3560
3566
|
:type coordinate_values: bool
|
|
3561
3567
|
"""
|
|
3562
|
-
if not force and self.is_squeezed:
|
|
3563
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
3564
3568
|
|
|
3565
3569
|
if grid_strategy is not None:
|
|
3566
3570
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -3570,7 +3574,7 @@ cdef class SimplexTreeMulti_KFi64:
|
|
|
3570
3574
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
3571
3575
|
temp = self.unsqueeze()
|
|
3572
3576
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
3573
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
3577
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
3574
3578
|
|
|
3575
3579
|
#TODO : multi-critical
|
|
3576
3580
|
if filtration_grid is None:
|
|
@@ -4404,10 +4408,25 @@ cdef class SimplexTreeMulti_Fi64:
|
|
|
4404
4408
|
preincrement(it)
|
|
4405
4409
|
|
|
4406
4410
|
|
|
4411
|
+
def _get_raw_filtration(self):
|
|
4412
|
+
if self.is_squeezed:
|
|
4413
|
+
raise NotImplementedError("Not implemented for squeezed filtrations")
|
|
4414
|
+
cdef int num_parameters = self.num_parameters
|
|
4415
|
+
cdef int64_t[:,:] current_filtration = np.empty((self.num_simplices, self.num_parameters), dtype=self.dtype)
|
|
4416
|
+
|
|
4417
|
+
cdef Simplex_tree_multi_simplices_iterator[Fi64] it = self.get_ptr().get_simplices_iterator_begin()
|
|
4418
|
+
cdef Simplex_tree_multi_simplices_iterator[Fi64] end = self.get_ptr().get_simplices_iterator_end()
|
|
4419
|
+
|
|
4420
|
+
cdef int i=0
|
|
4421
|
+
with nogil:
|
|
4422
|
+
while it != end:
|
|
4423
|
+
pair_sf = <pair[simplex_type, Fi64*]> self.get_ptr().get_simplex_and_filtration(dereference(it))
|
|
4424
|
+
for j in range(num_parameters):
|
|
4425
|
+
current_filtration[i,j] = dereference(pair_sf.second)[j]
|
|
4426
|
+
preincrement(it)
|
|
4427
|
+
i = i+1
|
|
4428
|
+
return np.asarray(current_filtration, dtype=self.dtype)
|
|
4407
4429
|
|
|
4408
|
-
def persistence_approximation(self, **kwargs):
|
|
4409
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
4410
|
-
return module_approximation(self, **kwargs)
|
|
4411
4430
|
|
|
4412
4431
|
|
|
4413
4432
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -4984,7 +5003,6 @@ cdef class SimplexTreeMulti_Fi64:
|
|
|
4984
5003
|
self,
|
|
4985
5004
|
filtration_grid:np.ndarray|list|None=None,
|
|
4986
5005
|
bool coordinate_values=True,
|
|
4987
|
-
bool force=False,
|
|
4988
5006
|
str strategy:_available_strategies = "exact",
|
|
4989
5007
|
resolution:Optional[int|list[int]] = None,
|
|
4990
5008
|
bool coordinates = False,
|
|
@@ -5000,8 +5018,6 @@ cdef class SimplexTreeMulti_Fi64:
|
|
|
5000
5018
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
5001
5019
|
:type coordinate_values: bool
|
|
5002
5020
|
"""
|
|
5003
|
-
if not force and self.is_squeezed:
|
|
5004
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
5005
5021
|
|
|
5006
5022
|
if grid_strategy is not None:
|
|
5007
5023
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -5011,7 +5027,7 @@ cdef class SimplexTreeMulti_Fi64:
|
|
|
5011
5027
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
5012
5028
|
temp = self.unsqueeze()
|
|
5013
5029
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
5014
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
5030
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
5015
5031
|
|
|
5016
5032
|
#TODO : multi-critical
|
|
5017
5033
|
if filtration_grid is None:
|
|
@@ -5733,10 +5749,9 @@ cdef class SimplexTreeMulti_KFf32:
|
|
|
5733
5749
|
preincrement(it)
|
|
5734
5750
|
|
|
5735
5751
|
|
|
5752
|
+
def _get_raw_filtration(self):
|
|
5753
|
+
raise NotImplementedError("Not implemented for multicritical filtrations")
|
|
5736
5754
|
|
|
5737
|
-
def persistence_approximation(self, **kwargs):
|
|
5738
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
5739
|
-
return module_approximation(self, **kwargs)
|
|
5740
5755
|
|
|
5741
5756
|
|
|
5742
5757
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -6170,7 +6185,6 @@ cdef class SimplexTreeMulti_KFf32:
|
|
|
6170
6185
|
self,
|
|
6171
6186
|
filtration_grid:np.ndarray|list|None=None,
|
|
6172
6187
|
bool coordinate_values=True,
|
|
6173
|
-
bool force=False,
|
|
6174
6188
|
str strategy:_available_strategies = "exact",
|
|
6175
6189
|
resolution:Optional[int|list[int]] = None,
|
|
6176
6190
|
bool coordinates = False,
|
|
@@ -6186,8 +6200,6 @@ cdef class SimplexTreeMulti_KFf32:
|
|
|
6186
6200
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
6187
6201
|
:type coordinate_values: bool
|
|
6188
6202
|
"""
|
|
6189
|
-
if not force and self.is_squeezed:
|
|
6190
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
6191
6203
|
|
|
6192
6204
|
if grid_strategy is not None:
|
|
6193
6205
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -6197,7 +6209,7 @@ cdef class SimplexTreeMulti_KFf32:
|
|
|
6197
6209
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
6198
6210
|
temp = self.unsqueeze()
|
|
6199
6211
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
6200
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
6212
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
6201
6213
|
|
|
6202
6214
|
#TODO : multi-critical
|
|
6203
6215
|
if filtration_grid is None:
|
|
@@ -7031,10 +7043,25 @@ cdef class SimplexTreeMulti_Ff32:
|
|
|
7031
7043
|
preincrement(it)
|
|
7032
7044
|
|
|
7033
7045
|
|
|
7046
|
+
def _get_raw_filtration(self):
|
|
7047
|
+
if self.is_squeezed:
|
|
7048
|
+
raise NotImplementedError("Not implemented for squeezed filtrations")
|
|
7049
|
+
cdef int num_parameters = self.num_parameters
|
|
7050
|
+
cdef float[:,:] current_filtration = np.empty((self.num_simplices, self.num_parameters), dtype=self.dtype)
|
|
7051
|
+
|
|
7052
|
+
cdef Simplex_tree_multi_simplices_iterator[Ff32] it = self.get_ptr().get_simplices_iterator_begin()
|
|
7053
|
+
cdef Simplex_tree_multi_simplices_iterator[Ff32] end = self.get_ptr().get_simplices_iterator_end()
|
|
7054
|
+
|
|
7055
|
+
cdef int i=0
|
|
7056
|
+
with nogil:
|
|
7057
|
+
while it != end:
|
|
7058
|
+
pair_sf = <pair[simplex_type, Ff32*]> self.get_ptr().get_simplex_and_filtration(dereference(it))
|
|
7059
|
+
for j in range(num_parameters):
|
|
7060
|
+
current_filtration[i,j] = dereference(pair_sf.second)[j]
|
|
7061
|
+
preincrement(it)
|
|
7062
|
+
i = i+1
|
|
7063
|
+
return np.asarray(current_filtration, dtype=self.dtype)
|
|
7034
7064
|
|
|
7035
|
-
def persistence_approximation(self, **kwargs):
|
|
7036
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
7037
|
-
return module_approximation(self, **kwargs)
|
|
7038
7065
|
|
|
7039
7066
|
|
|
7040
7067
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -7611,7 +7638,6 @@ cdef class SimplexTreeMulti_Ff32:
|
|
|
7611
7638
|
self,
|
|
7612
7639
|
filtration_grid:np.ndarray|list|None=None,
|
|
7613
7640
|
bool coordinate_values=True,
|
|
7614
|
-
bool force=False,
|
|
7615
7641
|
str strategy:_available_strategies = "exact",
|
|
7616
7642
|
resolution:Optional[int|list[int]] = None,
|
|
7617
7643
|
bool coordinates = False,
|
|
@@ -7627,8 +7653,6 @@ cdef class SimplexTreeMulti_Ff32:
|
|
|
7627
7653
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
7628
7654
|
:type coordinate_values: bool
|
|
7629
7655
|
"""
|
|
7630
|
-
if not force and self.is_squeezed:
|
|
7631
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
7632
7656
|
|
|
7633
7657
|
if grid_strategy is not None:
|
|
7634
7658
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -7638,7 +7662,7 @@ cdef class SimplexTreeMulti_Ff32:
|
|
|
7638
7662
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
7639
7663
|
temp = self.unsqueeze()
|
|
7640
7664
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
7641
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
7665
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
7642
7666
|
|
|
7643
7667
|
#TODO : multi-critical
|
|
7644
7668
|
if filtration_grid is None:
|
|
@@ -8360,10 +8384,9 @@ cdef class SimplexTreeMulti_KFf64:
|
|
|
8360
8384
|
preincrement(it)
|
|
8361
8385
|
|
|
8362
8386
|
|
|
8387
|
+
def _get_raw_filtration(self):
|
|
8388
|
+
raise NotImplementedError("Not implemented for multicritical filtrations")
|
|
8363
8389
|
|
|
8364
|
-
def persistence_approximation(self, **kwargs):
|
|
8365
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
8366
|
-
return module_approximation(self, **kwargs)
|
|
8367
8390
|
|
|
8368
8391
|
|
|
8369
8392
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -8797,7 +8820,6 @@ cdef class SimplexTreeMulti_KFf64:
|
|
|
8797
8820
|
self,
|
|
8798
8821
|
filtration_grid:np.ndarray|list|None=None,
|
|
8799
8822
|
bool coordinate_values=True,
|
|
8800
|
-
bool force=False,
|
|
8801
8823
|
str strategy:_available_strategies = "exact",
|
|
8802
8824
|
resolution:Optional[int|list[int]] = None,
|
|
8803
8825
|
bool coordinates = False,
|
|
@@ -8813,8 +8835,6 @@ cdef class SimplexTreeMulti_KFf64:
|
|
|
8813
8835
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
8814
8836
|
:type coordinate_values: bool
|
|
8815
8837
|
"""
|
|
8816
|
-
if not force and self.is_squeezed:
|
|
8817
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
8818
8838
|
|
|
8819
8839
|
if grid_strategy is not None:
|
|
8820
8840
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -8824,7 +8844,7 @@ cdef class SimplexTreeMulti_KFf64:
|
|
|
8824
8844
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
8825
8845
|
temp = self.unsqueeze()
|
|
8826
8846
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
8827
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
8847
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
8828
8848
|
|
|
8829
8849
|
#TODO : multi-critical
|
|
8830
8850
|
if filtration_grid is None:
|
|
@@ -9658,10 +9678,25 @@ cdef class SimplexTreeMulti_Ff64:
|
|
|
9658
9678
|
preincrement(it)
|
|
9659
9679
|
|
|
9660
9680
|
|
|
9681
|
+
def _get_raw_filtration(self):
|
|
9682
|
+
if self.is_squeezed:
|
|
9683
|
+
raise NotImplementedError("Not implemented for squeezed filtrations")
|
|
9684
|
+
cdef int num_parameters = self.num_parameters
|
|
9685
|
+
cdef double[:,:] current_filtration = np.empty((self.num_simplices, self.num_parameters), dtype=self.dtype)
|
|
9686
|
+
|
|
9687
|
+
cdef Simplex_tree_multi_simplices_iterator[Ff64] it = self.get_ptr().get_simplices_iterator_begin()
|
|
9688
|
+
cdef Simplex_tree_multi_simplices_iterator[Ff64] end = self.get_ptr().get_simplices_iterator_end()
|
|
9689
|
+
|
|
9690
|
+
cdef int i=0
|
|
9691
|
+
with nogil:
|
|
9692
|
+
while it != end:
|
|
9693
|
+
pair_sf = <pair[simplex_type, Ff64*]> self.get_ptr().get_simplex_and_filtration(dereference(it))
|
|
9694
|
+
for j in range(num_parameters):
|
|
9695
|
+
current_filtration[i,j] = dereference(pair_sf.second)[j]
|
|
9696
|
+
preincrement(it)
|
|
9697
|
+
i = i+1
|
|
9698
|
+
return np.asarray(current_filtration, dtype=self.dtype)
|
|
9661
9699
|
|
|
9662
|
-
def persistence_approximation(self, **kwargs):
|
|
9663
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
9664
|
-
return module_approximation(self, **kwargs)
|
|
9665
9700
|
|
|
9666
9701
|
|
|
9667
9702
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -10238,7 +10273,6 @@ cdef class SimplexTreeMulti_Ff64:
|
|
|
10238
10273
|
self,
|
|
10239
10274
|
filtration_grid:np.ndarray|list|None=None,
|
|
10240
10275
|
bool coordinate_values=True,
|
|
10241
|
-
bool force=False,
|
|
10242
10276
|
str strategy:_available_strategies = "exact",
|
|
10243
10277
|
resolution:Optional[int|list[int]] = None,
|
|
10244
10278
|
bool coordinates = False,
|
|
@@ -10254,8 +10288,6 @@ cdef class SimplexTreeMulti_Ff64:
|
|
|
10254
10288
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
10255
10289
|
:type coordinate_values: bool
|
|
10256
10290
|
"""
|
|
10257
|
-
if not force and self.is_squeezed:
|
|
10258
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
10259
10291
|
|
|
10260
10292
|
if grid_strategy is not None:
|
|
10261
10293
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -10265,7 +10297,7 @@ cdef class SimplexTreeMulti_Ff64:
|
|
|
10265
10297
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
10266
10298
|
temp = self.unsqueeze()
|
|
10267
10299
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
10268
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
10300
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
10269
10301
|
|
|
10270
10302
|
#TODO : multi-critical
|
|
10271
10303
|
if filtration_grid is None:
|
|
@@ -715,10 +715,29 @@ cdef class SimplexTreeMulti_{{FSHORT}}:
|
|
|
715
715
|
preincrement(it)
|
|
716
716
|
|
|
717
717
|
|
|
718
|
+
def _get_raw_filtration(self):
|
|
719
|
+
{{if is_kcritical}}
|
|
720
|
+
raise NotImplementedError("Not implemented for multicritical filtrations")
|
|
721
|
+
{{else}}
|
|
722
|
+
if self.is_squeezed:
|
|
723
|
+
raise NotImplementedError("Not implemented for squeezed filtrations")
|
|
724
|
+
cdef int num_parameters = self.num_parameters
|
|
725
|
+
cdef {{CTYPE}}[:,:] current_filtration = np.empty((self.num_simplices, self.num_parameters), dtype=self.dtype)
|
|
726
|
+
|
|
727
|
+
cdef Simplex_tree_multi_simplices_iterator[{{FSHORT}}] it = self.get_ptr().get_simplices_iterator_begin()
|
|
728
|
+
cdef Simplex_tree_multi_simplices_iterator[{{FSHORT}}] end = self.get_ptr().get_simplices_iterator_end()
|
|
729
|
+
|
|
730
|
+
cdef int i=0
|
|
731
|
+
with nogil:
|
|
732
|
+
while it != end:
|
|
733
|
+
pair_sf = <pair[simplex_type, {{FSHORT}}*]> self.get_ptr().get_simplex_and_filtration(dereference(it))
|
|
734
|
+
for j in range(num_parameters):
|
|
735
|
+
current_filtration[i,j] = dereference(pair_sf.second)[j]
|
|
736
|
+
preincrement(it)
|
|
737
|
+
i = i+1
|
|
738
|
+
return np.asarray(current_filtration, dtype=self.dtype)
|
|
739
|
+
{{endif}}
|
|
718
740
|
|
|
719
|
-
def persistence_approximation(self, **kwargs):
|
|
720
|
-
from multipers.multiparameter_module_approximation import module_approximation
|
|
721
|
-
return module_approximation(self, **kwargs)
|
|
722
741
|
|
|
723
742
|
|
|
724
743
|
def get_skeleton(self, dimension)->Iterable[tuple[np.ndarray,np.ndarray]]:
|
|
@@ -1326,7 +1345,6 @@ cdef class SimplexTreeMulti_{{FSHORT}}:
|
|
|
1326
1345
|
self,
|
|
1327
1346
|
filtration_grid:np.ndarray|list|None=None,
|
|
1328
1347
|
bool coordinate_values=True,
|
|
1329
|
-
bool force=False,
|
|
1330
1348
|
str strategy:_available_strategies = "exact",
|
|
1331
1349
|
resolution:Optional[int|list[int]] = None,
|
|
1332
1350
|
bool coordinates = False,
|
|
@@ -1342,8 +1360,6 @@ cdef class SimplexTreeMulti_{{FSHORT}}:
|
|
|
1342
1360
|
:param coordinate_values: If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.
|
|
1343
1361
|
:type coordinate_values: bool
|
|
1344
1362
|
"""
|
|
1345
|
-
if not force and self.is_squeezed:
|
|
1346
|
-
raise Exception("SimplexTree already squeezed, use `force=True` if that's really what you want to do.")
|
|
1347
1363
|
|
|
1348
1364
|
if grid_strategy is not None:
|
|
1349
1365
|
warn("`grid_strategy` is deprecated, use `strategy` instead.",DeprecationWarning)
|
|
@@ -1353,7 +1369,7 @@ cdef class SimplexTreeMulti_{{FSHORT}}:
|
|
|
1353
1369
|
warn("(copy warning) Squeezing an already squeezed slicer.")
|
|
1354
1370
|
temp = self.unsqueeze()
|
|
1355
1371
|
subgrid = compute_grid(self.filtration_grid, strategy=strategy, resolution=resolution)
|
|
1356
|
-
return temp.grid_squeeze(subgrid, coordinates=coordinates, inplace=inplace)
|
|
1372
|
+
return temp.grid_squeeze(sanitize_grid(subgrid, numpyfy=True), coordinates=coordinates, inplace=inplace)
|
|
1357
1373
|
|
|
1358
1374
|
#TODO : multi-critical
|
|
1359
1375
|
if filtration_grid is None:
|
|
Binary file
|