[SciPy-user] broadcasting elementwise on sparse matrix

Robin robince@gmail....
Wed Oct 1 08:50:09 CDT 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