[SciPy-user] sparse & linsolve: AttributeError: rowind not found - RESEND

William Hunter William.Hunter at mmhgroup.com
Mon Jul 24 03:29:12 EDT 2006


My apologies, typo in my previous mail (thanks Stéfan):

Lines xsp1 and xsp2 below: Was linsolve.solve, should be linsolve.spsolve.

 

 

 

 

 

I'm having trouble ONLY with the last line (xsp3) of the following:

 

from numpy import arange, ones

from scipy import linalg, sparse

Asp = sparse.lil_matrix((50000,50000))

Asp.setdiag(ones(50000))

Asp[20,100:250] = 10*rand(150)

Asp[200:250,30] = 10*rand(50)

b = arange(0,50000)

xsp1 = linsolve.spsolve(Asp,b)

xsp2 = linsolve.spsolve(Asp.tocsc(),b)

xsp3 = linsolve.spsolve(Asp.tocsr(),b)

 

I get this error for xsp3: AttributeError: rowind not found.

 

However, if I type

 

xsp4 = linsolve.spsolve(Asp.tocsr().T,b)

 

it finds a solution, but obviously not the correct one. Also, the solution for xsp4 is faster by about 1,5 times on my computer than for xsp1 and xsp2.

 

My questions are therefore:

Why won't it solve the system if I convert from LIL to CSR, but it solves (incorrectly) if I use the transpose of Asp.tocsr()? I can only guess it has something to do with the structure of the CSR format. So...

 

What am I doing wrong or am I not understanding something here?

 

This is part of a (simple) example I want to put on Scipy_Tutorial wiki...

 

Regards,

William

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20060724/e6410265/attachment.html>


More information about the SciPy-User mailing list