bugGNU Octave - Bugs: bug #62395, Compatability feature request -...


bug #62395: Compatability feature request - std and var optionally return mean as 2nd output

Submitter:  Nicholas Jankowski <nrjank>
Submitted:  Mon 02 May 2022 08:43:08 PM UTC
Category:  Octave Function Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Nicholas Jankowski Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sun 15 May 2022 01:18:27 AM UTC, comment #3: 

@Nicholas: Thanks for taking care of this.  I see that your changesets are getting closer to perfection.  We have some guidelines that might be useful on the Octave Wiki at https://wiki.octave.org/Contribute.  I don't know why they are buried so deeply.

One thing I saw in the commit message is that you are using full paths to files within the source tree.  We just use the file name unless there would be confusion.  So, we write

* std.m: ....

instead of

* scripts/statistics/std.m: ....

Helpful notes for commit messages are at https://wiki.octave.org/Commit_message_guidelines.

Second, the documentation has a very specific tone and is written in the active voice and present tense.  There are guidlines for the help text at https://wiki.octave.org/Help_text_style_guide.

Instead of "The function will calculate the ..." we write "Function calculates the ...".

I made these simple changes for Octave coding conventions and then got absorbed in cleaning up/optimizing std.m and var.m.  I checked everything in here if you want to take a look (http://hg.savannah.gnu.org/hgweb/octave/rev/1bf26f913b9c).

Marking bug as Fixed and closing report.

Rik <rik5>
Group administrator
Thu 12 May 2022 05:17:08 PM UTC, comment #2: 

pushed http://hg.savannah.gnu.org/hgweb/octave/rev/5330efaf9476 adding 2nd output to both functions, including docstring, NEWS, and BIST updates to capture change. All tests pass. Marking as Ready for Test.

Nicholas Jankowski <nrjank>
Group Member
Mon 02 May 2022 09:16:01 PM UTC, comment #1: 

Confirmed.  This should be a simple modification of the m-file.  Whoever makes the change should also update the Matlab Compatibility section of etc/NEWS.8.md.

Rik <rik5>
Group administrator
Mon 02 May 2022 08:43:08 PM UTC, original submission:  

noticed that matlab std and var have beed modified in v2022a such that calling as:

[S, M] = std (...)
[V, M] = var (...)

will return the mean used to calculate the std/var (or weighted mean if weighting was requested).

since std was rewritten as wrapper to var, and var explicitly calculates and assigns mu and the weights, it shouldn't be overly complex to return it as an optional second argument in both functions.

Nicholas Jankowski <nrjank>
Group Member


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

Attach Files:

No files currently attached


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nrjank (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-26 nrjank Dependencies- bugs #55765 is dependent
    2022-05-15 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-05-12 nrjank StatusConfirmed Ready For Test
    2022-05-02 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code