From bug-octave-request at bevo dot che dot wisc dot edu Tue May 15 12:13:35 2001 Subject: Problem with transpose() in .oct-files From: "John W. Eaton" To: Stef Pillaert Cc: bug-octave at bevo dot che dot wisc dot edu Date: Tue, 15 May 2001 12:13:29 -0500 On 15-May-2001, Stef Pillaert wrote: | To: bug-octave at bevo dot che dot wisc dot edu | Cc: stef | Subject: Problem with transpose() in .oct-functions | -------- | Bug report for Octave 2.1.34 configured for i586-pc-linux-gnu. | I have compiled octave against shared atlas libraries (both atlas & altered | lapack) | | Description: | ----------- | I have the following .cc function, where I would expect the two results | (alpha & beta) to be the same: | ===================================== | #include | DEFUN_DLD (testfunction,args,nargout, | " usage:not much") | { | Matrix alpha = args(0).matrix_value(); | Matrix beta=alpha.transpose(); | alpha=alpha.transpose(); | octave_value_list retval; | retval(1)=beta; | retval(0)=alpha; | return retval; | } | ===================================== | After compiling it ('mkoctfile'), I get the following: | ===================================== | octave:1> a=[1 2 3 4] | a = | | 1 2 3 4 | | octave:2> [b,c]=testfunction (a) | b = | | 1 2 3 4 | | c = | | 1 | 2 | 3 | 4 Please try the following patch. Thanks, jwe 2001-05-15 John W. Eaton * Array2.h (Array2::operator = (const Array2&)): Don't check for rep != a.rep. Index: Array2.h =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/Array2.h,v retrieving revision 1.18 diff -u -r1.18 Array2.h --- Array2.h 2000/05/11 19:07:57 1.18 +++ Array2.h 2001/05/15 17:11:00 at @ -103,7 +103,7 @@ Array2& operator = (const Array2& a) { - if (this != &a && rep != a.rep) + if (this != &a) { Array::operator = (a); d1 = a.d1; ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------