Weird issues of Large matrix calculation & reshape function..
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to divide some numbers to large matrix A (2x300000) and then, I also want to reshape calculated matrix into (3000x100).
so I made some example code like this, but I found some bizarre issue....
I think that adding reshape functions into for loop increase the number of calculations, but when I added these functions after divide section, calculation time decreases.
Is there anyone who knows about this weird issue?
A=[1:1:300000;1:1:300000];
b=1:1:300000;
tic;
for mm=1:50
C1=A(1,:)./b;
C2=A(2,:)./b;
ximg2 = reshape(C1, 3000, 100);
yimg2 = reshape(C2, 3000, 100);
end
toc
tic;
for mm=1:50
C1=A(1,:)./b;
C2=A(2,:)./b;
end
toc
0 commentaires
Réponses (1)
Walter Roberson
le 30 Déc 2016
My timing tests show that the first block of code is about 3.8% slower on average, but that the random variation (due to my system doing other things at the same time) was enough that sometimes the second block measured as slower (about 10% of the time.)
0 commentaires
Voir également
Catégories
En savoir plus sur Math Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!