def test_infinite_limits(self): # Test that large arguments converge to the hard-coded limits # at infinity. assert sc.gammaincc(1000, 100) == sc.gammaincc(cp.inf, 100) assert_allclose( sc.gammaincc(100, 1000), sc.gammaincc(100, cp.inf), atol=1e-200, # Use `atol` since the function converges to 0. rtol=0, )
def test_roundtrip(self): a = cp.logspace(-5, 10, 100) x = cp.logspace(-5, 10, 100) y = sc.gammainccinv(a, sc.gammaincc(a, x)) assert_allclose(x, y, rtol=1e-14)
def test_a_eq_0_x_gt_0(self): assert sc.gammaincc(0, 1) == 0
def test_domain(self, a, x): assert cp.isnan(sc.gammaincc(a, x))
def test_x_zero(self): a = cp.arange(1, 10) assert_array_equal(sc.gammaincc(a, 0), 1)
def test_limit_check(self): result = sc.gammaincc(1e-10, 1) limit = sc.gammaincc(0, 1) assert cp.isclose(result, limit)
def test_infinite_arguments(self, a, x, desired): result = sc.gammaincc(a, x) if cp.isnan(desired): assert cp.isnan(result) else: assert result == desired