Example #1
0
    def test_amax(self):
        # tests taken from numpy/core/fromnumeric.py docstring
        from numpypy import array, arange, amax, zeros
        a = arange(4).reshape((2,2))
        assert amax(a) == 3
        # assert (amax(a, axis=0) == array([2, 3])).all()
        # assert (amax(a, axis=1) == array([1, 3])).all()
        # # NaN behaviour
        # b = arange(5, dtype=float)
        # b[2] = NaN
        # assert amax(b) == nan
        # assert nanmax(b) == 4.0

        assert amax(range(10)) == 9
        assert amax(array(range(10))) == 9
        assert list(amax(zeros((0, 2)), axis=1)) == []

        a = array([[1, 2], [3, 4]])
        out = array([[0, 0], [0, 0]])
        c = amax(a, axis=1, out=out[0])
        assert (c == [2, 4]).all()
        assert (c == out[0]).all()
        assert (c != out[1]).all()
Example #2
0
    def test_amax(self):
        # tests taken from numpy/core/fromnumeric.py docstring
        from numpypy import array, arange, amax, zeros
        a = arange(4).reshape((2,2))
        assert amax(a) == 3
        # assert (amax(a, axis=0) == array([2, 3])).all()
        # assert (amax(a, axis=1) == array([1, 3])).all()
        # # NaN behaviour
        # b = arange(5, dtype=float)
        # b[2] = NaN
        # assert amax(b) == nan
        # assert nanmax(b) == 4.0

        assert amax(range(10)) == 9
        assert amax(array(range(10))) == 9
        assert list(amax(zeros((0, 2)), axis=1)) == []

        a = array([[1, 2], [3, 4]])
        out = array([[0, 0], [0, 0]])
        c = amax(a, axis=1, out=out[0])
        assert (c == [2, 4]).all()
        assert (c == out[0]).all()
        assert (c != out[1]).all()
Example #3
0
 def test_amax(self):
     # tests taken from numpy/core/fromnumeric.py docstring
     from numpypy import array, arange, amax
     a = arange(4).reshape((2,2))
     assert amax(a) == 3
Example #4
0
 def test_amax(self):
     # tests taken from numpy/core/fromnumeric.py docstring
     from numpypy import array, arange, amax
     a = arange(4).reshape((2,2))
     assert amax(a) == 3