arith.py 1.06 KB
Newer Older
1 2
"""Arithmetic data structure and utility"""
from __future__ import absolute_import as _abs
3

4 5
from ._ffi.node import NodeBase, register_node
from ._ffi.function import _init_api
6 7 8 9 10 11 12 13 14 15 16 17
from . import _api_internal

class IntSet(NodeBase):
    """Represent a set of integer in one dimension."""
    def is_nothing(self):
        """Whether the set represent nothing"""
        return _api_internal._IntSetIsNothing(self)

    def is_everything(self):
        """Whether the set represent everything"""
        return _api_internal._IntSetIsEverything(self)

18

19 20 21 22 23 24 25 26 27 28 29
@register_node
class IntervalSet(IntSet):
    """Represent set of continuous interval"""
    def min(self):
        """get the minimum value"""
        return _api_internal._IntervalSetGetMin(self)

    def max(self):
        """get the maximum value"""
        return _api_internal._IntervalSetGetMax(self)

30

31 32 33 34
@register_node
class StrideSet(IntSet):
    """Represent set of strided integers"""
    pass
35 36 37 38 39

@register_node
class ModularSet(IntSet):
    """Represent range of (coeff * x + base) for x in Z """
    pass
40 41

_init_api("tvm.arith")