Exemplo n.º 1
0
 def test_matrix_power_operator(self):
     random.seed(1234)
     n = 5
     k = 2
     p = 3
     nsamples = 10
     for i in range(nsamples):
         A = np.random.randn(n, n)
         B = np.random.randn(n, k)
         op = MatrixPowerOperator(A, p)
         assert_allclose(op.matmat(B), matrix_power(A, p).dot(B))
         assert_allclose(op.T.matmat(B), matrix_power(A, p).T.dot(B))
Exemplo n.º 2
0
 def test_matrix_power_operator(self):
     random.seed(1234)
     n = 5
     k = 2
     p = 3
     nsamples = 10
     for i in range(nsamples):
         A = np.random.randn(n, n)
         B = np.random.randn(n, k)
         op = MatrixPowerOperator(A, p)
         assert_allclose(op.matmat(B), matrix_power(A, p).dot(B))
         assert_allclose(op.T.matmat(B), matrix_power(A, p).T.dot(B))