Beispiel #1
0
    def test_minimum(self):
        from _numpypy import array, minimum

        a = array([-5.0, -0.0, 1.0])
        b = array([ 3.0, -2.0,-3.0])
        c = minimum(a, b)
        for i in range(3):
            assert c[i] == min(a[i], b[i])
Beispiel #2
0
    def test_minimum(self):
        from _numpypy import array, minimum

        a = array([-5.0, -0.0, 1.0])
        b = array([3.0, -2.0, -3.0])
        c = minimum(a, b)
        for i in range(3):
            assert c[i] == min(a[i], b[i])
Beispiel #3
0
 def test_sequence(self):
     from _numpypy import array, ndarray, negative, minimum
     a = array(range(3))
     b = [2.0, 1.0, 0.0]
     c = 1.0
     b_neg = negative(b)
     assert isinstance(b_neg, ndarray)
     for i in range(3):
         assert b_neg[i] == -b[i]
     min_a_b = minimum(a, b)
     assert isinstance(min_a_b, ndarray)
     for i in range(3):
         assert min_a_b[i] == min(a[i], b[i])
     min_b_a = minimum(b, a)
     assert isinstance(min_b_a, ndarray)
     for i in range(3):
         assert min_b_a[i] == min(a[i], b[i])
     min_a_c = minimum(a, c)
     assert isinstance(min_a_c, ndarray)
     for i in range(3):
         assert min_a_c[i] == min(a[i], c)
     min_c_a = minimum(c, a)
     assert isinstance(min_c_a, ndarray)
     for i in range(3):
         assert min_c_a[i] == min(a[i], c)
     min_b_c = minimum(b, c)
     assert isinstance(min_b_c, ndarray)
     for i in range(3):
         assert min_b_c[i] == min(b[i], c)
     min_c_b = minimum(c, b)
     assert isinstance(min_c_b, ndarray)
     for i in range(3):
         assert min_c_b[i] == min(b[i], c)
Beispiel #4
0
 def test_sequence(self):
     from _numpypy import array, ndarray, negative, minimum
     a = array(range(3))
     b = [2.0, 1.0, 0.0]
     c = 1.0
     b_neg = negative(b)
     assert isinstance(b_neg, ndarray)
     for i in range(3):
         assert b_neg[i] == -b[i]
     min_a_b = minimum(a, b)
     assert isinstance(min_a_b, ndarray)
     for i in range(3):
         assert min_a_b[i] == min(a[i], b[i])
     min_b_a = minimum(b, a)
     assert isinstance(min_b_a, ndarray)
     for i in range(3):
         assert min_b_a[i] == min(a[i], b[i])
     min_a_c = minimum(a, c)
     assert isinstance(min_a_c, ndarray)
     for i in range(3):
         assert min_a_c[i] == min(a[i], c)
     min_c_a = minimum(c, a)
     assert isinstance(min_c_a, ndarray)
     for i in range(3):
         assert min_c_a[i] == min(a[i], c)
     min_b_c = minimum(b, c)
     assert isinstance(min_b_c, ndarray)
     for i in range(3):
         assert min_b_c[i] == min(b[i], c)
     min_c_b = minimum(c, b)
     assert isinstance(min_c_b, ndarray)
     for i in range(3):
         assert min_c_b[i] == min(b[i], c)
Beispiel #5
0
    def test_single_item(self):
        from _numpypy import negative, sign, minimum

        assert negative(5.0) == -5.0
        assert sign(-0.0) == 0.0
        assert minimum(2.0, 3.0) == 2.0
Beispiel #6
0
    def test_single_item(self):
        from _numpypy import negative, sign, minimum

        assert negative(5.0) == -5.0
        assert sign(-0.0) == 0.0
        assert minimum(2.0, 3.0) == 2.0