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

 
 

bug #32071: isequal with objects

Submitter:  Guillaume <gyom>
Submitted:  Thu 06 Jan 2011 07:04:16 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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>
Group Member
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 Files:
   
   
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
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by cdemills (Updated the item)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2011-01-07 jwe StatusNone Fixed
        Open/ClosedOpen Closed
    2011-01-07 cdemills Attached File- Added _isequal_.m.pat, #22369

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code