help-octave
[Top][All Lists]
Advanced

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

Re: foo_cs = foo{:} - feature or bug ? (octave-3.4.2); also, sizeof(foo{


From: Sergei Steshenko
Subject: Re: foo_cs = foo{:} - feature or bug ? (octave-3.4.2); also, sizeof(foo{:})
Date: Tue, 9 Aug 2011 02:05:44 -0700 (PDT)


--- On Tue, 8/9/11, Marco atzeri <address@hidden> wrote:

> From: Marco atzeri <address@hidden>
> Subject: Re: foo_cs = foo{:} - feature or bug ? (octave-3.4.2); also, 
> sizeof(foo{:})
> To: address@hidden
> Date: Tuesday, August 9, 2011, 12:53 AM
> On 8/9/2011 7:27 AM, Sergei Steshenko
> wrote:
> > 
> > --- On Mon, 8/8/11, James Sherman Jr.<address@hidden> 
> wrote:
> > 
> {cut]
> 
> Again trim your email !!!
> 
> > octave:6>  sizeof(1 + 2)
> > ans =  8
> > "
> > the "1 + 2", which is an _expression_, is first
> converted (apparently) into
> > a _single_ double value, and the size of that double
> value is (apparently)
> > displayed.
> > 
> > So, the inconsistency, as I see it, is:
> > 
> > arithmetic expressions are _by_ _default_ converted
> into a _single_
> > memory location holding their value, and that memory
> location size in
> > bytes is dispalyed;
> > _opposed_ _to_ _that_
> > comma separated list is _not_ converted when 'sizeof'
> is called, but
> 
> function call requires arguments and the arguments are
> separated
> by commas.
> 
> Immagine plot, it can take several arguments
> 
>  -- Function File:  plot (Y)
>  -- Function File:  plot (X, Y)
>  -- Function File:  plot (X, Y, PROPERTY, VALUE, ...)
>  -- Function File:  plot (X, Y, FMT)
>  -- Function File:  plot (H, ...)
>  -- Function File: H = plot (...)
> 
> If a cs-list is transformed in a single object, how we
> can differenziate the arguments ?
> 
> if X,Y is tranformed in Z
> are we calling plot(Z) or plot (X,Y) ?
> 
> This is what happens with
>  -- Built-in Function:  numel (A)
>  -- Built-in Function:  numel (A, IDX1, IDX2, ...)
> 
> you are thinking numel(foo{:}) as it should
> transform foo{:} in A and call numel(A)
> but what is appening is
> 
> A=foo{1}
> IDX1=foo{2}
> IDX2=foo{3}
> IDX3=foo{4}
> ...
> numel (A, IDX1, IDX2, IDX3, ...)
> 
> > 
> > Regards,
> >    Sergei.
> 
> Marco
> _______________________________________________


Imagine that 'sizeof' and 'plot' use _different_ algorithms to deal with
comma separated list.

Since 'plot' and "foo_cs = foo{:}" do use different algorithms to deal
with "foo{:}", why can't "sizeof(foo{:})" us the same algorithm as
"foo_cs = foo{:}" does and not the algorithm "plot(foo{:})" does ?

Assignment (i.e. the "=" operation in LHS = RHS) is just another function
call (inside Octave), so if that function call can do the foo{:} -> foo{1}
conversion, why can't "sizeof(foo{:})" do the same foo{:} -> foo{1}
conversion ?

Regards,
  Sergei.


reply via email to

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