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 Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  Dave Goel Open/Closed:  Closed
Release:  4.0.3 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.

 

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 Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

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.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-20 mtmiller StatusNone => Duplicate
        Open/ClosedOpen => Closed
        Dependencies- => Depends on bugs #48802
    2016-08-20 deego Carbon-Copy- => Added deego3@gmail.com

    Back to the top


    Powered by Savane 3.5