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

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

[Octave-bug-tracker] [bug #63802] movfun always returns class="double"


From: Rik
Subject: [Octave-bug-tracker] [bug #63802] movfun always returns class="double"
Date: Mon, 27 Feb 2023 11:16:58 -0500 (EST)

Follow-up Comment #5, bug #63802 (project octave):

The output class (later calculated and captured in the variable yclass)
depends on calculating the function on input of type xclass.  For example,


fcn = @uint8;
x = ones (1,0,3,4);
xclass = class (x)  # "double"
y = fcn (x);
yclass = class (y)  # "uint8"

# This will return correct size, but incorrect class
y = zeros (szx, class (x))


Conceptually, one could do this:


yclass = class (fcn (cast (0, class (x))));
y = zeros (szx, yclass);


This calls "fcn (0)" of the correct type of zero solely to get the class.  I
didn't think it was particularly worth it given that the output is always an
empty matrix and thus there is not much to be done with it (can't do further
calculations with it since there is nothing to calculate on).  But, this is
also a slow path (we're in a short-circuit path about to exit) so I suppose we
could calculate the yclass value.  I have no strong feelings here.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63802>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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