# [SciPy-user] LU decomposition of a sparse matrix ?

Nils Wagner dr.nwagner at web.de
Sat Jan 17 07:20:01 CST 2004

```SciPy Users List <scipy-user at scipy.net> schrieb am 16.01.04 23:47:06:

Nils Wagner wrote:
> Hi all,
>
> from scipy import *
> from scipy.sparse import *
> def sylvester(n):
>     d = zeros((2, n), Float)
>     d[0, :] = arange(n, 0, -1)
>     d[1, :] = arange(1, n+1)
>     print d
>     A = spdiags(d, [-1, 1], n, n)
>     return A
> n = 6
> S = sylvester(n)
> print S
>
> Is it possible to convert a sparse matrix into a full matrix in scipy ?

There is not a canned function yet I don't think (but check the class
definition).

>
> How about LU decomposition in case of sparse matrices ?
>

Look at the example of solving a sparse linear system (it does an LU
decomposition first, I believe).

def sparse_linear_solve(A,b):
assert isspmatrix(A)
assert A.storage=='CSR'
gssv = eval('_superlu.' + A.ftype + 'gssv')
return gssv(A.shape[0],A.shape[1],A.laste+1,A.data,A.index[0]-1,A.index[1]-1,b)

splinsolve = sparse_linear_solve

What is the meaning of gssv ?

Nils

-Travis

_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.net
http://www.scipy.net/mailman/listinfo/scipy-user

______________________________________________________________________________
Nachrichten, Musik und Spiele schnell und einfach per Quickstart im