Multiplication of large matrix with its transpose
Show older comments
What would be the best way to multiply a large matrix A say, 100000 x 10, by its transpose A' in MATLAB 2021b. The output will be a 100000x100000 matrix. This is giving a memory error > 40 GB.
Previous suggestions in Q&A include avoiding creation of A' before multiplication. This certainly helps in reducing time with smaller matrices as tested with 30,000 points. Thanks.
1 Comment
Chris Wilson
on 15 Apr 2024
Thanks a lot - this is extremely helpful to know - it helped me solve a related problem.
Accepted Answer
More Answers (1)
James Tursa
on 15 Dec 2021
0 votes
The fastest way is to simply write it as A * A', because MATLAB will see that the operands are the same and call a special multi-threaded symmetric BLAS library function to do the multiply without explicitly forming the transpose A' first.
As for your memory problems, that is an entirely different issue. If you really need this result and it is full, then you may be forced to chunk out the operation into smaller pieces and work on them individually. If A has lots of 0's then you could look into sparse representations.
Categories
Find more on Logical 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!