Thanks.
I wrote a code doing the low-level multiplication, since I have yet to play
with LaIndex, but I'll re-write it eventually. Maybe this should be
implemented into Blas++?
Jack
-----Original Message-----
From: Christian Stimming [mailto:sti...@tu...]
Sent: September 3, 2004 5:15 AM
To: Jacob (Jack) Gryn
Cc: lap...@li...
Subject: Re: [Lapackpp-devel] Matrix Multiplication to return only diagonal?
Dear Jack,
I have searched through all of the available BLAS documentation but I
did not find any such routine.
You could write one by yourself that will calculate the dot product
between all rows of the left and columns of the right matrix:
// calculate only the diagonal of A times B
int msize = std::min(A.size(0), B.size(1));
LaGenVectorDouble result(msize);
assert(A.size(1) == B.size(0));
for (int i=0; i < msize; i++)
result(i) = Blas_Dot_Prod(A(LaIndex(i), LaIndex(0,A.size(1)),
B(LaIndex(0,B.size(0)), LaIndex(i)));
As always, you would need to check whether this code really does the
right thing. I'm always unsure whether I got the indices right and I
don't confuse the "beginning with 0" or the last index.
Christian
Jacob (Jack) Gryn schrieb:
> Hi,
>
>
>
> I was wondering if you know of any functions that will do a matrix
> multiplication only to obtain the diagonal of the resulting
> multiplication (that avoids the excess computations and temporary space
> needed)?
>
>
>
> Jack
>
|