コード例 #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.cholesky(a, UPLO='U')
     assert_allclose(np.matmul(np.conj(U).T, U), a)
コード例 #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.cholesky(a, UPLO='L')
     assert_allclose(np.matmul(L, L.T), a)
コード例 #3
0
 def test_real_broadcast_U(self):
     m = 5
     a = np.asfortranarray(np.random.randn(m, m))
     a = np.dot(a, a.T)  # make Hermetian symmetric
     a = np.stack((a,) * n_batch, axis=0)
     for workers in [1, -1]:
         U = gulinalg.cholesky(a, UPLO='U', workers=workers)
         assert_allclose(np.matmul(U.swapaxes(-2, -1), U), a)
コード例 #4
0
 def test_complex_broadcast_L(self):
     m = 5
     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,) * n_batch, axis=0)
     for workers in [1, -1]:
         L = gulinalg.cholesky(a, UPLO='L', workers=workers)
         assert_allclose(np.matmul(L, np.conj(L).swapaxes(-2, -1)), a)
コード例 #5
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.cholesky(a, UPLO='U')
     assert_allclose(np.matmul(U.T, U), a)