octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #45758] for 'range' type input some functions


From: Rik
Subject: [Octave-bug-tracker] [bug #45758] for 'range' type input some functions fail to return type range
Date: Thu, 20 Aug 2015 15:35:51 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0

Follow-up Comment #6, bug #45758 (project octave):

The possible source of confusion I see is not that range types are not
preserved in some functions, but that the class of the range is always double.
 I think the base assumption might be that a range constructed from type X
variables would itself be of type X.  See an example below with uint8.


octave:1> lo = uint8 (1)
lo = 1
octave:2> hi = uint8 (5)
hi = 5
octave:3> x = lo:hi
x =

   1   2   3   4   5

octave:4> class (x)
ans = double
octave:5> y = uint8 (lo:hi)
y =

  1  2  3  4  5

octave:6> class (y)
ans = uint8


I'm not arguing to change this, as I think it would involve a lot of code for
very few actual usage cases; just pointing out that this probably violates
people's internal expectations.

If there was a change to make to the Range class I would like to see the
extension to column vectors.  I understand why Ranges were implemented first
for row vectors to compact the argument to a for loop.  But it has always
seemed a little strange that x = 1:50 is fine but taking the transpose with y
= x' undoes all of the magic.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45758>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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