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

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

[Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --t


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional
Date: Wed, 28 Jun 2017 15:27:08 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #6, bug #51329 (project octave):

ok, so for disable_range: "If this option is disabled Octave will store ranges
as full matrices."

median calls nth_element in the line:


retval = sum (nth_element (x, k:k+1, dim), dim, "native") / 2;

where the k:k+1 part is the N supposedly causing the error.

so it seems --traditional would have it pass as:


nth_element (x, [k:k+1], dim), dim, "native").  


in the median(1:2) example, it would be passing:

nth_element ([1,2], [1,2], 2), 2, "native")


trying that directly also produces the error under --traditional.   seems like
an incomplete input check choking on [1,2] not looking like 1:2 within
nth_element.

I don't venture outside of m-code often, but the only line i see with that
error in Array.cc:


 2380 if (mode == UNSORTED)
 2381     {
 2382       (*current_liboctave_error_handler)
 2383         ("nth_element: n must be a scalar or a contiguous range");
 2384       return Array<T> ();
 2385     }


so, something is setting mode = UNSORTED simply because it's not a range, even
though the passed matrix is sorted ? 

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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