[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance optimization (allocation inside a for loop)

From: Elias Assmann
Subject: Re: Performance optimization (allocation inside a for loop)
Date: Thu, 02 Apr 2009 18:32:49 +0200
User-agent: Mozilla-Thunderbird (X11/20090103)

John W. Eaton wrote:
| > 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?

In Octave, an expression like 1:n creates a range object, which
contains only the base, limit, and increment as double precision
values, so no matter how many elements are in the range, it only takes
a few bytes of storage (24 for the data plus some overhead for the
internal octave_value object itself).

Thanks for the elucidating answer.


QED is Latin for small empty box.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]