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

Denis Laxalde denis.laxalde at gmail.com
Wed Nov 11 14:48:20 EST 2009


Hi Dmitrey,

Le mercredi 11 novembre 2009 à 20:28 +0200, Dmitrey a écrit :
> 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" <tmp50 at ukr.net> 
> Кому: scipy-user at scipy.org 
> Дата: 8 ноября, 13:22:34 
> Тема: [SciPy-User] isn't it a bug in scipy.sparse? + some questions 
> 
>         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 

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





More information about the SciPy-User mailing list