[SciPy-user] more help with sparse matrix: creating

Dominique Orban dominique.orban at gmail.com
Mon Oct 8 13:47:36 EDT 2007


On 10/8/07, Robin <robince at gmail.com> wrote:

> Unfortunately it seems I still can't do the MATLAB style indexing I wanted,
> something like
> M[2, [1,2,3]] = 1
> but since I will be updating row by row anyway I can get around this by
> creating a temporary row vector to insert with slicing.

I am not sure what the above operation does in Matlab.

> Also, if I understand correctly the conversion to csr necessary for
> matrix-vector multiplication cannot be done in place - this is a real shame

That's unfortunately right. It would be a nice addition to PySparse.
However in PySparse, once converted, you cannot modify a csr matrix
anymore.

> as it doubles the memory requirements for this over the MATLAB version
> (I really want to make this array as big as possible)

You don't HAVE to convert it to do matrix-vector product. Objects of
type ll_mat also have a matvec() method. However, it is true that the
csr format is more compact and speeds up products.

Good luck,
Dominique



More information about the SciPy-User mailing list