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

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

[Octave-bug-tracker] [bug #53811] Cellfun does not corrrectly find an ov


From: Dave Goel
Subject: [Octave-bug-tracker] [bug #53811] Cellfun does not corrrectly find an overloaded function.
Date: Wed, 2 May 2018 13:29:03 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?53811>

                 Summary: Cellfun does not corrrectly find an overloaded
function.
                 Project: GNU Octave
            Submitted by: deego
            Submitted on: Wed 02 May 2018 05:29:01 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: DAVE GOEL
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Cellfun does not correctly find function overloads on objects when the
argument is the name of a function (e.g. 'numel').  [quoting Mike Miller] - 

Here's an SSCCE by Joris Gillis (casadi developer) - 



classdef Foo
  
  methods
    function r=size(self)
      r = [2 3];
    end
    function r=numel(self)
      r = 6;
    end
  end
end


numel(Foo)  ## =>  6
cellfun('numel',{Foo Foo}) ## => % [1 1]

Ditto for size and other built-ins. Tested with 4.2.2 from debian backports.
Per Mike, also persists in earlier versions.

----


Here's an example of how the bug affects casadi: 

Octave__13:22:11_0021844_2> p = SX.sym('p', [2 3])

Octave__13:22:22_0021844_4> numel(p)
ans =  6


Octave__13:22:25_0021844_5> cellfun(@numel, {p,p})
ans =
   1   1 => Expected [6 6]

----


(with Thanks to Joris Gillis and Mike Miller: ) 

See also

https://savannah.gnu.org/bugs/?46571
and 
https://github.com/casadi/casadi/issues/2253

dave




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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