bugGNU Octave - Bugs: bug #38128, Overloaded vercat() not called in...

 
 

bug #38128: Overloaded vercat() not called in some cases

Submitter:  None
Submitted:  Sun 20 Jan 2013 09:35:29 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Julien Bect Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 28 Feb 2013 04:42:36 PM UTC, comment #10: 
Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Thu 28 Feb 2013 08:03:10 AM UTC, comment #9: 

Oops, sorry... here is the patch

(file #27541)

Julien Bect <jbect>
Thu 28 Feb 2013 08:02:42 AM UTC, comment #8: 

Here is a patch for the bug number in classes.tst.


Julien Bect <jbect>
Wed 27 Feb 2013 08:20:51 PM UTC, comment #7: 

I have pushed and merged your change:

http://hg.savannah.gnu.org/hgweb/octave/graph/c6b2409672e9

I noticed your commit message doesn't mention the bug number. I had to hunt around to find it. :-/

The bug number you refer to  in classes.tst (38170) also seems to be wrong and is pointing at an unrelated problem.

Can you please fix that?

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Tue 26 Feb 2013 01:45:03 PM UTC, comment #6: 

Here is a minor update of my patch (rebased and tested).

(file #27533)

Julien Bect <jbect>
Thu 21 Feb 2013 03:56:07 PM UTC, comment #5: 

I just found out that the same problem was already exhibited (although not advertised in the comments) by the example file #24630 attached to bug #35118.

Julien Bect <jbect>
Mon 11 Feb 2013 07:57:06 PM UTC, comment #4: 

Here is the same patch with test_classes.m renamed to classes.tst.


(file #27444)

Julien Bect <jbect>
Fri 08 Feb 2013 07:57:27 AM UTC, comment #3: 

A few tests concerning classes and concatenation are located test/class-concat (added by JWE in Nov 2011).

In the patch that I just posted, I have added my own tests in test/classes/test_classes.m.

Should I move my concatenation tests into test/class-concat, or rather merge the old tests from test/class-concat into test/classes/test_classes.m ?

[Note: this was originally discussed on the maintainer mailing-list, http://octave.1599824.n4.nabble.com/Tracking-bug-38128-Overloaded-vertcat-not-called-in-some-cases-td4649193.html]

Julien Bect <jbect>
Fri 08 Feb 2013 07:51:49 AM UTC, comment #2: 

The attached patch seems to fix the problem.

I have added a few tests in test/classes/test_classes.m, to check that vertical and horizontal concatenation still work in the case where nothing is overloaded.

[Note: this was initially posted on the patch tracker, see patch #7935. Mea culpa.]

(file #27422)

Julien Bect <jbect>
Sat 26 Jan 2013 01:14:17 PM UTC, comment #1: 

horzcat() is affected by the exact same problem

Julien Bect <jbect>
Sun 20 Jan 2013 09:35:29 PM UTC, original submission:  

Let us consider a class @A, with the following constructor:


function x = A(xdata)
x.data = data;
x = class(x, 'A');
end


and the following overload vertcat function:


function z = vertcat(x, y)
z = A([double(x); double(y)]);
end


The following script illustrates the problem:


xdata = rand(5, 2);  x = A(xdata);
ydata = rand(5, 2);  y = A(ydata);
z4 = [x; ydata]  % err: vertical dimensions mismatch (1x1 vs 5x2)
z5 = [xdata; y]  % err: vertical dimensions mismatch (5x2 vs 1x1)
z6 = [x; y]      % this one works


It seems that the overloaded vertcat function is only called when both arguments are class A objects.

I would expect it to be called as soon as one of the two arguments is of class A (this is what happens, for instance, with an overloaded plus() function).

The problem has been observed in Octave 3.6.2 (Ubuntu 12.10 install) and 3.6.4-rc1 (built from branch stable, revision 7ad3eea8a3af).

Attachment: test script + @A class directory.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #27533:  jbFixObjConcatProblem3.patch added by jbect (3KiB - text/x-patch)
file #27444:  jbFixObjConcatProblem2.patch added by jbect (3KiB - text/x-patch)
file #27422:  jbFixObjConcatProblem.patch added by jbect (3KiB - text/x-patch)
file #27305:  octaveVertcatIssue.zip added by None (2KiB - application/zip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by jbect (Posted a comment)
  • -email is unavailable- added by None (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-02-28 jbect Attached File- Added jbFixObjConcatProblem3Addendum.patch, #27541
    2013-02-27 jordigh StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2013-02-26 jbect Attached File- Added jbFixObjConcatProblem3.patch, #27533
    2013-02-11 jbect Attached File- Added jbFixObjConcatProblem2.patch, #27444
    2013-02-08 jordigh StatusNone Patch Submitted
    2013-02-08 jbect Attached File- Added jbFixObjConcatProblem.patch, #27422
    2013-01-20 None Attached File- Added octaveVertcatIssue.zip, #27305

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code