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

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

[Octave-bug-tracker] [bug #59641] prctile function errors when specifyin


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #59641] prctile function errors when specifying higher order singleton dimensions
Date: Tue, 8 Dec 2020 21:13:42 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?59641>

                 Summary: prctile function errors when specifying higher order
singleton dimensions
                 Project: GNU Octave
            Submitted by: nrjank
            Submitted on: Tue 08 Dec 2020 09:13:41 PM EST
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Nicholas Jankowski
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

calling prctile along singleton dimensions should just produce output equal to
input, but Octave's implementation errors out for dimensions greater than
ndims(x).  Matlab's prctile behaves the same operating on any singleton
dimension, and there's no real reason not to do so for dim>ndims(x).

example:

Matlab 2020b:

>> prctile([1:5],[50])
ans =
     3
>> prctile([1:5],[50],2)
ans =
     3
>> prctile([1:5],[50],1)
ans =
     1     2     3     4     5
>> prctile([1:5],[50],3)
ans =
     1     2     3     4     5
>> prctile([1:5],[50],99)
ans =
     1     2     3     4     5



Octave 6.1.0:

>> prctile([1:5],[50])
ans = 3

>> prctile([1:5],[50],2)
ans = 3

>> prctile([1:5],[50],1)
ans =

    1    2    3    4    5

>> prctile(1:5,[50],3)
error: prctile: DIM must be an integer and a valid dimension
error: called from
    prctile at line 73 column 7

>> prctile(1:5,[50],99)
error: prctile: DIM must be an integer and a valid dimension
error: called from
    prctile at line 73 column 7


it does the same for array inputs as well when dim>ndims(x).

there doesn't seem to be any reason it can't work for higher dimensions other
than an arbitrary ndims check.  will play with it and see if anything else
breaks.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59641>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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