bugGNU Octave - Bugs: bug #32071, isequal with objects

 
 

bug #32071: isequal with objects

Submitted by:  Guillaume <gyom>
Submitted on:  Thu 06 Jan 2011 07:04:16 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Mon 10 Jan 2011 07:34:12 PM UTC, comment #4:

I checked in the following additional changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/caf1fd72f587

John W. Eaton <jwe>
Project Administrator
Mon 10 Jan 2011 12:06:44 PM UTC, comment #3:

While it works fine now, I wonder if you should not use:
x = builtin('struct',x);
instead, in case the 'struct' method has been overloaded, hiding some of the parameters. That seems to be MATLAB's behaviour.

Thanks.

Guillaume <gyom>
Fri 07 Jan 2011 07:53:55 PM UTC, comment #2:

Pascal, I don't think the change you suggest is needed with the current development sources. I think you are seeing a bug in 3.2.x with looking up overloaded function names through function handles.

However, there was a problem comparing the field values for objects. I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/990c9cb52e5f

This seems to fix the problem for me, so I'm closing this report.

John W. Eaton <jwe>
Project Administrator
Fri 07 Jan 2011 10:49:28 AM UTC, comment #1:

The problems lies in _isequal_.m, line 75:

s_v = cellfun (@size, varargin, "UniformOutput", false);

The correct invocation is

s_v = cellfun (@(x) size(x), varargin, "UniformOutput", false);

John, I enclose a patch: could you please apply ?

Regards

(file #22369)

Pascal Dupuis <cdemills>
Thu 06 Jan 2011 07:04:16 PM UTC, original submission:

'isequal' does not work when called on objects:

octave> a=myclass; b=myclass;
octave> isequal(a,b)
error: find: wrong type argument `class'
error: called from:
error: octave/scripts/general/private/__isequal__.m at line 147, column 11

Correct behaviour should be comparing all property values (ie the underlying structure) - it seems to be what MATLAB does (and it doesn't even attempt apparently to call overloaded methods eq.m or ne.m event if they are defined).

Guillaume <gyom>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #22369:  __isequal__.m.pat added by cdemills (454B - image/x-coreldrawpattern)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by cdemills (Updated the item)
  • -unavailable- added by gyom (Submitted the item)
  •  

    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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 07 Jan 2011 07:53:55 PM UTCjweStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 07 Jan 2011 10:49:28 AM UTCcdemillsAttached File-=>Added _isequal_.m.pat, #22369

    Back to the top


    Powered by Savane 3.1-cleanup