Weird issues of Large matrix calculation & reshape function..
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 30 de Dic. de 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 comentarios
Ver también
Categorías
Más información sobre Math Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!