@parameterized.named_parameters(({'testcase_name': '_{}'.format(scan_name), 'scan': scan_impl} for (scan_impl, scan_name) in SCAN_IMPLS))
def test_scan_reverse(self, scan):

    def cumsum(x, reverse):
        return scan((lambda c, x: ((c + x), (c + x))), 0, x, reverse=reverse)[1]
    x = np.array([3, 1, 4, 1, 5, 9])
    self.assertAllClose(np.cumsum(x), cumsum(x, False), check_dtypes=False)
    self.assertAllClose(np.cumsum(x[::(- 1)])[::(- 1)], cumsum(x, True), check_dtypes=False)
    with api.disable_jit():
        self.assertAllClose(np.cumsum(x), cumsum(x, False), check_dtypes=False)
    with api.disable_jit():
        self.assertAllClose(np.cumsum(x[::(- 1)])[::(- 1)], cumsum(x, True), check_dtypes=False)
@parameterized.named_parameters(({'testcase_name': '_{}'.format(scan_name), 'scan': scan_impl} for (scan_impl, scan_name) in SCAN_IMPLS))
def test_scan_reverse(self, scan):

    def cumsum(x, reverse):
        return scan((lambda c, x: ((c + x), (c + x))), 0, x, reverse=reverse)[1]
    x = np.array([3, 1, 4, 1, 5, 9])
    self.assertAllClose(np.cumsum(x), cumsum(x, False), check_dtypes=False)
    self.assertAllClose(np.cumsum(x[::(- 1)])[::(- 1)], cumsum(x, True), check_dtypes=False)
    with api.disable_jit():
        self.assertAllClose(np.cumsum(x), cumsum(x, False), check_dtypes=False)
    with api.disable_jit():
        self.assertAllClose(np.cumsum(x[::(- 1)])[::(- 1)], cumsum(x, True), check_dtypes=False)