Beispiel #1
0
 def test_tile(self):
     x, y = initVariablesADI(np.array([[5, -2]]).T, np.array([[3]]).T)
     yyy = npad.tile(y, (3,1))
     assert np.array_equal(yyy.val, np.array([[3,3,3]]).T)
     assert np.array_equal(yyy.jac[1].toarray(), np.array([[1,1,1]]).T)
     with pytest.raises(TypeError):
         npad.tile(y, 3)
     with pytest.raises(TypeError):
         npad.tile(y, (3,2))
Beispiel #2
0
 def test_vec_vec(self):
     a, b = np.array([[1,-2]]), np.array([[3,4]])
     assert np.array_equal(npad.tile(a, (3,2)), np.tile(a, (3,2)))
     assert np.array_equal(npad.sign(a), np.sign(a))
     assert np.array_equal(npad.abs(a), np.abs(a))