islpy 2025.2.1__cp313-cp313-macosx_11_0_arm64.whl → 2025.2.4__cp313-cp313-macosx_11_0_arm64.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.
- islpy/__init__.py +29 -28
- islpy/_isl.cpython-313-darwin.so +0 -0
- islpy/_isl.pyi +44 -42
- islpy/_monkeypatch.py +172 -69
- {islpy-2025.2.1.dist-info → islpy-2025.2.4.dist-info}/METADATA +1 -1
- islpy-2025.2.4.dist-info/RECORD +9 -0
- islpy-2025.2.1.dist-info/RECORD +0 -9
- {islpy-2025.2.1.dist-info → islpy-2025.2.4.dist-info}/WHEEL +0 -0
islpy/__init__.py
CHANGED
@@ -21,7 +21,7 @@ THE SOFTWARE.
|
|
21
21
|
"""
|
22
22
|
|
23
23
|
from collections.abc import Collection, Sequence
|
24
|
-
from typing import Literal, TypeAlias, TypeVar
|
24
|
+
from typing import Literal, TypeAlias, TypeVar, cast
|
25
25
|
|
26
26
|
from islpy.version import VERSION, VERSION_TEXT
|
27
27
|
|
@@ -135,6 +135,7 @@ Alignable: TypeAlias = (
|
|
135
135
|
| Aff | PwAff
|
136
136
|
)
|
137
137
|
AlignableT = TypeVar("AlignableT", bound=Alignable)
|
138
|
+
AlignableT2 = TypeVar("AlignableT2", bound=Alignable)
|
138
139
|
|
139
140
|
# }}}
|
140
141
|
|
@@ -149,44 +150,44 @@ def _get_default_context() -> Context:
|
|
149
150
|
return DEFAULT_CONTEXT
|
150
151
|
|
151
152
|
|
152
|
-
def
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
bset = BasicSet.universe(new_obj.space).complement()
|
153
|
+
def _set_dim_id(obj: AlignableT, dt: dim_type, idx: int, id: Id) -> AlignableT:
|
154
|
+
if isinstance(obj, BasicSet):
|
155
|
+
s = obj.to_set().set_dim_id(dt, idx, id)
|
156
|
+
basicsets = s.get_basic_sets()
|
157
|
+
if not basicsets:
|
158
|
+
result = BasicSet.empty(s.space)
|
159
159
|
else:
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
if len(bmaps) == 0:
|
168
|
-
bmap = BasicMap.universe(new_obj.space).complement()
|
160
|
+
result, = basicsets
|
161
|
+
return cast("AlignableT", result)
|
162
|
+
elif isinstance(obj, BasicMap):
|
163
|
+
m = obj.to_map().set_dim_id(dt, idx, id)
|
164
|
+
basicmaps = m.get_basic_maps()
|
165
|
+
if not basicmaps:
|
166
|
+
result = BasicMap.empty(m.space)
|
169
167
|
else:
|
170
|
-
|
168
|
+
result, = basicmaps
|
169
|
+
return cast("AlignableT", result)
|
171
170
|
|
172
|
-
|
173
|
-
|
174
|
-
return new_obj
|
175
|
-
|
176
|
-
|
177
|
-
def _set_dim_id(obj, dt, idx, id):
|
178
|
-
return _back_to_basic(obj.set_dim_id(dt, idx, id), obj)
|
171
|
+
return cast("AlignableT", obj.set_dim_id(dt, idx, id))
|
179
172
|
|
180
173
|
|
181
174
|
def _align_dim_type(
|
182
175
|
template_dt: dim_type,
|
183
176
|
obj: AlignableT,
|
184
|
-
template:
|
177
|
+
template: Alignable,
|
185
178
|
obj_bigger_ok: bool,
|
186
179
|
obj_names: Collection[str],
|
187
180
|
template_names: Collection[str],
|
188
181
|
) -> AlignableT:
|
189
182
|
|
183
|
+
# convert to a type that has get_dim_id
|
184
|
+
if isinstance(template, BasicSet):
|
185
|
+
template = template.to_set()
|
186
|
+
elif isinstance(template, BasicMap):
|
187
|
+
template = template.to_map()
|
188
|
+
elif isinstance(template, Aff):
|
189
|
+
template = template.to_pw_aff()
|
190
|
+
|
190
191
|
# {{{ deal with Aff, PwAff
|
191
192
|
|
192
193
|
# The technique below will not work for PwAff et al, because there is *only*
|
@@ -314,8 +315,8 @@ def align_spaces(
|
|
314
315
|
|
315
316
|
def align_two(
|
316
317
|
obj1: AlignableT,
|
317
|
-
obj2:
|
318
|
-
) -> tuple[AlignableT,
|
318
|
+
obj2: AlignableT2,
|
319
|
+
) -> tuple[AlignableT, AlignableT2]:
|
319
320
|
"""Align the spaces of two objects, potentially modifying both of them.
|
320
321
|
|
321
322
|
See also :func:`align_spaces`.
|
islpy/_isl.cpython-313-darwin.so
CHANGED
Binary file
|
islpy/_isl.pyi
CHANGED
@@ -2151,6 +2151,8 @@ class FixedBox:
|
|
2151
2151
|
class Aff:
|
2152
2152
|
def __init__(self, s: str, context: Context | None = None) -> None: ...
|
2153
2153
|
|
2154
|
+
def to_pw_aff(self) -> PwAff: ...
|
2155
|
+
|
2154
2156
|
@staticmethod
|
2155
2157
|
def zero_on_domain_space(space: Space) -> Aff: ...
|
2156
2158
|
|
@@ -4931,6 +4933,10 @@ class LocalSpace:
|
|
4931
4933
|
class BasicSet:
|
4932
4934
|
def __init__(self, s: str, context: Context | None = None) -> None: ...
|
4933
4935
|
|
4936
|
+
def __hash__(self) -> int: ...
|
4937
|
+
|
4938
|
+
def is_params(self) -> bool: ...
|
4939
|
+
|
4934
4940
|
def n_dim(self) -> int: ...
|
4935
4941
|
|
4936
4942
|
def n_param(self) -> int: ...
|
@@ -5311,8 +5317,6 @@ class BasicSet:
|
|
5311
5317
|
|
5312
5318
|
def involves_locals(self) -> bool: ...
|
5313
5319
|
|
5314
|
-
def is_params(self) -> bool: ...
|
5315
|
-
|
5316
5320
|
@overload
|
5317
5321
|
def is_strict_subset(self, set2: Set | BasicSet) -> bool: ...
|
5318
5322
|
|
@@ -5365,8 +5369,6 @@ class BasicSet:
|
|
5365
5369
|
|
5366
5370
|
def plain_is_disjoint(self, set2: Set | BasicSet) -> bool: ...
|
5367
5371
|
|
5368
|
-
def __hash__(self) -> int: ...
|
5369
|
-
|
5370
5372
|
def n_basic_set(self) -> int: ...
|
5371
5373
|
|
5372
5374
|
def foreach_basic_set(self, fn: Callable[[BasicSet], None]) -> None: ...
|
@@ -5459,13 +5461,13 @@ class BasicSet:
|
|
5459
5461
|
|
5460
5462
|
__ne__ = islpy._monkeypatch.obj_ne
|
5461
5463
|
|
5462
|
-
__lt__ = islpy._monkeypatch.
|
5464
|
+
__lt__ = islpy._monkeypatch.set_lt
|
5463
5465
|
|
5464
|
-
__le__ = islpy._monkeypatch.
|
5466
|
+
__le__ = islpy._monkeypatch.set_le
|
5465
5467
|
|
5466
|
-
__gt__ = islpy._monkeypatch.
|
5468
|
+
__gt__ = islpy._monkeypatch.set_gt
|
5467
5469
|
|
5468
|
-
__ge__ = islpy._monkeypatch.
|
5470
|
+
__ge__ = islpy._monkeypatch.set_ge
|
5469
5471
|
|
5470
5472
|
project_out_except = islpy._monkeypatch.obj_project_out_except
|
5471
5473
|
|
@@ -5487,15 +5489,15 @@ class BasicSet:
|
|
5487
5489
|
|
5488
5490
|
__repr__ = islpy._monkeypatch.generic_repr
|
5489
5491
|
|
5490
|
-
|
5492
|
+
__and__ = islpy._monkeypatch.bset_and
|
5491
5493
|
|
5492
|
-
|
5494
|
+
__rand__ = islpy._monkeypatch.bset_and
|
5493
5495
|
|
5494
|
-
|
5496
|
+
__or__ = islpy._monkeypatch.set_or
|
5495
5497
|
|
5496
|
-
|
5498
|
+
__ror__ = islpy._monkeypatch.set_or
|
5497
5499
|
|
5498
|
-
__sub__ = islpy._monkeypatch.
|
5500
|
+
__sub__ = islpy._monkeypatch.set_sub
|
5499
5501
|
|
5500
5502
|
get_constraints = islpy._monkeypatch.basic_obj_get_constraints
|
5501
5503
|
|
@@ -5504,6 +5506,8 @@ class BasicSet:
|
|
5504
5506
|
class BasicMap:
|
5505
5507
|
def __init__(self, s: str, context: Context | None = None) -> None: ...
|
5506
5508
|
|
5509
|
+
def __hash__(self) -> int: ...
|
5510
|
+
|
5507
5511
|
def to_map(self) -> Map: ...
|
5508
5512
|
|
5509
5513
|
def total_dim(self) -> int: ...
|
@@ -6108,8 +6112,6 @@ class BasicMap:
|
|
6108
6112
|
|
6109
6113
|
def plain_is_equal(self, map2: Map | BasicMap) -> bool: ...
|
6110
6114
|
|
6111
|
-
def __hash__(self) -> int: ...
|
6112
|
-
|
6113
6115
|
def n_basic_map(self) -> int: ...
|
6114
6116
|
|
6115
6117
|
def foreach_basic_map(self, fn: Callable[[BasicMap], None]) -> None: ...
|
@@ -6220,13 +6222,13 @@ class BasicMap:
|
|
6220
6222
|
|
6221
6223
|
__ne__ = islpy._monkeypatch.obj_ne
|
6222
6224
|
|
6223
|
-
__lt__ = islpy._monkeypatch.
|
6225
|
+
__lt__ = islpy._monkeypatch.map_lt
|
6224
6226
|
|
6225
|
-
__le__ = islpy._monkeypatch.
|
6227
|
+
__le__ = islpy._monkeypatch.map_le
|
6226
6228
|
|
6227
|
-
__gt__ = islpy._monkeypatch.
|
6229
|
+
__gt__ = islpy._monkeypatch.map_gt
|
6228
6230
|
|
6229
|
-
__ge__ = islpy._monkeypatch.
|
6231
|
+
__ge__ = islpy._monkeypatch.map_ge
|
6230
6232
|
|
6231
6233
|
project_out_except = islpy._monkeypatch.obj_project_out_except
|
6232
6234
|
|
@@ -6246,15 +6248,15 @@ class BasicMap:
|
|
6246
6248
|
|
6247
6249
|
__repr__ = islpy._monkeypatch.generic_repr
|
6248
6250
|
|
6249
|
-
|
6251
|
+
__and__ = islpy._monkeypatch.bmap_and
|
6250
6252
|
|
6251
|
-
|
6253
|
+
__rand__ = islpy._monkeypatch.bmap_and
|
6252
6254
|
|
6253
|
-
|
6255
|
+
__or__ = islpy._monkeypatch.map_or
|
6254
6256
|
|
6255
|
-
|
6257
|
+
__ror__ = islpy._monkeypatch.map_or
|
6256
6258
|
|
6257
|
-
__sub__ = islpy._monkeypatch.
|
6259
|
+
__sub__ = islpy._monkeypatch.map_sub
|
6258
6260
|
|
6259
6261
|
get_constraints = islpy._monkeypatch.basic_obj_get_constraints
|
6260
6262
|
|
@@ -6724,13 +6726,13 @@ class Set:
|
|
6724
6726
|
|
6725
6727
|
__ne__ = islpy._monkeypatch.obj_ne
|
6726
6728
|
|
6727
|
-
__lt__ = islpy._monkeypatch.
|
6729
|
+
__lt__ = islpy._monkeypatch.set_lt
|
6728
6730
|
|
6729
|
-
__le__ = islpy._monkeypatch.
|
6731
|
+
__le__ = islpy._monkeypatch.set_le
|
6730
6732
|
|
6731
|
-
__gt__ = islpy._monkeypatch.
|
6733
|
+
__gt__ = islpy._monkeypatch.set_gt
|
6732
6734
|
|
6733
|
-
__ge__ = islpy._monkeypatch.
|
6735
|
+
__ge__ = islpy._monkeypatch.set_ge
|
6734
6736
|
|
6735
6737
|
project_out_except = islpy._monkeypatch.obj_project_out_except
|
6736
6738
|
|
@@ -6752,15 +6754,15 @@ class Set:
|
|
6752
6754
|
|
6753
6755
|
__repr__ = islpy._monkeypatch.generic_repr
|
6754
6756
|
|
6755
|
-
|
6757
|
+
__and__ = islpy._monkeypatch.set_and
|
6756
6758
|
|
6757
|
-
|
6759
|
+
__rand__ = islpy._monkeypatch.set_and
|
6758
6760
|
|
6759
|
-
|
6761
|
+
__or__ = islpy._monkeypatch.set_or
|
6760
6762
|
|
6761
|
-
|
6763
|
+
__ror__ = islpy._monkeypatch.set_or
|
6762
6764
|
|
6763
|
-
__sub__ = islpy._monkeypatch.
|
6765
|
+
__sub__ = islpy._monkeypatch.set_sub
|
6764
6766
|
|
6765
6767
|
get_basic_sets = islpy._monkeypatch.set_get_basic_sets
|
6766
6768
|
|
@@ -7403,13 +7405,13 @@ class Map:
|
|
7403
7405
|
|
7404
7406
|
__ne__ = islpy._monkeypatch.obj_ne
|
7405
7407
|
|
7406
|
-
__lt__ = islpy._monkeypatch.
|
7408
|
+
__lt__ = islpy._monkeypatch.map_lt
|
7407
7409
|
|
7408
|
-
__le__ = islpy._monkeypatch.
|
7410
|
+
__le__ = islpy._monkeypatch.map_le
|
7409
7411
|
|
7410
|
-
__gt__ = islpy._monkeypatch.
|
7412
|
+
__gt__ = islpy._monkeypatch.map_gt
|
7411
7413
|
|
7412
|
-
__ge__ = islpy._monkeypatch.
|
7414
|
+
__ge__ = islpy._monkeypatch.map_ge
|
7413
7415
|
|
7414
7416
|
project_out_except = islpy._monkeypatch.obj_project_out_except
|
7415
7417
|
|
@@ -7429,15 +7431,15 @@ class Map:
|
|
7429
7431
|
|
7430
7432
|
__repr__ = islpy._monkeypatch.generic_repr
|
7431
7433
|
|
7432
|
-
|
7434
|
+
__and__ = islpy._monkeypatch.map_and
|
7433
7435
|
|
7434
|
-
|
7436
|
+
__rand__ = islpy._monkeypatch.map_and
|
7435
7437
|
|
7436
|
-
|
7438
|
+
__or__ = islpy._monkeypatch.map_or
|
7437
7439
|
|
7438
|
-
|
7440
|
+
__ror__ = islpy._monkeypatch.map_or
|
7439
7441
|
|
7440
|
-
__sub__ = islpy._monkeypatch.
|
7442
|
+
__sub__ = islpy._monkeypatch.map_sub
|
7441
7443
|
|
7442
7444
|
get_basic_maps = islpy._monkeypatch.map_get_basic_maps
|
7443
7445
|
|
islpy/_monkeypatch.py
CHANGED
@@ -5,7 +5,6 @@ from functools import update_wrapper
|
|
5
5
|
from sys import intern
|
6
6
|
from typing import (
|
7
7
|
TYPE_CHECKING,
|
8
|
-
Any,
|
9
8
|
ClassVar,
|
10
9
|
Concatenate,
|
11
10
|
Literal,
|
@@ -43,6 +42,10 @@ _CHECK_DIM_TYPES: tuple[_isl.dim_type, ...] = (
|
|
43
42
|
|
44
43
|
# {{{ typing helpers
|
45
44
|
|
45
|
+
T = TypeVar("T")
|
46
|
+
P = ParamSpec("P")
|
47
|
+
ResultT = TypeVar("ResultT")
|
48
|
+
|
46
49
|
SelfT = TypeVar("SelfT")
|
47
50
|
|
48
51
|
BasicT = TypeVar("BasicT", _isl.BasicSet, _isl.BasicMap)
|
@@ -54,36 +57,28 @@ ExprLikeT = TypeVar("ExprLikeT", _isl.Aff, _isl.PwAff,
|
|
54
57
|
_isl.QPolynomial, _isl.PwQPolynomial
|
55
58
|
)
|
56
59
|
SetLikeT = TypeVar("SetLikeT", bound=_isl.BasicSet | _isl.Set)
|
60
|
+
|
61
|
+
SetOrBasic: TypeAlias = _isl.BasicSet | _isl.Set
|
62
|
+
SetOrBasicT = TypeVar("SetOrBasicT", bound=SetOrBasic)
|
63
|
+
|
64
|
+
MapOrBasic: TypeAlias = _isl.BasicMap | _isl.Map
|
65
|
+
MapOrBasicT = TypeVar("MapOrBasicT", bound=MapOrBasic)
|
66
|
+
|
57
67
|
SetOrMap: TypeAlias = _isl.BasicSet | _isl.Set | _isl.BasicMap | _isl.Map
|
58
|
-
SetOrMapT = TypeVar("SetOrMapT",
|
68
|
+
SetOrMapT = TypeVar("SetOrMapT", _isl.BasicSet, _isl.Set, _isl.BasicMap, _isl.Map)
|
59
69
|
|
60
70
|
HasSpace: TypeAlias = (
|
61
71
|
_isl.Space
|
62
|
-
| _isl.Aff
|
63
|
-
| _isl.BasicMap
|
64
|
-
| _isl.BasicSet
|
65
72
|
| _isl.Constraint
|
66
73
|
| _isl.LocalSpace
|
67
|
-
| _isl.
|
74
|
+
| _isl.Aff
|
68
75
|
| _isl.MultiAff
|
69
|
-
| _isl.MultiId
|
70
|
-
| _isl.MultiPwAff
|
71
|
-
| _isl.MultiUnionPwAff
|
72
|
-
| _isl.MultiVal
|
73
|
-
| _isl.Point
|
74
76
|
| _isl.PwAff
|
75
77
|
| _isl.PwMultiAff
|
76
|
-
| _isl.
|
77
|
-
| _isl.
|
78
|
-
| _isl.QPolynomial
|
79
|
-
| _isl.QPolynomialFold
|
78
|
+
| _isl.BasicMap
|
79
|
+
| _isl.BasicSet
|
80
80
|
| _isl.Set
|
81
|
-
| _isl.
|
82
|
-
| _isl.UnionPwAff
|
83
|
-
| _isl.UnionPwMultiAff
|
84
|
-
| _isl.UnionPwQPolynomial
|
85
|
-
| _isl.UnionPwQPolynomialFold
|
86
|
-
| _isl.UnionSet
|
81
|
+
| _isl.Map
|
87
82
|
)
|
88
83
|
|
89
84
|
|
@@ -101,34 +96,30 @@ class IslObject(Protocol):
|
|
101
96
|
|
102
97
|
# {{{ copied verbatim from pytools to avoid numpy/pytools dependency
|
103
98
|
|
104
|
-
F = TypeVar("F", bound=Callable[..., Any])
|
105
|
-
|
106
|
-
|
107
99
|
class _HasKwargs:
|
108
100
|
pass
|
109
101
|
|
110
102
|
|
111
|
-
def _memoize_on_first_arg(
|
103
|
+
def _memoize_on_first_arg(
|
104
|
+
function: Callable[Concatenate[T, P], ResultT], *,
|
105
|
+
cache_dict_name: str | None = None) -> Callable[Concatenate[T, P], ResultT]:
|
112
106
|
"""Like :func:`memoize_method`, but for functions that take the object
|
113
107
|
in which do memoization information is stored as first argument.
|
114
108
|
|
115
109
|
Supports cache deletion via ``function_name.clear_cache(self)``.
|
116
110
|
"""
|
117
|
-
from sys import intern
|
118
111
|
|
119
112
|
if cache_dict_name is None:
|
120
113
|
cache_dict_name = intern(
|
121
114
|
f"_memoize_dic_{function.__module__}{function.__name__}"
|
122
115
|
)
|
123
116
|
|
124
|
-
def wrapper(obj, *args, **kwargs):
|
125
|
-
if kwargs
|
126
|
-
key = (_HasKwargs, frozenset(kwargs.items()), *args)
|
127
|
-
else:
|
128
|
-
key = args
|
117
|
+
def wrapper(obj: T, *args: P.args, **kwargs: P.kwargs) -> ResultT:
|
118
|
+
key = (_HasKwargs, frozenset(kwargs.items()), *args) if kwargs else args
|
129
119
|
|
120
|
+
assert cache_dict_name is not None
|
130
121
|
try:
|
131
|
-
return getattr(obj, cache_dict_name)[key]
|
122
|
+
return cast("ResultT", getattr(obj, cache_dict_name)[key])
|
132
123
|
except AttributeError:
|
133
124
|
attribute_error = True
|
134
125
|
except KeyError:
|
@@ -138,11 +129,10 @@ def _memoize_on_first_arg(function: F, cache_dict_name: str | None = None) -> F:
|
|
138
129
|
if attribute_error:
|
139
130
|
object.__setattr__(obj, cache_dict_name, {key: result})
|
140
131
|
return result
|
141
|
-
|
142
|
-
|
143
|
-
return result
|
132
|
+
getattr(obj, cache_dict_name)[key] = result
|
133
|
+
return result
|
144
134
|
|
145
|
-
def clear_cache(obj):
|
135
|
+
def clear_cache(obj: object):
|
146
136
|
object.__delattr__(obj, cache_dict_name)
|
147
137
|
|
148
138
|
from functools import update_wrapper
|
@@ -152,7 +142,8 @@ def _memoize_on_first_arg(function: F, cache_dict_name: str | None = None) -> F:
|
|
152
142
|
# into the function's dict is moderately sketchy.
|
153
143
|
new_wrapper.clear_cache = clear_cache # type: ignore[attr-defined]
|
154
144
|
|
155
|
-
return
|
145
|
+
return new_wrapper
|
146
|
+
|
156
147
|
|
157
148
|
# }}}
|
158
149
|
|
@@ -190,7 +181,7 @@ def context_ne(self: object, other: object) -> bool:
|
|
190
181
|
return not self.__eq__(other)
|
191
182
|
|
192
183
|
|
193
|
-
def generic_reduce(self:
|
184
|
+
def generic_reduce(self: HasSpace):
|
194
185
|
ctx = self.get_ctx()
|
195
186
|
prn = _isl.Printer.to_str(ctx)
|
196
187
|
prn = getattr(prn, f"print_{self._base_name}")(self)
|
@@ -331,21 +322,100 @@ def space_create_from_names(
|
|
331
322
|
return result
|
332
323
|
|
333
324
|
|
334
|
-
def
|
325
|
+
def set_or(
|
326
|
+
self: _isl.Set,
|
327
|
+
other: _isl.Set | _isl.BasicSet,
|
328
|
+
) -> _isl.Set:
|
329
|
+
try:
|
330
|
+
return self.union(other)
|
331
|
+
except TypeError:
|
332
|
+
return NotImplemented
|
333
|
+
|
334
|
+
|
335
|
+
def bset_and(
|
336
|
+
self: _isl.BasicSet,
|
337
|
+
other: SetOrBasicT,
|
338
|
+
) -> SetOrBasicT:
|
339
|
+
if isinstance(other, _isl.Set):
|
340
|
+
try:
|
341
|
+
return self.to_set().intersect(other)
|
342
|
+
except TypeError:
|
343
|
+
return NotImplemented
|
344
|
+
else:
|
345
|
+
try:
|
346
|
+
return self.intersect(other)
|
347
|
+
except TypeError:
|
348
|
+
return NotImplemented
|
349
|
+
|
350
|
+
|
351
|
+
def set_and(
|
352
|
+
self: _isl.Set,
|
353
|
+
other: _isl.Set | _isl.BasicSet,
|
354
|
+
) -> _isl.Set:
|
355
|
+
if isinstance(self, _isl.BasicSet):
|
356
|
+
self = self.to_set()
|
357
|
+
try:
|
358
|
+
return self.intersect(other)
|
359
|
+
except TypeError:
|
360
|
+
return NotImplemented
|
361
|
+
|
362
|
+
|
363
|
+
def set_sub(
|
364
|
+
self: _isl.Set | _isl.BasicSet,
|
365
|
+
other: _isl.Set | _isl.BasicSet,
|
366
|
+
) -> _isl.Set:
|
367
|
+
if isinstance(self, _isl.BasicSet):
|
368
|
+
self = self.to_set()
|
369
|
+
try:
|
370
|
+
return self.subtract(other)
|
371
|
+
except TypeError:
|
372
|
+
return NotImplemented
|
373
|
+
|
374
|
+
|
375
|
+
def map_or(
|
376
|
+
self: _isl.Map | _isl.BasicMap,
|
377
|
+
other: _isl.Map | _isl.BasicMap,
|
378
|
+
) -> _isl.Map:
|
379
|
+
if isinstance(self, _isl.BasicMap):
|
380
|
+
self = self.to_map()
|
335
381
|
try:
|
336
382
|
return self.union(other)
|
337
383
|
except TypeError:
|
338
384
|
return NotImplemented
|
339
385
|
|
340
386
|
|
341
|
-
def
|
387
|
+
def bmap_and(
|
388
|
+
self: _isl.BasicMap,
|
389
|
+
other: MapOrBasicT,
|
390
|
+
) -> MapOrBasicT:
|
391
|
+
if isinstance(other, _isl.Map):
|
392
|
+
try:
|
393
|
+
return self.to_map().intersect(other)
|
394
|
+
except TypeError:
|
395
|
+
return NotImplemented
|
396
|
+
else:
|
397
|
+
try:
|
398
|
+
return self.intersect(other)
|
399
|
+
except TypeError:
|
400
|
+
return NotImplemented
|
401
|
+
|
402
|
+
|
403
|
+
def map_and(
|
404
|
+
self: _isl.Map,
|
405
|
+
other: _isl.Map | _isl.BasicMap,
|
406
|
+
) -> _isl.Map:
|
342
407
|
try:
|
343
408
|
return self.intersect(other)
|
344
409
|
except TypeError:
|
345
410
|
return NotImplemented
|
346
411
|
|
347
412
|
|
348
|
-
def
|
413
|
+
def map_sub(
|
414
|
+
self: _isl.Map | _isl.BasicMap,
|
415
|
+
other: _isl.Map | _isl.BasicMap,
|
416
|
+
) -> _isl.Map:
|
417
|
+
if isinstance(self, _isl.BasicMap):
|
418
|
+
self = self.to_map()
|
349
419
|
try:
|
350
420
|
return self.subtract(other)
|
351
421
|
except TypeError:
|
@@ -538,19 +608,23 @@ def obj_get_var_dict(
|
|
538
608
|
def obj_get_var_ids(
|
539
609
|
self: HasSpace,
|
540
610
|
dimtype: _isl.dim_type
|
541
|
-
) -> Sequence[str]:
|
611
|
+
) -> Sequence[str | None]:
|
542
612
|
"""Return a list of :class:`Id` instances for :class:`dim_type` *dimtype*."""
|
543
|
-
return [
|
613
|
+
return [
|
614
|
+
self.get_dim_name(dimtype, i)
|
615
|
+
for i in range(self.dim(dimtype))]
|
544
616
|
|
545
617
|
|
546
618
|
@_memoize_on_first_arg
|
547
|
-
def obj_get_var_names(self: HasSpace, dimtype: _isl.dim_type) -> Sequence[str]:
|
619
|
+
def obj_get_var_names(self: HasSpace, dimtype: _isl.dim_type) -> Sequence[str | None]:
|
548
620
|
"""Return a list of dim names (in order) for :class:`dim_type` *dimtype*."""
|
549
621
|
return [self.get_dim_name(dimtype, i)
|
550
622
|
for i in range(self.dim(dimtype))]
|
551
623
|
|
552
624
|
|
553
625
|
def pwaff_get_pieces(self: _isl.PwAff | _isl.Aff) -> list[tuple[_isl.Set, _isl.Aff]]:
|
626
|
+
if isinstance(self, _isl.Aff):
|
627
|
+
self = self.to_pw_aff()
|
554
628
|
result: list[tuple[_isl.Set, _isl.Aff]] = []
|
555
629
|
|
556
630
|
def append_tuple(s: _isl.Set, v: _isl.Aff):
|
@@ -583,7 +657,7 @@ def pw_get_aggregate_domain(self: _isl.PwAff | _isl.PwQPolynomial) -> _isl.Set:
|
|
583
657
|
|
584
658
|
result = _isl.Set.empty(self.get_domain_space())
|
585
659
|
for dom, _ in self.get_pieces():
|
586
|
-
result = result.union(
|
660
|
+
result = result.union(dom)
|
587
661
|
|
588
662
|
return result
|
589
663
|
|
@@ -655,7 +729,7 @@ def expr_like_add(self: ExprLikeT, other: ExprLikeT | int | _isl.Val) -> ExprLik
|
|
655
729
|
return NotImplemented
|
656
730
|
|
657
731
|
|
658
|
-
def expr_like_sub(self: ExprLikeT, other: ExprLikeT | int | _isl.Val):
|
732
|
+
def expr_like_sub(self: ExprLikeT, other: ExprLikeT | int | _isl.Val) -> ExprLikeT:
|
659
733
|
if not isinstance(other, ExprLike):
|
660
734
|
other = _number_to_expr_like(self, other)
|
661
735
|
|
@@ -725,29 +799,45 @@ for cls in ALL_CLASSES:
|
|
725
799
|
cls.__ne__ = obj_ne
|
726
800
|
|
727
801
|
|
728
|
-
def
|
802
|
+
def set_lt(self: _isl.BasicSet | _isl.Set, other: _isl.BasicSet | _isl.Set) -> bool:
|
729
803
|
return self.is_strict_subset(other)
|
730
804
|
|
731
805
|
|
732
|
-
def
|
806
|
+
def set_le(self: _isl.BasicSet | _isl.Set, other: _isl.BasicSet | _isl.Set) -> bool:
|
733
807
|
return self.is_subset(other)
|
734
808
|
|
735
809
|
|
736
|
-
def
|
810
|
+
def set_gt(self: _isl.BasicSet | _isl.Set, other: _isl.BasicSet | _isl.Set) -> bool:
|
737
811
|
return other.is_strict_subset(self)
|
738
812
|
|
739
813
|
|
740
|
-
def
|
814
|
+
def set_ge(self: _isl.BasicSet | _isl.Set, other: _isl.BasicSet | _isl.Set) -> bool:
|
815
|
+
return other.is_subset(self)
|
816
|
+
|
817
|
+
|
818
|
+
def map_lt(self: _isl.BasicMap | _isl.Map, other: _isl.BasicMap | _isl.Map) -> bool:
|
819
|
+
return self.is_strict_subset(other)
|
820
|
+
|
821
|
+
|
822
|
+
def map_le(self: _isl.BasicMap | _isl.Map, other: _isl.BasicMap | _isl.Map) -> bool:
|
823
|
+
return self.is_subset(other)
|
824
|
+
|
825
|
+
|
826
|
+
def map_gt(self: _isl.BasicMap | _isl.Map, other: _isl.BasicMap | _isl.Map) -> bool:
|
827
|
+
return other.is_strict_subset(self)
|
828
|
+
|
829
|
+
|
830
|
+
def map_ge(self: _isl.BasicMap | _isl.Map, other: _isl.BasicMap | _isl.Map) -> bool:
|
741
831
|
return other.is_subset(self)
|
742
832
|
|
743
833
|
|
744
834
|
# {{{ project_out_except
|
745
835
|
|
746
836
|
def obj_project_out_except(
|
747
|
-
obj:
|
837
|
+
obj: SetOrMapT,
|
748
838
|
names: Collection[str],
|
749
839
|
types: Collection[_isl.dim_type]
|
750
|
-
) ->
|
840
|
+
) -> SetOrMapT:
|
751
841
|
"""
|
752
842
|
:param types: list of :class:`dim_type` determining
|
753
843
|
the types of axes to project out
|
@@ -784,10 +874,10 @@ def obj_project_out_except(
|
|
784
874
|
# {{{ eliminate_except
|
785
875
|
|
786
876
|
def obj_eliminate_except(
|
787
|
-
obj:
|
877
|
+
obj: SetOrMapT,
|
788
878
|
names: Collection[str],
|
789
879
|
types: Collection[_isl.dim_type]
|
790
|
-
) ->
|
880
|
+
) -> SetOrMapT:
|
791
881
|
"""
|
792
882
|
:param types: list of :class:`dim_type` determining
|
793
883
|
the types of axes to eliminate
|
@@ -869,12 +959,23 @@ def _add_functionality() -> None:
|
|
869
959
|
|
870
960
|
# {{{ Python set-like behavior
|
871
961
|
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
cls.
|
962
|
+
_isl.BasicSet.__and__ = bset_and
|
963
|
+
_isl.BasicSet.__rand__ = bset_and
|
964
|
+
_isl.Set.__and__ = set_and
|
965
|
+
_isl.Set.__rand__ = set_and
|
966
|
+
for cls in [_isl.BasicSet, _isl.Set]:
|
967
|
+
cls.__or__ = set_or
|
968
|
+
cls.__ror__ = set_or
|
969
|
+
cls.__sub__ = set_sub
|
970
|
+
|
971
|
+
_isl.BasicMap.__and__ = bmap_and
|
972
|
+
_isl.BasicMap.__rand__ = bmap_and
|
973
|
+
_isl.Map.__and__ = map_and
|
974
|
+
_isl.Map.__rand__ = map_and
|
975
|
+
for cls in [_isl.BasicMap, _isl.Map]:
|
976
|
+
cls.__or__ = map_or
|
977
|
+
cls.__ror__ = map_or
|
978
|
+
cls.__sub__ = map_sub
|
878
979
|
|
879
980
|
# }}}
|
880
981
|
|
@@ -1003,11 +1104,17 @@ for cls in ALL_CLASSES:
|
|
1003
1104
|
|
1004
1105
|
# {{{ rich comparisons
|
1005
1106
|
|
1006
|
-
for cls in [_isl.BasicSet, _isl.
|
1007
|
-
cls.__lt__ =
|
1008
|
-
cls.__le__ =
|
1009
|
-
cls.__gt__ =
|
1010
|
-
cls.__ge__ =
|
1107
|
+
for cls in [_isl.BasicSet, _isl.Set]:
|
1108
|
+
cls.__lt__ = set_lt
|
1109
|
+
cls.__le__ = set_le
|
1110
|
+
cls.__gt__ = set_gt
|
1111
|
+
cls.__ge__ = set_ge
|
1112
|
+
|
1113
|
+
for cls in [_isl.BasicMap, _isl.Map]:
|
1114
|
+
cls.__lt__ = map_lt
|
1115
|
+
cls.__le__ = map_le
|
1116
|
+
cls.__gt__ = map_gt
|
1117
|
+
cls.__ge__ = map_ge
|
1011
1118
|
|
1012
1119
|
# }}}
|
1013
1120
|
|
@@ -1022,10 +1129,6 @@ for cls in ALL_CLASSES:
|
|
1022
1129
|
_add_functionality()
|
1023
1130
|
|
1024
1131
|
|
1025
|
-
P = ParamSpec("P")
|
1026
|
-
ResultT = TypeVar("ResultT")
|
1027
|
-
|
1028
|
-
|
1029
1132
|
_DOWNCAST_RE = re.compile(
|
1030
1133
|
r"Downcast from :class:`([A-Za-z]+)` to :class:`([A-Za-z]+)`.")
|
1031
1134
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
islpy/version.py,sha256=9KVEg7OX9uCaA6ElUMeiAh-zDrxsy3u2H6VQm_-LTUE,301
|
2
|
+
islpy/_isl.cpython-313-darwin.so,sha256=QhUZVDAMG6d-lfiVJt9fk00yG84tGmf2akrNbgTHu9U,7927080
|
3
|
+
islpy/__init__.py,sha256=0AdPhWQMf1DUB5DDisLP39rN0djxueftEWqfX4_R5Hk,13363
|
4
|
+
islpy/_isl.pyi,sha256=OI3MI4rqq4XZ3CTXTbmS__lClCMynkL9MxERZ-KgWLk,260125
|
5
|
+
islpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
islpy/_monkeypatch.py,sha256=80xulld5N-jIJbWLGBYSuPnO1CG1N-Z3jVgiNRkkJ9U,34216
|
7
|
+
islpy-2025.2.4.dist-info/RECORD,,
|
8
|
+
islpy-2025.2.4.dist-info/WHEEL,sha256=LDEcERf6NwqnVU7GVh2ePzziJ1dorOEI8grnlWj9zQ0,141
|
9
|
+
islpy-2025.2.4.dist-info/METADATA,sha256=bCRATmwgpiAGBbVa21X7Cqg9fPZNkdFDnuXO4_80yn8,2966
|
islpy-2025.2.1.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
islpy-2025.2.1.dist-info/RECORD,,
|
2
|
-
islpy-2025.2.1.dist-info/WHEEL,sha256=LDEcERf6NwqnVU7GVh2ePzziJ1dorOEI8grnlWj9zQ0,141
|
3
|
-
islpy-2025.2.1.dist-info/METADATA,sha256=rKg9uyDgpaAp2mbvRv2YzFS9seQzhA1jjw75gcTmQvg,2966
|
4
|
-
islpy/version.py,sha256=9KVEg7OX9uCaA6ElUMeiAh-zDrxsy3u2H6VQm_-LTUE,301
|
5
|
-
islpy/_isl.cpython-313-darwin.so,sha256=3-IElDfITHXIV4NEFhJl2hkRfpvmsopd7CPqCpT4V7E,7927080
|
6
|
-
islpy/__init__.py,sha256=6In7YFiBLKNNVIGkpKMiB1H_-H2OQ5ovlqJ_Tz0nAvA,13073
|
7
|
-
islpy/_isl.pyi,sha256=dAYJ9hZ0HrpMnUHdruE6cOvKU_Px2kZ7qr6YFDZ-Z-0,260082
|
8
|
-
islpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
islpy/_monkeypatch.py,sha256=NrSQHBRxIVzSuYa2qR_oSnxRoJxVbu-l_Sv1AZcvE0Q,31242
|
File without changes
|