From bug-octave-request at bevo dot che dot wisc dot edu Tue Nov 18 12:18:18 2003 Subject: possible bug in rank.m From: "John W. Eaton" To: Gabriele Pannocchia Cc: bug-octave at bevo dot che dot wisc dot edu Date: Tue, 18 Nov 2003 12:18:04 -0600 On 17-Nov-2003, Gabriele Pannocchia wrote: | I just downloaded and installed octave-2.1.51 (i686-pc-linux-gnu). | I ran into the following error, which may or may not be a bug. | | BUG DESCRIPTION: | octave:1> rank(eye(1)) | error: octave_base_value::array_value(): wrong type argument `bool' | error: evaluating assignment expression near line 49, column 10 | error: called from `rank' in file `/usr/share/octave/2.1.51/m/linear-algebra/rank.m' | | I seem to have the same error if I pass any vector: | octave:2> rank([1,2]) | error: octave_base_value::array_value(): wrong type argument `bool' | error: evaluating assignment expression near line 49, column 10 | error: called from `rank' in file `/usr/share/octave/2.1.51/m/linear-algebra/rank.m' | | If instead, I supply a matrix the result is correct: | octave:2> a=[1,2;1,1];rank(a) | ans = 2 | | | MACHINE & INSTALLATION DETAILS: | uname -m = i686 | uname -r = 2.4.18-4GB | uname -s = Linux | ./configure --prefix="/usr" --enable-shared --enable-lite-kernel --enable-rpath I would not recommend using --prefix=/usr for locally installed software. Please try the following patch. jwe src/ChangeLog: 2003-11-18 John W. Eaton * ov-bool.h (octave_bool::array_value, octave_bool::complex_array_value): New functions. Index: src/ov-bool.h =================================================================== RCS file: /usr/local/cvsroot/octave/src/ov-bool.h,v retrieving revision 1.21 diff -u -r1.21 ov-bool.h --- src/ov-bool.h 14 Nov 2003 19:49:56 -0000 1.21 +++ src/ov-bool.h 18 Nov 2003 18:15:31 -0000 at @ -92,11 +92,17 @@ Matrix matrix_value (bool = false) const { return Matrix (1, 1, scalar); } + NDArray array_value (bool = false) const + { return NDArray (dim_vector (1, 1), scalar); } + Complex complex_value (bool = false) const { return scalar; } ComplexMatrix complex_matrix_value (bool = false) const { return ComplexMatrix (1, 1, Complex (scalar)); } + ComplexNDArray complex_array_value (bool = false) const + { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); } + bool bool_value (void) const { return scalar; } boolMatrix bool_matrix_value (void) const ------------------------------------------------------------- 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 -------------------------------------------------------------