Skip to content

Commit 6ea86fa

Browse files
committed
Add Set.var_affs
1 parent 8958c45 commit 6ea86fa

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

namedisl/set_like.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ class Set(_NamedIslSetLike[isl.Set], _NamedIslUnbasic[isl.Set]):
443443
.. automethod:: get_basic_sets
444444
.. automethod:: dim_max
445445
.. automethod:: dim_min
446+
.. autoattribute:: var_affs
446447
.. autoattribute:: var_pw_affs
447448
.. automethod:: as_map
448449
.. automethod:: as_basic
@@ -479,6 +480,21 @@ def dim_min(self, name: str, *, cache: Cache | None = None) -> PwAff:
479480
return PwAff(with_cache(cache, isl.Set.dim_min, self._obj, idx),
480481
self.space.drop_dim_type(DimType.out).with_empty_dim_type(DimType.in_))
481482

483+
@cached_property
484+
def var_affs(self) -> Mapping[str | Literal[0], Aff]:
485+
r"""
486+
Returns a lazily-evaluated mapping from dimension names (or zero)
487+
to :class:`Aff`\ s.
488+
489+
.. note::
490+
491+
Lazy evaluation means you do not pay for the creation of unused dimensions.
492+
"""
493+
from .expression_like import _AffMapping
494+
return _AffMapping(
495+
self.space.as_expr_space(),
496+
isl.Aff.zero_on_domain(self._obj.space))
497+
482498
@cached_property
483499
def var_pw_affs(self) -> Mapping[str | Literal[0], PwAff]:
484500
r"""

0 commit comments

Comments
 (0)