Define a valid interval, so that : ``domain_check_interval(a,b)(x) == True`` where ``x < a`` or ``x > b``.
| 795 | |
| 796 | |
| 797 | class _DomainCheckInterval: |
| 798 | """ |
| 799 | Define a valid interval, so that : |
| 800 | |
| 801 | ``domain_check_interval(a,b)(x) == True`` where |
| 802 | ``x < a`` or ``x > b``. |
| 803 | |
| 804 | """ |
| 805 | |
| 806 | def __init__(self, a, b): |
| 807 | "domain_check_interval(a,b)(x) = true where x < a or y > b" |
| 808 | if a > b: |
| 809 | (a, b) = (b, a) |
| 810 | self.a = a |
| 811 | self.b = b |
| 812 | |
| 813 | def __call__(self, x): |
| 814 | "Execute the call behavior." |
| 815 | # nans at masked positions cause RuntimeWarnings, even though |
| 816 | # they are masked. To avoid this we suppress warnings. |
| 817 | with np.errstate(invalid='ignore'): |
| 818 | return umath.logical_or(umath.greater(x, self.b), |
| 819 | umath.less(x, self.a)) |
| 820 | |
| 821 | |
| 822 | class _DomainTan: |