def test_1to5(self): rhs = self.rhs sol = self.sol Ainv = pymatsolver.Mumps(self.A) for i in range(3): self.assertLess(np.linalg.norm(Ainv * rhs[:, i] - sol[:, i]), TOL) self.assertLess(np.linalg.norm(Ainv * rhs - sol, np.inf), TOL)
def test_1to5_cmplx(self): rhs = self.rhs.astype(complex) sol = self.sol.astype(complex) self.A = self.A.astype(complex) Ainv = pymatsolver.Mumps(self.A) for i in range(3): self.assertLess(np.linalg.norm(Ainv * rhs[:, i] - sol[:, i]), TOL) self.assertLess(np.linalg.norm(Ainv * rhs - sol, np.inf), TOL)
def test_multiFactorsInMem(self): n = 100 A = sp.rand(n, n, 0.7) + sp.identity(n) x = np.ones((n, 10)) rhs = A * x solvers = [pymatsolver.Mumps(A) for _ in range(20)] for Ainv in solvers: self.assertLess( np.linalg.norm(Ainv * rhs - x) / np.linalg.norm(rhs), TOL) Ainv.clean() for Ainv in solvers: self.assertLess( np.linalg.norm(Ainv * rhs - x) / np.linalg.norm(rhs), TOL)