octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48690] basic statistics functions should retu


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #48690] basic statistics functions should return NaN on empty input
Date: Fri, 5 Aug 2016 19:45:54 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0

Follow-up Comment #2, bug #48690 (project octave):

i was peeking at this and thought it would be a quick patch. Then I saw that
median failed the boolean test. thought it may have been my edit, but reverted
to unmodified dev and still:



assert (median ([true, false]), true)

error: nth_element: wrong type argument 'bool matrix'
error: called from
    median at line 86 column 14
error: evaluating argument list element number 1
error: called from
    median at line 86 column 14
error: evaluating argument list element number 1



also, checking Matlab output, it appears Matlab 2016a has some problems with a
logical input to median:


>> median([true,false])
Undefined function 'sign' for input arguments of type 'logical'.

Error in median>meanof (line 205)
k = (sign(a) ~= sign(b)) | isinf(a) | isinf(b);

Error in median (line 125)
            y = meanof(x(half),y);

>> median([true,true,false])
ans =
     1



it appears matlab median will accept a logical array as long as there are an
odd number of values, but throw an error when it tries to do the divide by two
for an even number.

octave appears to throw an error in either case, which should be fixed. I
don't know if/how this applies to any other statistics functions. 

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48690>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]