This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Best way of doing A^T * A

Tags: None
(comma "," separated)
germanros
Registered Member
Posts
7
Karma
0

Best way of doing A^T * A

Wed Apr 17, 2013 11:07 pm
Hello everyone,

I am getting bad performance when computing
Code: Select all
B = A.transpose() * A
. When A is a 903x13 Matrix it takes around 13 ms.
After checking in the forum I found this thread, where this issue is discussed. There someone proposed a better way of doing this operation by using
Code: Select all
B.selfadjointView<Upper>().rankUpdate(A);


Is this correct? Because, this code does not produce the same matrix as A.transpose() * A. I am a bit lost right now...
If this is not the correct way, then what is the best way for computing A^T * A?

Thank you and best regards,
G. Ros.
germanros
Registered Member
Posts
7
Karma
0

Re: Best way of doing A^T * A

Thu Apr 18, 2013 8:36 am
Ok, I have realized that the correct expression should be:
Code: Select all
B.selfadjointView<Upper>().rankUpdate(A.transpose());

However, it seems to be that the transpose of A is making the operation very slow. When A is used instead of A.transpose() the time goes down to 1.5 ms.

Is there a way of doing this in an efficient fashion?

Best regards,
G. Ros
germanros
Registered Member
Posts
7
Karma
0

Re: Best way of doing A^T * A

Thu Apr 18, 2013 7:54 pm
My fault. Problem solved.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Best way of doing A^T * A

Fri Apr 19, 2013 7:57 am
What was the error?

Also, regarding your first post, 13ms for this computation means 23GFLOPS for a full product. Of course, using the selfadjointView allows to reduce the number of computations, but for such small outputs I don't expect much gain from this trick.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]