Quantcast

Tracking bug #38128 / Overloaded vertcat() not called in some cases

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Tracking bug #38128 / Overloaded vertcat() not called in some cases

Julien Bect
Julien Bect wrote
I have recently posted a bug report concerning an unexpected behaviour of the "old" class system (http://savannah.gnu.org/bugs/?38128).
[snip]
I have tracked the problem down to tm_const::init() in pt-mat.cc.

If x is a (scalar) object of class A and y a 3x3 matrix, then [x; y] causes an error in tm_const::init(), more precisely in dim_vector::hvcat(), because elements of size 1x1 and 3x3 cannot be concatenated vertically.

My overloaded vertcat() function for class A therefore never has a chance to be called, even though it knows how to handle this case. (Note: overloading size() for class A doesn't fix the problem.)

Anybody has an idea about what a proper fix should be ? There is a special case in tm_const::init() to handle the vertical concatenation of strings (which are allowed to have differing lengths). Perhaps should there be another special case for the situation where at least one element is an object (any_class flag) ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tracking bug #38128 / Overloaded vertcat() not called in some cases

Julien Bect
Julien Bect wrote
Julien Bect wrote
I have recently posted a bug report concerning an unexpected behaviour of the "old" class system (http://savannah.gnu.org/bugs/?38128).
[snip]
I have tracked the problem down to tm_const::init() in pt-mat.cc.

If x is a (scalar) object of class A and y a 3x3 matrix, then [x; y] causes an error in tm_const::init(), more precisely in dim_vector::hvcat(), because elements of size 1x1 and 3x3 cannot be concatenated vertically.

My overloaded vertcat() function for class A therefore never has a chance to be called, even though it knows how to handle this case. (Note: overloading size() for class A doesn't fix the problem.)

Anybody has an idea about what a proper fix should be ? There is a special case in tm_const::init() to handle the vertical concatenation of strings (which are allowed to have differing lengths). Perhaps should there be another special case for the situation where at least one element is an object (any_class flag) ?
I have uploaded a patch, which implements this idea (i.e., removes dimension consistency checking when any_class is true) :

https://savannah.gnu.org/patch/?7935

This seems to fix the vertcat/horzcat problem. Note that I haven't been able to run a full "make check", though (it segfaults when I reach the tests for dblquad.m, but this is not related to my patch).

Julien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tracking bug #38128 / Overloaded vertcat() not called in some cases

Jordi Gutiérrez Hermoso-2
On 30 January 2013 09:19, Julien Bect <[hidden email]> wrote:
> Note that I haven't been able to run a full "make check", though (it
> segfaults when I reach the tests for dblquad.m, but this is not
> related to my patch).

Is this a known problem? Should we diagnose it?

- Jordi G. H.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tracking bug #38128 / Overloaded vertcat() not called in some cases

Julien Bect
In reply to this post by Julien Bect
Julien Bect wrote
I have uploaded a patch, which implements this idea (i.e., removes dimension consistency checking when any_class is true) :

https://savannah.gnu.org/patch/?7935

This seems to fix the vertcat/horzcat problem. Note that I haven't been able to run a full "make check", though (it segfaults when I reach the tests for dblquad.m, but this is not related to my patch).
I have now been able to run a full "make check" on a fresh new build without Java interface (see: this thread). Everything seems ok.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tracking bug #38128 / Overloaded vertcat() not called in some cases

Julien Bect
Julien Bect wrote
Julien Bect wrote
I have uploaded a patch, which implements this idea (i.e., removes dimension consistency checking when any_class is true) :

https://savannah.gnu.org/patch/?7935

This seems to fix the vertcat/horzcat problem. Note that I haven't been able to run a full "make check", though (it segfaults when I reach the tests for dblquad.m, but this is not related to my patch).
I have now been able to run a full "make check" on a fresh new build without Java interface (see: this thread). Everything seems ok.
I just noticed that a few tests concerning classes and concatenation are located test/class-concat (added by JWE in Nov 2011).

In patch #7935 (https://savannah.gnu.org/patch/?7935), 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 ?

Julien.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tracking bug #38128 / Overloaded vertcat() not called in some cases

Julien Bect
Julien Bect wrote
In patch #7935 (https://savannah.gnu.org/patch/?7935) [...]
I have moved my patch to the bug tracker : https://savannah.gnu.org/bugs/?38128

Further discussion of this issue will be directly posted on the bug tracker.

Julien.
Loading...