What is the fastest way to perform x'Ay ?

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?

답변 (1개)

James Tursa
James Tursa 2015년 8월 8일

1 개 추천

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?

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

질문:

2015년 8월 8일

답변:

2015년 8월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by