How to optimize matrix multiplication speed?
Show older comments
Hi all,
I'd like to increase computation speed of a matrix multiplication that occures many times in my code.
P = PHI*(P + Q)*PHI' + Q;
% P and Q are symetric positive 50x50 matrices
% PHI is a 50x50 matrix
Is there a way to optimize this code?
thanks!
Accepted Answer
More Answers (1)
James Tursa
on 3 Aug 2020
Edited: James Tursa
on 3 Aug 2020
0 votes
This looks like a covariance matrix update to me. The matrix multiplies are already done by highly optimized multi-threaded compiled BLAS library code, so you will not be able to improve on that. The only thing that might help you is the symmetry part, but unfortunately there are no symmetric BLAS routines to do your specific multiply. Also, since the multiplies will be done with generic matrix multiply routines, the result will likely not be exactly symmetric. If this makes a difference to you, you will have to manually correct the result. E.g., P = (P + P')/2
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!