gnu-octave / statistics

The Statistics package for GNU Octave
GNU General Public License v3.0
24 stars 22 forks source link

mean/median/std/var - update author info and clean up BISTs ahead of push to core #81

Closed NRJank closed 1 year ago

NRJank commented 1 year ago
pr0m1th3as commented 1 year ago

@NRJank I spotted an incorrect assignment of omitnan = 1; in the median function in char argument processing block for the "includenan" option. Although is does not affect the existing BISTs (they all pass either way), it should be set to 0 in such case. Just make sure you push this minor change to octave core. I am not sure whether it can affect the results due to the code block in lines 313-318, but better safe than sorry.

pr0m1th3as commented 1 year ago

Just spotted and fixed another error regarding input validation of negative DIM, when DIM is a scalar. `all (vecdim) at line 227 just check for 0s. Negative values would pass this test and produce error later on at line 244 producing the following output:

>> mean (repmat ([1:20;6:25], [5 2 6 3 5]), -1)
error: szx(-1): subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
    mean at line 244 column 13

now it produces the following error:

>> mean (repmat ([1:20;6:25], [5 2 6 3 5]), -1)
error: mean: DIM must be a positive integer scalar or vector.
error: called from
    mean at line 229 column 7