bugGNU Octave - Bugs: bug #54421, Quantile output transposed with...

 
 

bug #54421: Quantile output transposed with respect to Matlab

Submitter:  Arnaud Delorme <arnodelorme>
Submitted:  Wed 01 Aug 2018 05:46:45 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 02 Aug 2018 11:29:47 PM UTC, comment #6: 

Okay, thanks for the testing.  I pushed a changeset to the development branch that has quantile follow the shape of the second input rather than the first (https://hg.savannah.gnu.org/hgweb/octave/rev/d3aa89a5b152).

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Thu 02 Aug 2018 09:14:08 PM UTC, comment #5: 

Using Matlab 2018a

q = quantile ([1:10], 0.5, 1)
q = quantile ([1:10]', 0.5, 2)
q = quantile ([1:10], [0.25, 0.75]')

q =

     1     2     3     4     5     6     7     8     9    10


q =

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10


q =

     3
     8

Arnaud Delorme <arnodelorme>
Thu 02 Aug 2018 07:47:07 PM UTC, comment #4: 

Does Matlab follow the input data if pc is a scalar rather than a vector?  Can someone try these three tests and upload the results.


q = quantile ([1:10], 0.5, 1)
q = quantile ([1:10]', 0.5, 2)
q = quantile ([1:10], [0.25, 0.75]')



Rik <rik5>
Group administrator
Thu 02 Aug 2018 12:11:20 PM UTC, comment #3: 

Orientation in Matlab is given by the vector pc.

Marco Caliari <caliari>
Group Member
Wed 01 Aug 2018 06:20:57 PM UTC, comment #2: 

At least Octave is consistent.  The output is following the input data.


octave:10> q = quantile(data,pc)
q =

    1.0000
    1.0000
    1.5000
    3.5000
    7.5000
   10.0000
   10.0000

octave:11> q = quantile(data',pc)
q =

    1.0000    1.0000    1.5000    3.5000    7.5000   10.0000   10.0000



Rik <rik5>
Group administrator
Wed 01 Aug 2018 06:17:31 PM UTC, comment #1: 

What happens if you transpose the vector pc?  Is the output a column vector?  I'm trying to figure out if Matlab copies the orientation of the pc vector to the output or whether it always returns a row vector.

Rik <rik5>
Group administrator
Wed 01 Aug 2018 05:46:45 PM UTC, original submission:  

data = [1; 2; 5; 10];
pc = [0 0.125 0.25 0.5 0.75 0.875 1];
q = quantile(data,pc)

q =

    1.0000    1.0000    1.5000    3.5000    7.5000   10.0000   10.0000

Under Matlab 2018a and

q =

   1.0e+01*

   0.10000
   0.10000
   0.15000
   0.35000
   0.75000
   1.00000
   1.00000

under Octave 4.4.0 (the output is transposed). This cause my unit test to fail.

Arnaud Delorme <arnodelorme>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by arnodelorme (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-02 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
        Release4.4.0 dev
    2018-08-02 rik5 Operating SystemMac OS Any
    2018-08-01 rik5 SummaryQuantile function difference with Matlab Quantile output transposed with respect to Matlab
    2018-08-01 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code