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

Source Code:
def _test_forward_nd_quad_pot(n, ndim, abs=None):
    x = np.arange(n) - n / 2.0
    xs = np.meshgrid(*([x]*ndim), indexing="ij")
    xs_sq = reduce(lambda x,y:x+y*y, xs, 0.0)

    # phi is quadratic on all dimension, so the target will be scaled
    # source on all dimension by (1+B)
    B = 1.0
    scale = 1 + B
    sigma = (n/30.)
    source = np.exp(-xs_sq / (2*sigma**2))
    source_copy = np.copy(source)
    phi = 0.5*B*xs_sq
    target = sb.forward(source, phi)

    target_calc = (scale**-ndim)*np.exp(-xs_sq / (2*(sigma*scale)**2))

    # accurate within 2.5*(1/n)*100%
    abs = 2.5/n if abs is None else abs
    assert target == pytest.approx(target_calc, abs=abs)

    # check the dimension of target
    assert np.ndim(target) == ndim

    # make sure the source is not changed
    assert np.all(source == source_copy)

_test_forward_nd_quad_pot(n=100, ndim=1, abs=None)

Selected Statement: B = 1.0

Function Input:
n: 100
ndim: 1
abs: None

Variable Values Before Statement:
Constant: 1.0

Value After Statement Execution: 1.0

