[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51329] nth_element / median function fail wit
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional) |
Date: |
Wed, 28 Jun 2017 19:45:29 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36 |
Follow-up Comment #11, bug #51329 (project octave):
For the most part my currently patch will work, the only issue is that this
section looks at the first difference in the n.increment() call to determine
if it is ascending or descending, a range, of course, must have constant
differences so it can check them correctly however if you provide a non
constant difference it misbehaves.
2343 octave_idx_type inc = n.increment ();
2344 if (inc == 1)
2345 {
2346 mode = ASCENDING;
2347 lo = n(0);
2348 }
2349 else if (inc == -1)
2350 {
2351 mode = DESCENDING;
2352 lo = ns - 1 - n(0);
2353 }
>> nth_element([1:4], 2:2:4)
error: nth_element: n must be a scalar or a contiguous range
>> nth_element([1:4], [2,3])
ans =
2 3
>> nth_element([1:4], [3,2])
ans =
3 2
>> nth_element([1:4], [1, 2, 4])
ans =
1 2 3
I will adjust my code such that it verifies that the differences between the
elements is always either increasing by one or decreasing one.
- OP
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51329>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, (continued)
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, Carnë Draug, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, Carnë Draug, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, anonymous, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, Nicholas Jankowski, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, Avinoam Kalma, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, Nicholas Jankowski, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, Nicholas Jankowski, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, anonymous, 2017/06/28
- [Octave-bug-tracker] [bug #51329] Median fails due to nth_element in --traditional, Nicholas Jankowski, 2017/06/28
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), Mike Miller, 2017/06/28
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional),
anonymous <=
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), anonymous, 2017/06/28
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), Nicholas Jankowski, 2017/06/28
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), Mike Miller, 2017/06/28
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), Mike Miller, 2017/06/28
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), anonymous, 2017/06/29
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), anonymous, 2017/06/29
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), anonymous, 2017/06/29
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), Nicholas Jankowski, 2017/06/29
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), anonymous, 2017/06/29
- [Octave-bug-tracker] [bug #51329] nth_element / median function fail with disable_range(true) (or with --traditional), anonymous, 2017/06/29