[SciPy-user] Left hand sparse matrix multiplication

Dominique Orban dominique.orban@gmail....
Wed Oct 8 11:36:10 CDT 2008


On Wed, Oct 8, 2008 at 11:41 AM, James Philbin <philbinj@gmail.com> wrote:
> Hi,
>
> I'm trying to compute x*A where x is a dense row vector and A is a
> sparse CSC matrix. A.rmatvec seems to do what I want but is wasteful
> as it computes:
> self.transpose().matvec( other )
> i.e. it computes A^T * x^T.
>
> It seems there should be a much more efficient overload for csc's
> rmatvec which doesn't involve computing the transpose. I hope i'm
> understanding things correctly.

Do you only need matrix-vector products with A in this form, i.e.,
x*A, or do you also need A*x? If you only need x*A you're probably
better off storing B=A^T in CSR format and computing B*x' where x' is
the column vector x (always stored as a column vector.)

Dominique


> On Tue, Oct 7, 2008 at 9:12 PM, Anne Archibald
> <peridot.faceted@gmail.com> wrote:
>> 2008/10/7 Neilen Marais <nmarais@sun.ac.za>:
>>
>>> I have a real sparse matrix that I factorized using
>>> scipy.sparse.linalg.dsolve.factorized(). When I solve it with a complex
>>> RHS, I always get a real return. Do I need to set the matrix type as
>>> complex in this case, or is there a better way?
>>
>> If all you're doing is solving  y = A*x, then you can simply solve for
>> the real and imaginary parts separately, since a real matrix won't mix
>> them and the problem is linear.
>>
>> Anne
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user@scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-user mailing list