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

 
 

bug #48837: cellfun mangles @size for clasdef

Submitter:  deego <deego>
Submitted:  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
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group Member
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

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

 

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
  •  

    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 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 -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code