help-octave
[Top][All Lists]
Advanced

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

Re: bug or compatibility issue?


From: Juan Pablo Carbajal
Subject: Re: bug or compatibility issue?
Date: Tue, 7 Aug 2012 15:52:20 +0200

On Tue, Aug 7, 2012 at 3:26 PM, Francesco Potortì <address@hidden> wrote:
> I would expect prepad to retain the class of the argument.  However,
> when extending a logical array, this is converted to double:
>
> octave> class(prepad([false true], 3, false))
> ans = double
>
> This is Octave 3.6.2 on Debian.
>
> Is this a bug?
>
> --
> Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
> ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
> via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040
> (entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

I am inclined to say it is.

The help of prepad says it pads with the scalar C (the given value).
Therefore I would expect that the padded vector is of the same class
as C.
First I checked if logical are scalars
> isscalar(false)
ans = 1

So being logical scalars, then the padded vector should be logical as well.

When C is not given prepad (and postpad) should do

cl = class(x);
C = eval([cl "(0)"]);

to define the zero padding.

and when C is given the final vector should be sent to the class of C
# before return
cl = class(C);
x = eval([cl "(x)"]);


If everybody agrees then I can prepare a patch.




-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/


reply via email to

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