[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: numel(foo{:}) - feature or bug ?
From: |
Ben Abbott |
Subject: |
Re: numel(foo{:}) - feature or bug ? |
Date: |
Sat, 06 Aug 2011 21:24:19 -0400 |
On Aug 6, 2011, at 2:37 PM, John W. Eaton wrote:
> On 6-Aug-2011, Ben Abbott wrote:
>
> | >From my reading of the discussion, I'm skeptical that everyone
> | >understands that foo{:} is a cs-list, or maybe don't understand
> | >cs-lists?
>
> I think people are also missing another important part of all of this,
> which is that when you call numel with more than one argument, as in
>
> numel (A, IDX2, IDX2, ...)
>
> Then numel returns the number of elements that would result from the
> indexing
>
> A(IDX1, IDX2, ...)
>
> This method is also called when an object appears as lvalue with
> cs-list indexing, i.e., `object{...}' or `object(...).field'.
>
> The above is taken directly from the doc string for numel from Octave
> 3.4.2. As I understand it, numel works this way so that it can be
> used to compute the size of the object that is produced when indexing
> user-defined objects (i.e., @CLASS style objects).
>
> So I don't think the current behavior is a bug.
>
> jwe
I looked through the developers docs and found that a good description of
cs-lists is provided.
.../doc/interpreter/octave.html/Comma-Separated-Lists.html#index-cs_002dlists-454
I also found an error here ...
doc/interpreter/octave.html/Comma-Separated-Lists-Generated-from-Cell-Arrays.html#Comma-Separated-Lists-Generated-from-Cell-Arrays
The example ...
a = {1, [2, 3], 4, 5, 6};
b = [a{1:4}]
⇒ b =
1 2 3 4
... should be ...
a = {1, [2, 3], 4, 5, 6};
b = [a{1:4}]
⇒ b =
1 2 3 4 5
I'll push a changeset to fix this.
Ben
- numel(foo{:}) - feature or bug ?, Sergei Steshenko, 2011/08/05
- Re: numel(foo{:}) - feature or bug ?, Martin.Hepperle, 2011/08/05
- Re: numel(foo{:}) - feature or bug ?, Sergei Steshenko, 2011/08/05
- Re: numel(foo{:}) - feature or bug ?, Sergei Steshenko, 2011/08/05
- Re: numel(foo{:}) - feature or bug ?, PhilipNienhuis, 2011/08/05
- Re: numel(foo{:}) - feature or bug ?, Sergei Steshenko, 2011/08/06
- Re: numel(foo{:}) - feature or bug ?, Ben Abbott, 2011/08/06
- Re: numel(foo{:}) - feature or bug ?, John W. Eaton, 2011/08/06
- Re: numel(foo{:}) - feature or bug ?,
Ben Abbott <=
- Re: numel(foo{:}) - feature or bug ?, Jordi Gutiérrez Hermoso, 2011/08/06
- Re: numel(foo{:}) - feature or bug ?, Ben Abbott, 2011/08/06
- Re: numel(foo{:}) - feature or bug ?, Marco atzeri, 2011/08/07
- Re: numel(foo{:}) - feature or bug ?, John W. Eaton, 2011/08/07
- Re: numel(foo{:}) - feature or bug ?, Marco atzeri, 2011/08/07
Re: numel(foo{:}) - feature or bug ?, Sergei Steshenko, 2011/08/05
Re: numel(foo{:}) - feature or bug ?, Ben Abbott, 2011/08/05