Ejemplo n.º 1
0
 def test_complex_U(self):
     m = 10
     a = np.ascontiguousarray(np.random.randn(m, m))
     a = a + 1j * np.ascontiguousarray(np.random.randn(m, m))
     a = np.dot(a, np.conj(a).T)  # make Hermetian symmetric
     U = gulinalg.poinv(a, UPLO='U')
     assert_allclose(np.matmul(a, U), np.eye(m), atol=1e-10)
Ejemplo n.º 2
0
 def test_real_noncontiguous(self):
     m = 10
     a = np.asfortranarray(np.random.randn(m, m))
     a = np.dot(a, a.T)  # make Hermetian symmetric
     a = a[::2, ::2]
     L = gulinalg.poinv(np.tril(a), UPLO='L')
     assert_allclose(np.matmul(a, L), np.eye(a.shape[0]), atol=1e-10)
Ejemplo n.º 3
0
 def test_real_broadcast_L(self):
     m = 5
     nbatch = 16
     a = np.asfortranarray(np.random.randn(m, m))
     a = np.dot(a, a.T)  # make Hermetian symmetric
     a = np.stack((a, ) * nbatch, axis=0)
     for workers in [1, -1]:
         L = gulinalg.poinv(np.tril(a), UPLO='L')
         assert_allclose(gulinalg.matrix_multiply(a, L),
                         np.stack((np.eye(m), ) * nbatch, axis=0),
                         atol=1e-10)
Ejemplo n.º 4
0
 def test_complex_broadcast_U(self):
     m = 5
     nbatch = 16
     a = np.asfortranarray(np.random.randn(m, m))
     a = a + 1j * np.asfortranarray(np.random.randn(m, m))
     a = np.dot(a, np.conj(a).T)  # make Hermetian symmetric
     a = np.stack((a, ) * nbatch, axis=0)
     for workers in [1, -1]:
         U = gulinalg.poinv(a, UPLO='U', workers=workers)
         assert_allclose(np.matmul(a, U),
                         np.stack((np.eye(m), ) * nbatch),
                         atol=1e-10)
Ejemplo n.º 5
0
 def test_real_fortran(self):
     m = 10
     a = np.asfortranarray(np.random.randn(m, m))
     a = np.dot(a, a.T)  # make Hermetian symmetric
     L = gulinalg.poinv(np.tril(a), UPLO='L')
     assert_allclose(np.matmul(a, L), np.eye(m), atol=1e-10)
Ejemplo n.º 6
0
 def test_real_U(self):
     m = 10
     a = np.ascontiguousarray(np.random.randn(m, m))
     a = np.dot(a, a.T)  # make Hermetian symmetric
     U = gulinalg.poinv(np.triu(a), UPLO='U')
     assert_allclose(np.matmul(a, U), np.eye(m), atol=1e-10)