[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: Hastighed: Octave VS. MatLab



Allan Lyckegaard <sslug@sslug> writes:

> Men min tanke er at det måske har noget med hukommelses-allokering
> nu siden det er while-løkker? Er den bedre i MatLab end i Octave?

Det ved jeg ikke. Det er svært at bedømme det uden at se koden. Her er
et par meget løse gæt:

Det burde være let at teste hypotesen om hukommelsesallokering. Du kan
bare udnævne alle variablene til at være global. (eller static.. hmm
jeg har glemt om man kan bruge static i Matlab?).

Du brugte en while-løkke og udførte et forsøg ad gangen, indtil du har
havde fundet 100 fejl. Hvis du kunne skrive din kode på matriceform,
så ville du måske kunne spare tid på at udføre flere forsøg ad gangen
(parallelt). Det ville kræve mere hukommelse, men du ville måske spare
tid på at du ikke skulle igennem while-løkken så mange gange. (Måske
kunne du måle antal fejl per 1000 kørsler istedet for antal kørsler
per 100 fejl)

Lige for en god ordens skyld. Man kan forlænge en vektor i Matlab og
Octave ved at ændre værdien af et element der et højere index end
længden af vektoren, men det går ret langsomt. Det følgende er fyfy

a=1;
for i=1:100
 a(i,1) = i;
end

brug istedet

a=zeros(100,1)
for i=1:100
 a(i,1) = i;
end


-- 
Niels L Ellegaard  http://dirac.ruc.dk/~gnalle/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *