bugGNU Octave - Bugs: bug #48837, cellfun mangles @size for clasdef

 
 

bug #48837: cellfun mangles @size for clasdef

Submitted by:  Dave Goel <deego>
Submitted on:  Sat 20 Aug 2016 07:53:28 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: DuplicateAssigned to: None
Originator Name: Dave GoelOpen/Closed: Closed
Release: 4.0.3Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sat 20 Aug 2016 08:40:56 PM UTC, comment #1:

I believe this is the same as bug #48802 that I found and reported recently. The problem is that function overloads are not respected when using a function handle, whether with cellfun or arrayfun or calling directly, and only when the method is defined within the "methods" block of a classdef definition.

If the method is defined in a separate @someclass/size.m function file, then it works correctly.

Mike Miller <mtmiller>
Project Administrator
Sat 20 Aug 2016 07:53:28 PM UTC, original submission:

Dear Octave,

carandraug (irc) asked me to report this bug.

I am using casadi, a computer algebra system, which has its own classes.

x is a casadi SX object. I don't know anything about classes, and can't provide a test class.

But, if this limited information helps, here's an interesting bug:

octave:4> version ## on debian gnu/linux, from jessie-backports.
ans = 4.0.3

(Create a SX object: octave:2> x=SX.sym('x', 1, 2))

## Using package symbolic.

octave:3> size(x)
ans =
1 2

octave:6> cellfun(@size, {x}, 'unif' , false)
ans =
{
[1,1] =
1 1
}
## wrong size.

## Let's try workarounds :

octave:7> cellfun(@(x)size(x), {x}, 'unif' , false)
ans =
{
[1,1] =
1 1
}
octave:8> cellfun(@(x) feval(@size, x), {x}, 'unif' , false)
ans =
{
[1,1] =
1 1
}
## no luck, still. (So, I resorted to a loop, eventually.)

Dave

Dave Goel <deego>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to 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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 20 Aug 2016 08:40:56 PM UTCmtmillerStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
      Dependencies-=>Depends on bugs #48802
    Sat 20 Aug 2016 07:53:28 PM UTCdeegoCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1