bugGNU Octave - Bugs: bug #65471, hist: document expected shape of...

 
 

bug #65471: hist: document expected shape of output variables

Submitter:  None
Submitted:  Sun 17 Mar 2024 09:23:31 AM UTC
   
 
Category:  Documentation Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 8.4.0
Operating System:  * Any Fixed Release:  None
Planned Release:  9.1.0
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Tue 19 Mar 2024 10:16:16 PM UTC, comment #3: 

Looks good.  Marking as Fixed and closing report.

Rik <rik5>
Group administrator
Mon 18 Mar 2024 02:47:43 AM UTC, comment #2: 

i didn't look before but confirming that the code says:


    if (arg_is_vector)
      ## Matlab compatibility requires a row vector return
      nn = freq.';
      xx = x.';


internally vector freq and x are column vectors up to this point, so they will always return row vectors. if the input is an array, each column is treated as a separate group, so the output is also an array with the same number of columns for nn and a column vector for xx.

I pushed a more thorough description of the shape of the outputs to the stable branch as
https://hg.savann ... /rev/1ba981407122
marking report as Ready for Test.

Nicholas Jankowski <nrjank>
Group Member
Sun 17 Mar 2024 10:58:37 PM UTC, comment #1: 

thanks for reporting the lack of clarity. I agree that the current hist documentation provides no indication of what the output should be.  Since the function is intended to be matlab compatible, the Matlab documentation specifies:


counts = hist(___) returns a row vector, counts, containing the number of elements in each bin.

[counts,centers] = hist(___) returns an additional row vector, centers, indicating the location of each bin center on the x-axis.


so it appears it is expected that both outputs are row vectors for vector inputs. I believe that is the current behavior, please let us know if you find an exception to this. 

Updating bug category to Documentation.

Nicholas Jankowski <nrjank>
Group Member
Sun 17 Mar 2024 09:23:31 AM UTC, original submission:  

Should hist return a row vector or a column vector or the shape of the input? The doc does not say so sometimes it causes errors:


x = 1:100; y = unique (x); z = hist (x, y); [y; z]

x = (1:100)'; y = unique (x); z = hist (x, y); [y; z]


Anonymous

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nrjank (Posted a comment)
  •  

    Votes

    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.

     

    History

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-19 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2024-03-18 nrjank Planned Release10.1.0 9.1.0
    2024-03-18 nrjank StatusConfirmed Ready For Test
        Planned ReleaseNone 10.1.0
        Summarydocument expected output form from hist hist: document expected shape of output variables
    2024-03-17 nrjank CategoryNone Documentation
        Severity3 - Normal 2 - Minor
        Item GroupUnexpected Error or Warning Documentation
        StatusNone Confirmed
        Summaryhist rules need to be more clear document expected output form from hist

    Back to the top

    Powered by Savane 3.16.
    Corresponding source code