Project Name: OxfordHED+sunbear
Language: Python
Statement Type: Arithmetic Assignment

Source Code:
def _test_grad_nd(n, ndim):
    coords = [np.arange(n)] * ndim
    xc = np.meshgrid(*coords, indexing="ij")

    # u = sum_i(xc[i]**2)
    u = reduce(lambda x,y: x+y**2, xc, 0.0)
    ucopy = np.copy(u)

    # check the gradient values
    slices = tuple([slice(1,-1,None)] * ndim)
    for i in range(ndim):
        assert grad(u, axis=i) == pytest.approx(2*xc[i][slices])

    # check if u is unchanged
    assert np.all(u == ucopy)

_test_grad_nd(n=92, ndim=1)

Selected Statement: coords = [np.arange(n)] * ndim

Function Input:
n: 92
ndim: 1

Variable Values Before Statement:
ndim: 1

Value After Statement Execution: [array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,       34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,       51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,       68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,       85, 86, 87, 88, 89, 90, 91])]

Variable States During Runtime (line, value):
n: 1
92
ndim: 1
1
coords: 2
[array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,       34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,       51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,       68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,       85, 86, 87, 88, 89, 90, 91])]
xc: 3
[array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,       34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,       51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,       68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,       85, 86, 87, 88, 89, 90, 91])]
u: 6
array([0.000e+00, 1.000e+00, 4.000e+00, 9.000e+00, 1.600e+01, 2.500e+01,       3.600e+01, 4.900e+01, 6.400e+01, 8.100e+01, 1.000e+02, 1.210e+02,       1.440e+02, 1.690e+02, 1.960e+02, 2.250e+02, 2.560e+02, 2.890e+02,       3.240e+02, 3.610e+02, 4.000e+02, 4.410e+02, 4.840e+02, 5.290e+02,       5.760e+02, 6.250e+02, 6.760e+02, 7.290e+02, 7.840e+02, 8.410e+02,       9.000e+02, 9.610e+02, 1.024e+03, 1.089e+03, 1.156e+03, 1.225e+03,       1.296e+03, 1.369e+03, 1.444e+03, 1.521e+03, 1.600e+03, 1.681e+03,       1.764e+03, 1.849e+03, 1.936e+03, 2.025e+03, 2.116e+03, 2.209e+03,       2.304e+03, 2.401e+03, 2.500e+03, 2.601e+03, 2.704e+03, 2.809e+03,       2.916e+03, 3.025e+03, 3.136e+03, 3.249e+03, 3.364e+03, 3.481e+03,       3.600e+03, 3.721e+03, 3.844e+03, 3.969e+03, 4.096e+03, 4.225e+03,       4.356e+03, 4.489e+03, 4.624e+03, 4.761e+03, 4.900e+03, 5.041e+03,       5.184e+03, 5.329e+03, 5.476e+03, 5.625e+03, 5.776e+03, 5.929e+03,       6.084e+03, 6.241e+03, 6.400e+03, 6.561e+03, 6.724e+03, 6.889e+03,       7.056e+03, 7.225e+03, 7.396e+03, 7.569e+03, 7.744e+03, 7.921e+03,       8.100e+03, 8.281e+03])
ucopy: 7
array([0.000e+00, 1.000e+00, 4.000e+00, 9.000e+00, 1.600e+01, 2.500e+01,       3.600e+01, 4.900e+01, 6.400e+01, 8.100e+01, 1.000e+02, 1.210e+02,       1.440e+02, 1.690e+02, 1.960e+02, 2.250e+02, 2.560e+02, 2.890e+02,       3.240e+02, 3.610e+02, 4.000e+02, 4.410e+02, 4.840e+02, 5.290e+02,       5.760e+02, 6.250e+02, 6.760e+02, 7.290e+02, 7.840e+02, 8.410e+02,       9.000e+02, 9.610e+02, 1.024e+03, 1.089e+03, 1.156e+03, 1.225e+03,       1.296e+03, 1.369e+03, 1.444e+03, 1.521e+03, 1.600e+03, 1.681e+03,       1.764e+03, 1.849e+03, 1.936e+03, 2.025e+03, 2.116e+03, 2.209e+03,       2.304e+03, 2.401e+03, 2.500e+03, 2.601e+03, 2.704e+03, 2.809e+03,       2.916e+03, 3.025e+03, 3.136e+03, 3.249e+03, 3.364e+03, 3.481e+03,       3.600e+03, 3.721e+03, 3.844e+03, 3.969e+03, 4.096e+03, 4.225e+03,       4.356e+03, 4.489e+03, 4.624e+03, 4.761e+03, 4.900e+03, 5.041e+03,       5.184e+03, 5.329e+03, 5.476e+03, 5.625e+03, 5.776e+03, 5.929e+03,       6.084e+03, 6.241e+03, 6.400e+03, 6.561e+03, 6.724e+03, 6.889e+03,       7.056e+03, 7.225e+03, 7.396e+03, 7.569e+03, 7.744e+03, 7.921e+03,       8.100e+03, 8.281e+03])
slices: 10
(slice(1, -1, None),)
i: 11
0
@py_assert3: 12
None
@py_assert7: 12
None
@py_assert9: 12
None
@py_assert11: 12
None
@py_assert13: 12
None
@py_assert14: 12
None
@py_assert5: 12
None
@py_assert1: 15
None
@py_assert4: 15
None
@py_assert8: 15
None