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

 
 

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

Submitted by:  Dave Goel <deego>
Submitted on:  Wed 02 May 2018 05:29:01 PM UTC  
 
Category:  Interpreter 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

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project Administrator
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

Dave Goel <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 mtmiller (Posted a comment)
  • -email is unavailable- added by deego (Submitted the item)
  • -email is unavailable- added by deego
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    Wed 02 May 2018 05:41:57 PM UTC mtmiller Summarycellfun does not corrrectly find an overloaded function => cellfun does not find overloaded function with function name argument
    Wed 02 May 2018 05:40:04 PM UTC 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
    Wed 02 May 2018 05:29:01 PM UTC deego Carbon-Copy- => Added -email is unavailable-

    Back to the top


    Powered by Savane 3.3