def test_mean(self): from _numpypy import array, mean a = array(range(5)) assert a.mean() == 2.0 assert a[:4].mean() == 1.5 a = array(range(105)).reshape(3, 5, 7) b = mean(a, axis=0) b[0,0]==35. assert a.mean(axis=0)[0, 0] == 35 assert (b == array(range(35, 70), dtype=float).reshape(5, 7)).all() assert (mean(a, 2) == array(range(0, 15), dtype=float).reshape(3, 5) * 7 + 3).all()
def test_mean(self): from _numpypy import array, mean a = array(range(5)) assert a.mean() == 2.0 assert a[:4].mean() == 1.5 a = array(range(105)).reshape(3, 5, 7) b = mean(a, axis=0) b[0, 0] == 35. assert a.mean(axis=0)[0, 0] == 35 assert (b == array(range(35, 70), dtype=float).reshape(5, 7)).all() assert (mean(a, 2) == array(range(0, 15), dtype=float).reshape(3, 5) * 7 + 3).all()
def test_mean(self): from _numpypy import array, mean assert mean(array(range(5))) == 2.0 assert mean(range(5)) == 2.0