[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #38128] Overloaded vercat() not called in some
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #38128] Overloaded vercat() not called in some cases |
Date: |
Sun, 20 Jan 2013 21:35:30 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0 |
URL:
<http://savannah.gnu.org/bugs/?38128>
Summary: Overloaded vercat() not called in some cases
Project: GNU Octave
Submitted by: None
Submitted on: dim. 20 janv. 2013 21:35:29 UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Julien Bect
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux
_______________________________________________________
Details:
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.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: dim. 20 janv. 2013 21:35:29 UTC Name: octaveVertcatIssue.zip Size: 2
ko By: None
<http://savannah.gnu.org/bugs/download.php?file_id=27305>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?38128>
_______________________________________________
Message posté via/par Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #38128] Overloaded vercat() not called in some cases,
anonymous <=