What is the fastest way to perform x'Ay ?
2 views (last 30 days)
Show older comments
In my code I have a bottleneck when I try to perform the following calculation: Given a square matrix A and vectors of equal length x,y (assume all dimensions are compatible), compute
result = x'*A*y
Is there a way that speeds this up that is simple to implement?
0 Comments
Answers (1)
James Tursa
on 8 Aug 2015
I don't know that there is anything faster than what you have written. A matrix multiply followed by an inner product using BLAS routines in the background. How large are your variables? Is this calculation in a loop where everything changes at each iteration, or do some of the variables remain constant during the loop?
0 Comments
See Also
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!