Variable States During Runtime (line, value):
n: 1
100
ndim: 1
1
abs: 1
None
19
0.025
x: 2
array([-50., -49., -48., -47., -46., -45., -44., -43., -42., -41., -40.,       -39., -38., -37., -36., -35., -34., -33., -32., -31., -30., -29.,       -28., -27., -26., -25., -24., -23., -22., -21., -20., -19., -18.,       -17., -16., -15., -14., -13., -12., -11., -10.,  -9.,  -8.,  -7.,        -6.,  -5.,  -4.,  -3.,  -2.,  -1.,   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.])
xs: 3
[array([-50., -49., -48., -47., -46., -45., -44., -43., -42., -41., -40.,       -39., -38., -37., -36., -35., -34., -33., -32., -31., -30., -29.,       -28., -27., -26., -25., -24., -23., -22., -21., -20., -19., -18.,       -17., -16., -15., -14., -13., -12., -11., -10.,  -9.,  -8.,  -7.,        -6.,  -5.,  -4.,  -3.,  -2.,  -1.,   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.])]
xs_sq: 4
array([2.500e+03, 2.401e+03, 2.304e+03, 2.209e+03, 2.116e+03, 2.025e+03,       1.936e+03, 1.849e+03, 1.764e+03, 1.681e+03, 1.600e+03, 1.521e+03,       1.444e+03, 1.369e+03, 1.296e+03, 1.225e+03, 1.156e+03, 1.089e+03,       1.024e+03, 9.610e+02, 9.000e+02, 8.410e+02, 7.840e+02, 7.290e+02,       6.760e+02, 6.250e+02, 5.760e+02, 5.290e+02, 4.840e+02, 4.410e+02,       4.000e+02, 3.610e+02, 3.240e+02, 2.890e+02, 2.560e+02, 2.250e+02,       1.960e+02, 1.690e+02, 1.440e+02, 1.210e+02, 1.000e+02, 8.100e+01,       6.400e+01, 4.900e+01, 3.600e+01, 2.500e+01, 1.600e+01, 9.000e+00,       4.000e+00, 1.000e+00, 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])
B: 8
1.0
scale: 9
2.0
sigma: 10
3.3333333333333335
source: 11
array([1.38634329e-49, 1.19303368e-47, 9.38313827e-46, 6.74461286e-44,       4.43077231e-42, 2.66020642e-40, 1.45970379e-38, 7.32027899e-37,       3.35508886e-35, 1.40538048e-33, 5.38018616e-32, 1.88240985e-30,       6.01928028e-29, 1.75909155e-27, 4.69835486e-26, 1.14687658e-24,       2.55859208e-23, 5.21673666e-22, 9.72098502e-21, 1.65552266e-19,       2.57675711e-18, 3.66543340e-17, 4.76530474e-16, 5.66199552e-15,       6.14839641e-14, 6.10193668e-13, 5.53461007e-12, 4.58796249e-11,       3.47589128e-10, 2.40672244e-09, 1.52299797e-08, 8.80817920e-08,       4.65571572e-07, 2.24905597e-06, 9.92950431e-06, 4.00652974e-05,       1.47748360e-04, 4.97955422e-04, 1.53381068e-03, 4.31784001e-03,       1.11089965e-02, 2.61214099e-02, 5.61347628e-02, 1.10250525e-01,       1.97898699e-01, 3.24652467e-01, 4.86752256e-01, 6.66976811e-01,       8.35270211e-01, 9.55997482e-01, 1.00000000e+00, 9.55997482e-01,       8.35270211e-01, 6.66976811e-01, 4.86752256e-01, 3.24652467e-01,       1.97898699e-01, 1.10250525e-01, 5.61347628e-02, 2.61214099e-02,       1.11089965e-02, 4.31784001e-03, 1.53381068e-03, 4.97955422e-04,       1.47748360e-04, 4.00652974e-05, 9.92950431e-06, 2.24905597e-06,       4.65571572e-07, 8.80817920e-08, 1.52299797e-08, 2.40672244e-09,       3.47589128e-10, 4.58796249e-11, 5.53461007e-12, 6.10193668e-13,       6.14839641e-14, 5.66199552e-15, 4.76530474e-16, 3.66543340e-17,       2.57675711e-18, 1.65552266e-19, 9.72098502e-21, 5.21673666e-22,       2.55859208e-23, 1.14687658e-24, 4.69835486e-26, 1.75909155e-27,       6.01928028e-29, 1.88240985e-30, 5.38018616e-32, 1.40538048e-33,       3.35508886e-35, 7.32027899e-37, 1.45970379e-38, 2.66020642e-40,       4.43077231e-42, 6.74461286e-44, 9.38313827e-46, 1.19303368e-47])
source_copy: 12
array([1.38634329e-49, 1.19303368e-47, 9.38313827e-46, 6.74461286e-44,       4.43077231e-42, 2.66020642e-40, 1.45970379e-38, 7.32027899e-37,       3.35508886e-35, 1.40538048e-33, 5.38018616e-32, 1.88240985e-30,       6.01928028e-29, 1.75909155e-27, 4.69835486e-26, 1.14687658e-24,       2.55859208e-23, 5.21673666e-22, 9.72098502e-21, 1.65552266e-19,       2.57675711e-18, 3.66543340e-17, 4.76530474e-16, 5.66199552e-15,       6.14839641e-14, 6.10193668e-13, 5.53461007e-12, 4.58796249e-11,       3.47589128e-10, 2.40672244e-09, 1.52299797e-08, 8.80817920e-08,       4.65571572e-07, 2.24905597e-06, 9.92950431e-06, 4.00652974e-05,       1.47748360e-04, 4.97955422e-04, 1.53381068e-03, 4.31784001e-03,       1.11089965e-02, 2.61214099e-02, 5.61347628e-02, 1.10250525e-01,       1.97898699e-01, 3.24652467e-01, 4.86752256e-01, 6.66976811e-01,       8.35270211e-01, 9.55997482e-01, 1.00000000e+00, 9.55997482e-01,       8.35270211e-01, 6.66976811e-01, 4.86752256e-01, 3.24652467e-01,       1.97898699e-01, 1.10250525e-01, 5.61347628e-02, 2.61214099e-02,       1.11089965e-02, 4.31784001e-03, 1.53381068e-03, 4.97955422e-04,       1.47748360e-04, 4.00652974e-05, 9.92950431e-06, 2.24905597e-06,       4.65571572e-07, 8.80817920e-08, 1.52299797e-08, 2.40672244e-09,       3.47589128e-10, 4.58796249e-11, 5.53461007e-12, 6.10193668e-13,       6.14839641e-14, 5.66199552e-15, 4.76530474e-16, 3.66543340e-17,       2.57675711e-18, 1.65552266e-19, 9.72098502e-21, 5.21673666e-22,       2.55859208e-23, 1.14687658e-24, 4.69835486e-26, 1.75909155e-27,       6.01928028e-29, 1.88240985e-30, 5.38018616e-32, 1.40538048e-33,       3.35508886e-35, 7.32027899e-37, 1.45970379e-38, 2.66020642e-40,       4.43077231e-42, 6.74461286e-44, 9.38313827e-46, 1.19303368e-47])
phi: 13
array([1.2500e+03, 1.2005e+03, 1.1520e+03, 1.1045e+03, 1.0580e+03,       1.0125e+03, 9.6800e+02, 9.2450e+02, 8.8200e+02, 8.4050e+02,       8.0000e+02, 7.6050e+02, 7.2200e+02, 6.8450e+02, 6.4800e+02,       6.1250e+02, 5.7800e+02, 5.4450e+02, 5.1200e+02, 4.8050e+02,       4.5000e+02, 4.2050e+02, 3.9200e+02, 3.6450e+02, 3.3800e+02,       3.1250e+02, 2.8800e+02, 2.6450e+02, 2.4200e+02, 2.2050e+02,       2.0000e+02, 1.8050e+02, 1.6200e+02, 1.4450e+02, 1.2800e+02,       1.1250e+02, 9.8000e+01, 8.4500e+01, 7.2000e+01, 6.0500e+01,       5.0000e+01, 4.0500e+01, 3.2000e+01, 2.4500e+01, 1.8000e+01,       1.2500e+01, 8.0000e+00, 4.5000e+00, 2.0000e+00, 5.0000e-01,       0.0000e+00, 5.0000e-01, 2.0000e+00, 4.5000e+00, 8.0000e+00,       1.2500e+01, 1.8000e+01, 2.4500e+01, 3.2000e+01, 4.0500e+01,       5.0000e+01, 6.0500e+01, 7.2000e+01, 8.4500e+01, 9.8000e+01,       1.1250e+02, 1.2800e+02, 1.4450e+02, 1.6200e+02, 1.8050e+02,       2.0000e+02, 2.2050e+02, 2.4200e+02, 2.6450e+02, 2.8800e+02,       3.1250e+02, 3.3800e+02, 3.6450e+02, 3.9200e+02, 4.2050e+02,       4.5000e+02, 4.8050e+02, 5.1200e+02, 5.4450e+02, 5.7800e+02,       6.1250e+02, 6.4800e+02, 6.8450e+02, 7.2200e+02, 7.6050e+02,       8.0000e+02, 8.4050e+02, 8.8200e+02, 9.2450e+02, 9.6800e+02,       1.0125e+03, 1.0580e+03, 1.1045e+03, 1.1520e+03, 1.2005e+03])
target: 14
array([3.05096834e-13, 1.53620093e-12, 2.76730504e-12, 1.28535587e-11,       2.29398124e-11, 9.83671882e-11, 1.73794564e-10, 6.88577891e-10,       1.20336122e-09, 4.40917555e-09, 7.61498987e-09, 2.58279429e-08,       4.40408960e-08, 1.38413341e-07, 2.32785786e-07, 6.78656885e-07,       1.12452798e-06, 3.04464007e-06, 4.96475215e-06, 1.24987004e-05,       2.00326487e-05, 4.69534144e-05, 7.38741801e-05, 1.61425945e-04,       2.48977711e-04, 5.07941525e-04, 7.66905340e-04, 1.46291267e-03,       2.15892000e-03, 3.85670914e-03, 5.55449827e-03, 9.30760160e-03,       1.30607049e-02, 2.05640432e-02, 2.80673814e-02, 4.15963220e-02,       5.51252627e-02, 7.70373061e-02, 9.89493495e-02, 1.30637792e-01,       1.62326234e-01, 2.02851181e-01, 2.43376128e-01, 2.88432267e-01,       3.33488405e-01, 3.75561756e-01, 4.17635106e-01, 4.47816923e-01,       4.77998741e-01, 4.88999370e-01, 5.00000000e-01, 4.88999370e-01,       4.77998741e-01, 4.47816923e-01, 4.17635106e-01, 3.75561756e-01,       3.33488405e-01, 2.88432267e-01, 2.43376128e-01, 2.02851181e-01,       1.62326234e-01, 1.30637792e-01, 9.89493495e-02, 7.70373061e-02,       5.51252627e-02, 4.15963220e-02, 2.80673814e-02, 2.05640432e-02,       1.30607049e-02, 9.30760160e-03, 5.55449827e-03, 3.85670914e-03,       2.15892000e-03, 1.46291267e-03, 7.66905340e-04, 5.07941525e-04,       2.48977711e-04, 1.61425945e-04, 7.38741801e-05, 4.69534144e-05,       2.00326487e-05, 1.24987004e-05, 4.96475215e-06, 3.04464007e-06,       1.12452798e-06, 6.78656885e-07, 2.32785786e-07, 1.38413341e-07,       4.40408960e-08, 2.58279429e-08, 7.61498987e-09, 4.40917555e-09,       1.20336122e-09, 6.88577891e-10, 1.73794564e-10, 9.83671882e-11,       2.29398124e-11, 1.28535587e-11, 2.76730504e-12, 1.53620093e-12])
target_calc: 16
array([3.05096834e-13, 9.29251306e-13, 2.76730504e-12, 8.05766599e-12,       2.29398124e-11, 6.38555777e-11, 1.73794564e-10, 4.62489538e-10,       1.20336122e-09, 3.06138876e-09, 7.61498987e-09, 1.85203228e-08,       4.40408960e-08, 1.02398151e-07, 2.32785786e-07, 5.17427106e-07,       1.12452798e-06, 2.38956987e-06, 4.96475215e-06, 1.00856475e-05,       2.00326487e-05, 3.89046343e-05, 7.38741801e-05, 1.37155234e-04,       2.48977711e-04, 4.41913153e-04, 7.66905340e-04, 1.30129263e-03,       2.15892000e-03, 3.50208357e-03, 5.55449827e-03, 8.61373566e-03,       1.30607049e-02, 1.93628852e-02, 2.80673814e-02, 3.97797544e-02,       5.51252627e-02, 7.46908876e-02, 9.89493495e-02, 1.28170076e-01,       1.62326234e-01, 2.01010692e-01, 2.43376128e-01, 2.88114537e-01,       3.33488405e-01, 3.77419801e-01, 4.17635106e-01, 4.51853539e-01,       4.77998741e-01, 4.94406522e-01, 5.00000000e-01, 4.94406522e-01,       4.77998741e-01, 4.51853539e-01, 4.17635106e-01, 3.77419801e-01,       3.33488405e-01, 2.88114537e-01, 2.43376128e-01, 2.01010692e-01,       1.62326234e-01, 1.28170076e-01, 9.89493495e-02, 7.46908876e-02,       5.51252627e-02, 3.97797544e-02, 2.80673814e-02, 1.93628852e-02,       1.30607049e-02, 8.61373566e-03, 5.55449827e-03, 3.50208357e-03,       2.15892000e-03, 1.30129263e-03, 7.66905340e-04, 4.41913153e-04,       2.48977711e-04, 1.37155234e-04, 7.38741801e-05, 3.89046343e-05,       2.00326487e-05, 1.00856475e-05, 4.96475215e-06, 2.38956987e-06,       1.12452798e-06, 5.17427106e-07, 2.32785786e-07, 1.02398151e-07,       4.40408960e-08, 1.85203228e-08, 7.61498987e-09, 3.06138876e-09,       1.20336122e-09, 4.62489538e-10, 1.73794564e-10, 6.38555777e-11,       2.29398124e-11, 8.05766599e-12, 2.76730504e-12, 9.29251306e-13])
@py_assert3: 20
None
@py_assert7: 20
None
@py_assert1: 20
None
@py_assert4: 23
None
@py_assert6: 23
None
@py_assert8: 26
None