[SciPy-user] Using umfpack to calculate a incomplete LU factorisation (ILU)

Robert Cimrman cimrman3@ntc.zcu...
Thu Mar 8 10:23:32 CST 2007


Nils Wagner wrote:
> Just out of interest
> 
> Is there something comparable with
> 
> sigma_solve = linsolve.splu(A - sigma*B).solve
> 
> available in UMFPACK ?

Sure, although it is not a oneliner. This is the relevant part of the
docstring:

---
Sparse matrix in CSR or CSC format: mtx
Righthand-side: rhs
Solution: sol

import scipy.linsolve.umfpack as um
# Contruct the solver.
umfpack = um.UmfpackContext()
# Make LU decomposition.
umfpack.numeric( mtx )
...
# Use already LU-decomposed matrix.
sol1 = umfpack( um.UMFPACK_A, mtx, rhs1, autoTranspose = True )
sol2 = umfpack( um.UMFPACK_A, mtx, rhs2, autoTranspose = True )
# same as:
sol1 = umfpack.solve( um.UMFPACK_A, mtx, rhs1, autoTranspose = True )
sol2 = umfpack.solve( um.UMFPACK_A, mtx, rhs2, autoTranspose = True )
---

So basically, after calling umfpack.numeric( mtx ), all subsequent calls
to umfpack or umfpack.solve() will reuse the LU decomposition (if mtx
stays the same...)

Would you be interested in exposing this in linsolve, as, say,

def factorized( A ):
    if isUmfpack and useUmfpack:
	# This must be written...
    else:
        return splu( A ).solve


r.


More information about the SciPy-user mailing list