Ejemplo n.º 1
0
 def test_08(self):
     rho = 1e-1
     N = 128
     M = 64
     K = 32
     D = cp.random.randn(N, M)
     X = cp.random.randn(M, K)
     S = D.dot(X)
     Z = (D.dot(X).dot(X.T) + rho * D - S.dot(X.T)) / rho
     c, lwr = linalg.cho_factor(X, rho)
     Dslv = linalg.cho_solve_AATI(X, rho, S.dot(X.T) + rho * Z, c, lwr)
     assert (linalg.rrs(
         Dslv.dot(X).dot(X.T) + rho * Dslv,
         S.dot(X.T) + rho * Z) < 1e-11)
Ejemplo n.º 2
0
 def test_06(self):
     rho = 1e-1
     N = 128
     M = 64
     K = 32
     D = cp.random.randn(N, M)
     X = cp.random.randn(M, K)
     S = D.dot(X)
     Z = (D.T.dot(D).dot(X) + rho * X - D.T.dot(S)) / rho
     c, lwr = linalg.cho_factor(D, rho)
     Xslv = linalg.cho_solve_ATAI(D, rho, D.T.dot(S) + rho * Z, c, lwr)
     assert (linalg.rrs(
         D.T.dot(D).dot(Xslv) + rho * Xslv,
         D.T.dot(S) + rho * Z) < 1e-14)