[SciPy-user] broadcasting elementwise on sparse matrix

Robin robince at gmail.com
Wed Oct 1 09:50:09 EDT 2008


Hi,

Is there any way to get broadcasted element wise operations on sparse matrices?

I would like to do something like A * x if A was (n,n) array and x was
a (n,) array. I saw the sparse matrices have a .multiply method, but
it doesn't seem to broadcast in the same way as the standard
multiplication, ie As.multiply(x) gives an "inconsistent shapes"
error.

The best I have is As.multiply(tile(x,(n,1))) although this has the memory
overhead that is normally avoided with broadcasting. Is there an alternative?

Thanks

Robin



More information about the SciPy-User mailing list