[SciPy-user] Invert a sparse matrix
Thu Oct 4 11:28:22 CDT 2007
On 10/4/07, Dominique Orban <email@example.com> wrote:
> I presume then that A does not change from one loop pass to the next.
> It might be more efficient to factorize A once outside the loop and
> keep its factors around (L and U if A is not symmetric, or just L if
> it is symmetric and positive definite, etc). E.g., you can use UMFPACK
> and call umfpack.solve, asking for a solve with A^T.
> Cases where you *really* need the inverse are rare. Moreover, the
> inverse of a sparse matrix is not necessarily sparse. Typically,
> inverting is more expensive than an LU factorization and prone to
> rounding errors.
Thanks for your help.
Yes, A does not change. If I factorise into LU outside of the loop and then
solve inside the loop could it really be as quick as multiplying by the
Unfortunately the other points don't apply - in this case the nonzero's of
the matrix are all ones - the inverse contains just ones and -1's, and is
sparse, and (at least in MATLAB) was calculated easily without any round off
To me it doesn't matter that inverting is more expensive than LU because it
only happens once, it is the inside of the loop that I care about.
In the mean time I will try rebuilding scipy with UMFPACK to see how it
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user