mode returns a wrong answer for row vectors

David Bateman adb014 at gmail.com
Sun Mar 16 09:38:58 CDT 2008


Ben Abbott wrote:
> There has been some work on reconciling a similar problem for
> calculation of quantiles on the thread below.
> 
> http://www.nabble.com/Statistics-function-incorrectly-computing-median-tc14644111.html

mode already has something like that treatment.. This isn't the issue.
The problem was that I forgot to reshape the matrix t2 in mode.m if
dim!=1 whereas the later code assume it was reshaped.. You'll see that

a = floor(3*rand(5,4))
mode (a, 2)

also fails for the same reason. The attached patch should address this,
and also added a couple of additional tests.

D.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch7698
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080316/21f9c342/attachment.ksh 


More information about the Bug-octave mailing list