Example #1
0
 def test_numpy_compare(self, n):
     a = np.array([[0.1231101, 0.72381381],
                   [0.28748201, 0.43036511]]).astype(config.floatX)
     A = matrix("A", dtype=config.floatX)
     A.tag.test_value = a
     Q = matrix_power(A, n)
     n_p = np.linalg.matrix_power(a, n)
     assert np.allclose(n_p, Q.get_test_value())
Example #2
0
 def test_non_square_matrix(self):
     A = matrix("A", dtype=config.floatX)
     Q = matrix_power(A, 3)
     f = function([A], [Q])
     a = np.array([
         [0.47497769, 0.81869379],
         [0.74387558, 0.31780172],
         [0.54381007, 0.28153101],
     ]).astype(config.floatX)
     with pytest.raises(ValueError):
         f(a)