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?

Respuestas (1)

James Tursa
James Tursa el 8 de Ag. de 2015

1 voto

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?

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 8 de Ag. de 2015

Respondida:

el 8 de Ag. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by