From bug-octave-request at bevo dot che dot wisc dot edu Sat Nov 29 20:01:10 2003 Subject: Failure of mean.m on certain Nd arrays From: Quentin Spencer To: bug-octave at bevo dot che dot wisc dot edu Date: Sat, 29 Nov 2003 20:00:14 -0600 The following produces an error in version 2.1.52: octave> size(x) ans = 1 10 1000 octave> y=mean(x); error: invalid converstion of ComplexNDArray to ComplexMatrix error: evaluating postfix operator `.'' near line 91, column 10 error: evaluating assignment expression near line 91, column 7 error: evaluating if command near line 90, column 3 error: called from `mean' in file `/usr/share/octave/2.1.52/m/statistics/base/mean.m' proposed fix: ----------------- The error comes from the code that I have removed in the following patch. I may be missing something, but it appears to me that this was the original solution to the problem of singleton dimensions before Nd arrays were implemented, and I think this problem is now solved by the subsequent "need-dim" code. As a further suggestion, I think a more helpful error message for cases when a transpose is attempted on a Nd array would be along the lines of MATLAB's error message stating that such an operation is not defined for N-dimensional arrays. *** mean.m~ 2003-11-29 19:36:49.000000000 -0600 --- mean.m 2003-11-29 19:42:50.000000000 -0600 *************** *** 87,96 **** usage ("mean (x, dim, opt) or mean (x, dim, opt)"); endif - if (rows (x) == 1) - x = x.'; - endif - if (need_dim) t = find (size (x) != 1); if (isempty (t)) --- 87,92 ---- ------------------------------------------------------------- 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 -------------------------------------------------------------