|
From: | Elias Assmann |
Subject: | Re: Performance optimization (allocation inside a for loop) |
Date: | Thu, 02 Apr 2009 17:58:54 +0200 |
User-agent: | Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
Rob Mahurin wrote:
octave:29> tic; n = 1e5; retval = 1:n; toc Elapsed time is 0.000756025 seconds. octave:30> tic; n = 1e5; retval = (1:n)(1:n); toc Elapsed time is 0.00757694 seconds. octave:31> tic; n = 1e5; retval = [1:n]; toc Elapsed time is 0.0125589 seconds.
Can someone explain the difference between "1:n" and "[1:n]"? I would normally write the brackets because I find that way clearer; does this mean "1:n" is actually the "preferred" way?
Elias -- Wenn weniger mehr ist, ist nichts alles.
[Prev in Thread] | Current Thread | [Next in Thread] |