From 722e9038e376b75eff2e8858471a8fe96a128312 Mon Sep 17 00:00:00 2001 From: Carl-Martin Pfeiler <carl-martin.pfeiler@asc.tuwien.ac.at> Date: Wed, 20 Mar 2019 10:47:14 +0100 Subject: [PATCH] removed commented old version of stationary pre --- .../_details/interfaces/tpsPreconditioner.py | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/integrators/_details/interfaces/tpsPreconditioner.py b/integrators/_details/interfaces/tpsPreconditioner.py index 499e80b..81b4e3a 100644 --- a/integrators/_details/interfaces/tpsPreconditioner.py +++ b/integrators/_details/interfaces/tpsPreconditioner.py @@ -193,48 +193,6 @@ class TPSPreconditioner(_preconditionerInterface._PreconditionerInterface): (A.shape[0]*2, A.shape[0]*2), matvec=Pre) -# Ainv = np.zeros(A.shape, dtype=float) -# -# e = np.zeros(A.shape[0], dtype=float) -# e[0] = 1.0 -# -# print("Inverting matrix for stationary preconditioner") -# sol, succ = scipy.sparse.linalg.cg(A, e \ -# , tol=self._solvetol, maxiter=4000) -# idx = (abs(sol) > self._solvetol) -# Ainv[idx,0] = sol[idx] -# for j in range(1, A.shape[0]): -# e[j-1] = 0.0 -# e[j] = 1.0 -# sol, succ = scipy.sparse.linalg.cg(A, e, tol=self._solvetol, maxiter=4000) -# idx = (abs(sol) > self._solvetol) -# Ainv[idx, j] = sol[idx] -# if (j % 100 == 0): -# print("Finished ", j, "out of ", A.shape[0] \ -# , "cols of stationary preconditioner") -# -# N = A.shape[0] -# -# csrAinv = sp.csr_matrix(Ainv) -## cooAinv = sp.coo_matrix(Ainv) -## self._preStationary = sp.csr_matrix(( \ -## np.append(cooAinv.data, cooAinv.data), ( \ -## np.append(2*cooAinv.row, 2*cooAinv.row+1), \ -## np.append(2*cooAinv.col, 2*cooAinv.col+1) ))) -# -## self._preStationary.eliminate_zeros() -# -### stationary = lambda x: np.concatenate(( \ -### csrAinv.dot(x[:x.size//2]), csrAinv.dot(x[x.size//2:]))) -# # TODO THIS solves the above problem, saves memory also. TODO adapt to solving stuff -# stationary = lambda x: np.vstack((csrAinv.dot(x[0::2]),csrAinv.dot(x[1::2]))).reshape((-1,),order='F') -## stationary = lambda x: self._preStationary.dot(x) -# -# self._preconditioner = scipy.sparse.linalg.LinearOperator( \ -# (2*csrAinv.shape[0], 2*csrAinv.shape[1]), matvec=stationary) -## self._preStationary.shape, matvec=stationary) - - #------------------------------------------------------------------------------# -- GitLab