Saving result of sparse.linalg.splu and spilu to file\disk
Hi guys/girls, I'm trying to save the result of a (sparse.linalg.spilu) LU decomposition of A such that Ax = b to disk. I only need the result once to apply to many sets of b (solutions). The spilu takes ~ 4hours to compute. Unfortunately, the object returned is a 'factored_lu' type and I don't know how to save this to disk. It won't pickel or mashal: Below is some test code that builds a small ILU 'factored_lu' object called EquSpaInvish ____________________________________________________________________________ from scipy.sparse import lil_matrix from scipy.sparse.linalg import spsolve,spilu from numpy.linalg import solve, norm, inv from numpy.random import rand size = 250 A = lil_matrix((size, size)) A[0, :size] = rand(size) A.setdiag(rand(size)) A = A.tocsc() b = rand(size) EquSpaInvish = spilu(A) iluelap = tm.time() - ilustart x = EquSpaInvish.solve(b) _____________________________________________________________________________ I want to save\load EquSpaInvish to\from disk so i don't have to calculate it each time. Any ideas......? Kind Regards Dave :)
06.08.2012 20:11, Dave Smith kirjoitti:
I'm trying to save the result of a (sparse.linalg.spilu) LU decomposition of A such that Ax = b to disk. I only need the result once to apply to many sets of b (solutions). The spilu takes ~ 4hours to compute.
Unfortunately, the object returned is a 'factored_lu' type and I don't know how to save this to disk. It won't pickel or mashal: [clip] Any ideas......?
The result of the LU decomposition is in SuperLU internal format that is not exposed via the Python interface. You'll need to dig into SuperLU source code and take a look at the Scipy wrapper. The relevant source files are under scipy/sparse/linalg/dsolve/ in Scipy's source code. -- Pauli Virtanen
participants (2)
-
Dave Smith -
Pauli Virtanen