Beispiel #1
0
    def test_amin(self):
        # tests taken from numpy/core/fromnumeric.py docstring
        from numpypy import array, arange, amin, zeros
        a = arange(4).reshape((2,2))
        assert amin(a) == 0
        # # Minima along the first axis
        # assert (amin(a, axis=0) == array([0, 1])).all()
        # # Minima along the second axis
        # assert (amin(a, axis=1) == array([0, 2])).all()
        # # NaN behaviour
        # b = arange(5, dtype=float)
        # b[2] = NaN
        # assert amin(b) == nan
        # assert nanmin(b) == 0.0

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

        a = array([[1, 2], [3, 4]])
        out = array([[0, 0], [0, 0]])
        c = amin(a, axis=1, out=out[0])
        assert (c == [1, 3]).all()
        assert (c == out[0]).all()
        assert (c != out[1]).all()
Beispiel #2
0
    def test_amin(self):
        # tests taken from numpy/core/fromnumeric.py docstring
        from numpypy import array, arange, amin, zeros
        a = arange(4).reshape((2,2))
        assert amin(a) == 0
        # # Minima along the first axis
        # assert (amin(a, axis=0) == array([0, 1])).all()
        # # Minima along the second axis
        # assert (amin(a, axis=1) == array([0, 2])).all()
        # # NaN behaviour
        # b = arange(5, dtype=float)
        # b[2] = NaN
        # assert amin(b) == nan
        # assert nanmin(b) == 0.0

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

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