bugGNU Octave - Bugs: bug #53811, cellfun does not find overloaded...

 
 

bug #53811: cellfun does not find overloaded function with function name argument

Submitter:  deego <deego>
Submitted:  Wed 02 May 2018 05:29:01 PM UTC
   
 
Category:  Classdef Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  DAVE GOEL Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 02 May 2018 05:40:04 PM UTC, comment #1: 

Confirmed here naturally.

This is actually closer to bug #48837 that you reported a while ago, which I noted as a duplicate of bug #48802.

That bug was about the 'cellfun (@size, ...' syntax, this bug is about the 'cellfun ("size", ...' syntax. They are similar but failing in slightly different ways.

Here, when cellfun gets the name of a function as a string, it does not allow for that function to be an overloaded method of an object in the cell array.

This bug applies to both classdef classes and old-style classes when used with cellfun.

Mike Miller <mtmiller>
Group Member
Wed 02 May 2018 05:29:01 PM UTC, original submission:  

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

deego <deego>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by deego (Submitted the item)
  • -email is unavailable- added by deego
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-23 mmuetzel CategoryInterpreter Classdef
    2018-05-02 mtmiller Summarycellfun does not corrrectly find an overloaded function cellfun does not find overloaded function with function name argument
    2018-05-02 mtmiller CategoryNone Interpreter
        StatusNone Confirmed
        Release4.2.2 dev
        SummaryCellfun does not corrrectly find an overloaded function. cellfun does not corrrectly find an overloaded function
    2018-05-02 deego Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code