[SciPy-user] sparse+slice? (and hello!)

Bram de Jong - MTG bdejong at iua.upf.edu
Wed May 17 03:19:05 EDT 2006


Hello everyone,


( First post on this list... Using SciPy in various algorithms and 
extensions, all related to audio processing )


* A simple question to start of with, is it correct to say that the 
sparse matrices do not support slicing?

 > values = [0.1, 5.8, 21.8]
 > indices = [[0,0],[1,1],[2,1]]
 > matrix = sparse.coo_matrix(values, indices, 3, 3)
 > matrix = matrix.tocsc()
 > matrix2[1,1]
5.7999999999999998
 > matrix2[1,:]
Traceback (most recent call last):
   File "<input>", line 1, in ?
   File "C:\PYTHON23\lib\site-packages\scipy\sparse\Sparse.py", line 
578, in __getitem__
     raise KeyError, "Index out of bounds."
KeyError: 'Index out of bounds.'

This using the scipy from the latest 'enthought' python installer for 
windows.

PySparse seems to support slicing, but seems to be VERY slow when slicing...


* a not-so-simple question: is there any documentation, tutorial, 
introduction, ... to the sparse matrices of scipy? It seems neither the 
official (feebased) docs mention them, nor are the docstrings *that* 
extensive.




  - bram

-- 
MTG                   - http://www.mtg.upf.edu/
The Freesound Project - http://freesound.iua.upf.edu
Smartelectronix       - http://www.smartelectronix.com
Musicdsp              - http://www.musicdsp.org
Office Telephone      - +34 935 422 101




More information about the SciPy-User mailing list