[SciPy-User] isn't it a bug in scipy.sparse? + some questions

0 views
Skip to first unread message

Dmitrey

unread,
Nov 8, 2009, 6:22:34 AM11/8/09
to scipy...@scipy.org
Hi scipy.sparse developers and all other scipy users,
I'm trying to take benefits for solving SLEs in FuncDesigner via involving scipy.sparse.
Some examples are here
http://openopt.org/FuncDesignerDoc#Solving_systems_of_linear_equations
and example for sparse SLEs is here
http://trac.openopt.org/openopt/browser/PythonPackages/FuncDesigner/FuncDesigner/examples/sparseSLE.py
It already works faster than using dense matrices, but I want to speedup it even more, so I have some questions and seems like bug report (scipy.__version__ 0.7.0):

from scipy import sparse
from numpy import *
a=sparse.lil_matrix((3,1))
a[0:3,:] = ones(3)
print a.todense()
#prints
[[ 1.]
 [ 0.]
 [ 0.]]
while I expect all-ones

Questions:
1) Seems like a[some_ind,:]=something works very, very slow for lil. I have implemented a workaround, but can I use a[some_ind,:] for another format than lil? (seems like all other ones doesn't support it).
2) What is current situation with matmat and matvec functions? They say "deprecated" but no alternative is mentioned.
3) What is current situation with scipy.sparse.linalg.spsolve? It says
/usr/lib/python2.6/dist-packages/scipy/sparse/linalg/dsolve/linsolve.py:78: DeprecationWarning: scipy.sparse.linalg.dsolve.umfpack will be removed, install scikits.umfpack instead
  ' install scikits.umfpack instead', DeprecationWarning )
But I don't want my code to be dependent on a scikits module. Are there another default/autoselect solver for sparse SLEs?
If no, which one would you recommend me to use as default for sparse SLEs - bicg, gmres, something else?

Thank you in advance, D.

Dmitrey

unread,
Nov 11, 2009, 1:28:24 PM11/11/09
to SciPy Users List
So, anyone doesn't know answers to the questions about scipy.sparse module mentioned below?
As for the bug mentioned, I have installed latest numpy & scipy svn snapshots (1.4.0.dev7726 and 0.8.0.dev6096), the bug still exist.
D.

--- Исходное сообщение ---
От кого: "Dmitrey" <tm...@ukr.net>
Кому: scipy...@scipy.org
Дата: 8 ноября, 13:22:34
Тема: [SciPy-User] isn't it a bug in scipy.sparse? + some questions

_______________________________________________
SciPy-User mailing list
SciPy...@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

Pauli Virtanen

unread,
Nov 11, 2009, 2:36:31 PM11/11/09
to scipy...@scipy.org
ke, 2009-11-11 kello 20:28 +0200, Dmitrey kirjoitti:
> So, anyone doesn't know answers to the questions about scipy.sparse
> module mentioned below?

Or the people who know did not have time to immediately answer your
question, and forgot about the mail afterwards.

If you think it's a bug, please file a ticket in the Trac. Thanks!

--
Pauli Virtanen

Denis Laxalde

unread,
Nov 11, 2009, 2:48:20 PM11/11/09
to SciPy Users List
Hi Dmitrey,

in this case, using:
a[0:3,:] = 1
will do what you want.

I don't know if it's really a bug.


>
> Questions:
> 1) Seems like a[some_ind,:]=something works very, very slow
> for lil. I have implemented a workaround, but can I use
> a[some_ind,:] for another format than lil? (seems like all
> other ones doesn't support it).

>From what I understand, lil format is useful for building matrices terms
by terms. As for advanced indexing operations, I guess coo format is
more appropriate...

--
Denis

Nathan Bell

unread,
Dec 1, 2009, 7:14:30 PM12/1/09
to SciPy Users List
2009/11/8 Dmitrey <tm...@ukr.net>:

>
> Questions:
> 1) Seems like a[some_ind,:]=something works very, very slow for lil. I have
> implemented a workaround, but can I use a[some_ind,:] for another format
> than lil? (seems like all other ones doesn't support it).

Please file a bug report if you haven't done so already. It's
possible that this issue is already fixed [1] or will be fixed in 0.8.

[1] http://projects.scipy.org/scipy/ticket/917

> 2) What is current situation with matmat and matvec functions? They say
> "deprecated" but no alternative is mentioned.

Those are implemented with A*x now (just like a dense matrix). Sorry
for the confusion, the deprecation warning should be more explicit.
Feel free to file a bug report :)

> 3) What is current situation with scipy.sparse.linalg.spsolve? It says
> /usr/lib/python2.6/dist-packages/scipy/sparse/linalg/dsolve/linsolve.py:78:
> DeprecationWarning: scipy.sparse.linalg.dsolve.umfpack will be removed,
> install scikits.umfpack instead
>   ' install scikits.umfpack instead', DeprecationWarning )
> But I don't want my code to be dependent on a scikits module. Are there
> another default/autoselect solver for sparse SLEs?
> If no, which one would you recommend me to use as default for sparse SLEs -
> bicg, gmres, something else?

Currently, if you have UMFPACK installed when SciPy is compiled (often
this happens automatically) then it will be the default handler for
spsolve(). Since UMFPACK is a GPL code a decision was made to move
the wrappers an optional package (scikits.umfpack). Eventually, these
wrappers will be removed from SciPy and the default will revert to
SuperLU, which is BSD licensed sparse factorization method that ships
with SciPy.

--
Nathan Bell wnb...@gmail.com
http://www.wnbell.com/

Reply all
Reply to author
Forward
0 new messages