bugGNU Octave - Bugs: bug #44498, isvector: Always returns true for...

 
 

bug #44498: isvector: Always returns true for objects from user defined classes

Submitter:  Oliver Heimlich <oheim>
Submitted:  Tue 10 Mar 2015 06:58:06 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  siko1056
Originator Name:  Oliver Heimlich Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 04 Oct 2018 10:37:14 PM UTC, comment #7: 

Finally, I pushed a modified version of the patches supplied to default including some note in the NEWS file:
https://hg.savannah.gnu.org/hgweb/octave/rev/ba937c3dce82

Closing this report.

Kai Torben Ohlhus <siko1056>
Group Member
Wed 18 May 2016 12:56:38 PM UTC, comment #6: 

A patch that solves this issues has been proposed in bug report #43925 and is currently waiting to be reviewed.

Julien Bect <jbect>
Fri 12 Feb 2016 01:27:20 PM UTC, comment #5: 

See bug #43925 for work in progress on this issue.

Julien Bect <jbect>
Sat 30 Jan 2016 02:22:32 AM UTC, comment #4: 

It is easy to replace dims() by size() in Fisvector -- see attached patch.

The wrinkle is that size() is not const, and so a copy has to be made.  That should be a shallow copy, shouldn't it?  If not, we should probably check that size has actually been overloaded and use dims() if not.

(file #36204)

Lachlan Andrew <lachlan>
Tue 26 Jan 2016 05:30:58 AM UTC, comment #3: 

Yes, option 2 should be the right one. The patch for bug #44334 has introduced some xtests regarding this regression. The xtests have been verified for Matlab compatibility.

To summarize the discussion from bug #44334: The user defined class needs to override size and numel. Then other functions should respect this.


Anonymous
Tue 26 Jan 2016 05:02:33 AM UTC, comment #2: 

I'm happy to try to produce a fix if someone confirms that option 2 is the one to go with.  jwe, I think it is your call.

Lachlan Andrew <lachlan>
Tue 02 Jun 2015 04:35:44 PM UTC, comment #1: 

Retagging release from 4.0.0-rc1 to 4.0.0.

John W. Eaton <jwe>
Group administrator
Tue 10 Mar 2015 06:58:06 AM UTC, original submission:  

The function isvector always returns true for user defined objects (whose builtin size is [1 1]). However, the user defined class may have overridden the size method.

See bug #43925 for a similar regression with isscalar and bug #44334 for a similar regression with iseuqal. In GNU Octave 3.8.2 the overriden size had been respected by isscalar, isvector, and isequal.

What is the desired behaviour?
1) A user-defined class must override all methods together to get a consistent behaviour: size, isvector, isscalar, and isequal. Any builtin functions will assume that the object's size is always [1 1].
2) A user-defined class must override size only. The builtin functions will respect the overriden size method and produce a consistent behaviour for the user (like they did in version 3.8.2).

Oliver Heimlich <oheim>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #36204:  bug_44498.cset added by lachlan (908B - application/octet-stream)

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by jbect (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by oheim (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-04 siko1056 StatusNone Fixed
        Assigned toNone siko1056
        Open/ClosedOpen Closed
        Release4.0.0 dev
    2018-10-02 siko1056 Dependencies- bugs #51308 is dependent
    2017-02-23 siko1056 Dependencies- Depends on bugs #43925
    2016-07-12 mtmiller Dependencies- bugs #48487 is dependent
    2016-01-30 lachlan Attached File- Added bug_44498.cset, #36204
    2015-06-02 jwe Release4.0.0-rc1 4.0.0

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code