Hello community,

here is the log from the commit of package octave-forge-statistics for 
openSUSE:Factory checked in at 2020-06-11 14:48:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-statistics (Old)
 and      /work/SRC/openSUSE:Factory/.octave-forge-statistics.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "octave-forge-statistics"

Thu Jun 11 14:48:25 2020 rev:5 rq:801791 version:1.4.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/octave-forge-statistics/octave-forge-statistics.changes
  2019-07-08 15:10:53.439337352 +0200
+++ 
/work/SRC/openSUSE:Factory/.octave-forge-statistics.new.3606/octave-forge-statistics.changes
        2020-06-11 14:48:51.170115815 +0200
@@ -1,0 +2,18 @@
+Thu May  7 18:01:05 UTC 2020 - Stefan BrĂ¼ns <[email protected]>
+
+- Update to version 1.4.2:
+  * canoncorr: allow more variables than observations
+  * fitgmdist: return fitgmdist parameters (Bug #57917)
+  * gamfit: invert parameter per docs (Bug #57849)
+  * geoXXX: update docs 'number of failures (X-1)' =>
+    'number of failures (X)' (Bug #57606)
+  * kolmogorov_smirnov_test.m: update function handle usage from
+    octave6+ (Bug #57351)
+  * linkage.m: fix octave6+ parse error (Bug #57348)
+  * unifrnd: changed unifrnd(a,a) to return a 0 rather than
+    NaN (Bug #56342)
+  * updates for usage of deprecated octave functions
+- Drop obsolete
+  octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
+
+-------------------------------------------------------------------

Old:
----
  octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
  statistics-1.4.1.tar.gz

New:
----
  statistics-1.4.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ octave-forge-statistics.spec ++++++
--- /var/tmp/diff_new_pack.2czvjZ/_old  2020-06-11 14:48:52.738120848 +0200
+++ /var/tmp/diff_new_pack.2czvjZ/_new  2020-06-11 14:48:52.742120860 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package octave-forge-statistics
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,15 +18,13 @@
 
 %define octpkg  statistics
 Name:           octave-forge-%{octpkg}
-Version:        1.4.1
+Version:        1.4.2
 Release:        0
 Summary:        Additional statistics functions for Octave
 License:        GPL-3.0-or-later AND SUSE-Public-Domain
 Group:          Productivity/Scientific/Math
-Url:            http://octave.sourceforge.net
-Source0:        
http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM 
octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch 
https://savannah.gnu.org/bugs/?func=detailitem&item_id=50365 
[email protected] -- fix bug #50365. Update distances and classes to best 
replica
-Patch0:         
octave-bug-50365-Wrong-distance-results-from-kmeans-and-wrong-centers.patch
+URL:            https://octave.sourceforge.io
+Source0:        
https://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
 BuildArch:      noarch
 BuildRequires:  octave-devel
 Requires:       octave-cli >= 4.0.0
@@ -39,7 +37,6 @@
 %prep
 %setup -q -c %{name}-%{version}
 %octave_pkg_src
-%patch0 -p1
 
 %build
 %octave_pkg_build
@@ -57,7 +54,6 @@
 %octave --eval "pkg rebuild"
 
 %files
-%defattr(-,root,root)
 %{octpackages_dir}/%{octpkg}-%{version}
 
 %changelog

++++++ statistics-1.4.1.tar.gz -> statistics-1.4.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/DESCRIPTION 
new/statistics-1.4.2/DESCRIPTION
--- old/statistics-1.4.1/DESCRIPTION    2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/DESCRIPTION    2020-03-23 18:58:16.000000000 +0100
@@ -1,6 +1,6 @@
 Name: statistics
-Version: 1.4.1
-Date: 2019-03-17
+Version: 1.4.2
+Date: 2020-03-23
 Author: various authors
 Maintainer: Octave-Forge community <[email protected]>
 Title: Statistics
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/Makefile 
new/statistics-1.4.2/Makefile
--- old/statistics-1.4.1/Makefile       2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/Makefile       2020-03-23 18:58:16.000000000 +0100
@@ -58,6 +58,13 @@
 release_dir_dep := .git/index
 endif
 
+HG           := hg
+HG_CMD        = $(HG) --config alias.$(1)=$(1) --config defaults.$(1)= $(1)
+HG_ID        := $(shell $(call HG_CMD,identify) --id | sed -e 's/+//' )
+HG_TIMESTAMP := $(firstword $(shell $(call HG_CMD,log) --rev $(HG_ID) 
--template '{date|hgdate}'))
+
+TAR_REPRODUCIBLE_OPTIONS := --sort=name --mtime="@$(HG_TIMESTAMP)" --owner=0 
--group=0 --numeric-owner
+TAR_OPTIONS  := --format=ustar $(TAR_REPRODUCIBLE_OPTIONS)
 
 ## .PHONY indicates targets that are not filenames
 ## (https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html)
@@ -96,7 +103,7 @@
 
 ## An implicit rule with a recipe to build the tarballs correctly.
 %.tar.gz: %
-       $(TAR) -c -f - --posix -C "$(target_dir)/" "$(notdir $<)" | gzip -9n > 
"$@"
+       $(TAR) -cf - $(TAR_OPTIONS) -C "$(target_dir)/" "$(notdir $<)" | gzip 
-9n > "$@"
 
 clean-tarballs:
        @echo "## Cleaning release tarballs (package + html)..."
@@ -241,7 +248,7 @@
 
 clean: clean-tarballs clean-unpacked-release clean-install clean-check
        @echo "## Removing target directory (if empty)..."
-       -rmdir $(target_dir)
+       test -e $(target_dir) && rmdir $(target_dir) || true
        @echo
        @echo "## Cleaning done"
        @echo
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/NEWS new/statistics-1.4.2/NEWS
--- old/statistics-1.4.1/NEWS   2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/NEWS   2020-03-23 18:58:16.000000000 +0100
@@ -1,3 +1,22 @@
+Summary of important user-visible changes for statistics 1.4.2:
+-------------------------------------------------------------------
+
+ ** canoncorr: allow more variables than observations
+
+ ** fitgmdist: return fitgmdist parameters (Bug #57917)
+
+ ** gamfit: invert parameter per docs (Bug #57849)
+
+ ** geoXXX: update docs 'number of failures (X-1)' => 'number of failures (X)' 
(Bug #57606)
+
+ ** kolmogorov_smirnov_test.m: update function handle usage from octave6+ (Bug 
#57351)
+
+ ** linkage.m: fix octave6+ parse error (Bug #57348)
+
+ ** unifrnd: changed unifrnd(a,a) to return a 0 rather than NaN (Bug #56342)
+
+ ** updates for usage of depreciated octave functions
+
 Summary of important user-visible changes for statistics 1.4.1:
 -------------------------------------------------------------------
  ** update install scripts for octave 5.0 depreciated functions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/inst/canoncorr.m 
new/statistics-1.4.2/inst/canoncorr.m
--- old/statistics-1.4.1/inst/canoncorr.m       2019-03-17 14:45:17.000000000 
+0100
+++ new/statistics-1.4.2/inst/canoncorr.m       2020-03-23 18:58:16.000000000 
+0100
@@ -4,7 +4,7 @@
 ## @deftypefn {Function File} {[@var{A} @var{B} @var{r} @var{U} @var{V}] =} 
canoncorr (@var{X}, @var{Y})
 ## Canonical correlation analysis
 ##
-## Given @var{X} (size @var{k}*@var{m}) and @var{Y} (@var{k}*@var{n}), returns 
projection matrices of canonical coefficients @var{A} (size @var{m}*@var{d}, 
where @var{d}=@code{min}(@var{m}, @var{n})) and @var{B} (size @var{m}*@var{d}); 
the canonical correlations @var{r} (1*@var{d}, arranged in decreasing order); 
the canonical variables @var{U}, @var{V} (both @var{k}*@var{d}, with 
orthonormal columns); and @var{stats}, a structure containing results from 
Bartlett's chi-square and Rao's F tests of significance.
+## Given @var{X} (size @var{k}*@var{m}) and @var{Y} (@var{k}*@var{n}), returns 
projection matrices of canonical coefficients @var{A} (size @var{m}*@var{d}, 
where @var{d} is the smallest of @var{m}, @var{n}, @var{d}) and @var{B} (size 
@var{m}*@var{d}); the canonical correlations @var{r} (1*@var{d}, arranged in 
decreasing order); the canonical variables @var{U}, @var{V} (both 
@var{k}*@var{d}, with orthonormal columns); and @var{stats}, a structure 
containing results from Bartlett's chi-square and Rao's F tests of significance.
 ##
 ## References: @*
 ##   William H. Press (2011), Canonical Correlation Clarified by Singular 
Value Decomposition, http://numerical.recipes/whp/notes/CanonCorrBySVD.pdf @*
@@ -13,7 +13,7 @@
 ## @seealso{princomp}
 ## @end deftypefn
 
-#      Copyright (C) 2016 by Nir Krakauer <[email protected]>
+#      Copyright (C) 2016-2019 by Nir Krakauer <[email protected]>
 
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@
 k = size (X, 1); #should also be size (Y, 1)
 m = size (X, 2);
 n = size (Y, 2);
-d = min (m, n);
+d = min ([k m n]);
 
 X = center (X);
 Y = center (Y);
@@ -40,7 +40,7 @@
 [Qx Rx] = qr (X, 0);
 [Qy Ry] = qr (Y, 0);
 
-[U S V] = svd (Qx' * Qy, 0);
+[U S V] = svd (Qx' * Qy, "econ");
 
 A = Rx \ U(:, 1:d);
 B = Ry \ V(:, 1:d);
@@ -90,4 +90,5 @@
 %!assert (V, center(Y) * B, 10*eps);
 %!assert (cov(U), eye(size(U, 2)), 10*eps);
 %!assert (cov(V), eye(size(V, 2)), 10*eps);
-
+%! rand ("state", 1); [A,B,r] = canoncorr (rand(5, 10),rand(5, 20));
+%!assert (r, ones(1, 5), 10*eps);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/inst/fitgmdist.m 
new/statistics-1.4.2/inst/fitgmdist.m
--- old/statistics-1.4.1/inst/fitgmdist.m       2019-03-17 14:45:17.000000000 
+0100
+++ new/statistics-1.4.2/inst/fitgmdist.m       2020-03-23 18:58:16.000000000 
+0100
@@ -499,19 +499,20 @@
   endif
   params = params*size (Sigma, 3) + 2*rows (mu) - 1;
 
-  extra.NegativeLogLikelihood = -best;
-  extra.AIC = -2*(best - params);
-  extra.BIC = -2*best + params * log (raw_samples);
-  extra.Converged = (incr <= TolFun);
-  extra.NumIterations = iter-1;
-  extra.RegularizationValue = Regularizer;
-
   # This works in Octave, but not in Matlab
   #obj = gmdistribution (best_params.mu, best_params.Sigma, best_params.p', 
extra);
   obj = gmdistribution (best_params.mu, best_params.Sigma, best_params.p');
+
+  obj.NegativeLogLikelihood = -best;
+  obj.AIC = -2*(best - params);
+  obj.BIC = -2*best + params * log (raw_samples);
+  obj.Converged = (incr <= TolFun);
+  obj.NumIterations = iter-1;
+  obj.RegularizationValue = Regularizer;
+
   if (Display == 1)
     fprintf ("  %d iterations   log-likelihood = %g\n", ...
-              extra.NumIterations, -extra.NegativeLogLikelihood);
+              obj.NumIterations, -obj.NegativeLogLikelihood);
   endif
 endfunction
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/inst/gamfit.m 
new/statistics-1.4.2/inst/gamfit.m
--- old/statistics-1.4.1/inst/gamfit.m  2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/inst/gamfit.m  2020-03-23 18:58:16.000000000 +0100
@@ -1,11 +1,10 @@
-## Author: Martijn van Oosterhout <[email protected]>
-## This program is granted to the public domain.
+
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {@var{MLE} =} gamfit (@var{data})
 ## Calculate gamma distribution parameters.
 ##
-## Find the maximum likelihood estimators (@var{mle}s) of the Gamma 
distribution
+## Find the maximum likelihood estimate parameters of the Gamma distribution
 ## of @var{data}.  @var{MLE} is a two element vector with shape parameter
 ## @var{A} and scale @var{B}.
 ##
@@ -13,16 +12,29 @@
 ## @end deftypefn
 
 ## This function works by minimizing the value of gamlike for the vector R.
-## Just about any minimization function will work, all it has to do a
+## Just about any minimization function will work, all it has to do is
 ## minimize for one variable. Although the gamma distribution has two
 ## parameters, their product is the mean of the data. so a helper function
 ## for the search takes one parameter, calculates the other and then returns
 ## the value of gamlike.
 
-## FIXME is this still true???
-## Note: Octave uses the inverse scale parameter, which is the opposite of
-## Matlab. To work for Matlab, value of b needs to be inverted in a few
-## places (marked with **)
+## Author: Martijn van Oosterhout <[email protected]>
+## This program is granted to the public domain.
+#       Revisions copyright (C) 2019 by Nir Krakauer <[email protected]> 
under GPL (below).
+
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; If not, see <http://www.gnu.org/licenses/>.
+
 
 function res = gamfit(R)
 
@@ -32,19 +44,26 @@
 
   avg = mean(R);
 
-  # This can be just about any search function. I choose this because it
-  # seemed to be the only one that might work in this situaition...
-  a=nmsmax( @gamfit_search, 1, [], [], avg, R );
+  # Optimize with respect to log(a), since both a and b must be positive
+  x = fminsearch( @(x) gamfit_search(x, avg, R), 0 );
+  a = exp(x);
 
-  b=a/avg;      # **
+  b = avg/a;
 
-  res=[a 1/b];
+  res = [a b];
 endfunction
 
-# Helper function so we only have to minimize for one variable. Also to
-# inverting the output of gamlike, incase the optimisation function wants to
-# maximize rather than minimize.
-function res = gamfit_search( a, avg, R )
-  b=a/avg;      # **
-  res = -gamlike([a 1/b], R);
+# Helper function so we only have to minimize for one variable.
+function res = gamfit_search( x, avg, R )
+  a = exp(x);
+  b = avg/a;
+  res = gamlike([a b], R);
 endfunction
+
+
+#example data from 
https://www.real-statistics.com/distribution-fitting/distribution-fitting-via-maximum-likelihood/fitting-gamma-parameters-mle/
+%!shared v, res
+%! v = [1.2 1.6 1.7 1.8 1.9 2.0 2.2 2.6 3.0 3.5 4.0 4.8 5.6 6.6 7.6];
+%! res = gamfit(v);
+%!assert (res(1), 3.425, 1E-3);
+%!assert (res(2), 0.975, 1E-3);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/inst/kmeans.m 
new/statistics-1.4.2/inst/kmeans.m
--- old/statistics-1.4.1/inst/kmeans.m  2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/inst/kmeans.m  2020-03-23 18:58:16.000000000 +0100
@@ -143,9 +143,9 @@
   replicates_set_explicitly = false;
 
   ## Remove rows containing NaN / NA, but record which rows are used
-  data_idx = ! any (isnan (data), 2);
+  data_idx      = ! any (isnan (data), 2);
   original_rows = rows (data);
-  data = data(data_idx,:);
+  data          = data(data_idx,:);
 
   #used for getting the number of samples
   n_rows = rows (data);
@@ -236,11 +236,14 @@
       if (isempty (k))
         k = rows (start);
       elseif (rows (start) != k)
-        error ("kmeans: Number of initializers (%d) should match number of 
centroids (%d)", rows (start), k);
+        error (["kmeans: Number of initializers (%d) " ...
+                "should match number of centroids (%d)"], rows (start), k);
       endif
       if (replicates_set_explicitly)
         if (replicates != size (start, 3))
-           error ("kmeans: The third dimension of the initializer (%d) should 
match the number of replicates (%d)", size (start, 3), replicates);
+           error (["kmeans: The third dimension of the initializer (%d) " ...
+                   "should match the number of replicates (%d)"], ...
+                   size (start, 3), replicates);
         endif
       else
         replicates = size (start, 3);
@@ -251,32 +254,32 @@
   ## dist  returns the distance btwn each row of matrix x and a row vector c
   switch (lower (distance))
     case "sqeuclidean"
-      dist = @(x, c) (sumsq (bsxfun (@minus, x, c), 2));
-      centroid  = @(x) (mean (x,1));
+      dist     = @(x, c) sumsq (bsxfun (@minus, x, c), 2);
+      centroid = @(x) mean (x, 1);
     case "cityblock"
-      dist = @(x, c) (sum (abs (bsxfun (@minus, x, c)), 2));
-      centroid  = @(x) (median (x,1));
+      dist     = @(x, c) sum (abs (bsxfun (@minus, x, c)), 2);
+      centroid = @(x) median (x, 1);
     case "cosine"
         ## Pre-normalize all data.
         ## (when Octave implements normr, will use  data = normr (data) )
       for i = 1:rows (data)
         data(i,:) = data(i,:) / sqrt (sumsq (data(i,:)));
       endfor
-      dist = @(x, c) (1 - (x * c') ./ sqrt (sumsq (c)));
-      centroid = @(x) (mean (x,1));   ## already normalized
+      dist     = @(x, c) 1 - (x * c') ./ sqrt (sumsq (c));
+      centroid = @(x) mean (x, 1);   ## already normalized
     case "correlation"
-        ## Pre-normalize all data.
+      ## Pre-normalize all data.
       data = data - mean (data, 2);
-        ## (when Octave implements normr, will use  data = normr (data) )
+      ## (when Octave implements normr, will use  data = normr (data) )
       for i = 1:rows (data)
         data(i,:) = data(i,:) / sqrt (sumsq (data(i,:)));
       endfor
-
-      dist = @(x, c) (1 - (x * (c-mean (c))') ./ sqrt (sumsq (c-mean (c))));
-      centroid  = @(x) (mean (x,1));   ## already normalized
+      dist     = @(x, c) 1 - (x * (c - mean (c))') ...
+                          ./ sqrt (sumsq (c - mean (c)));
+      centroid = @(x) mean (x, 1);   ## already normalized
     case "hamming"
-      dist = @(x, c) (sum (bsxfun (@ne, x, c), 2));
-      centroid  = @(x) (median (x,1));
+      dist     = @(x, c) sum (bsxfun (@ne, x, c), 2);
+      centroid = @(x) median (x, 1);
     otherwise
       error ("kmeans: unsupported distance parameter %s", distance);
   endswitch
@@ -285,7 +288,6 @@
   ########################################
 
   ## Now that  k  has been set (possibly by 'replicates' option), check/use it.
-
   if (! isscalar (k))
     error ("kmeans: second input argument must be a scalar");
   endif
@@ -293,27 +295,27 @@
   ## used to hold the distances from each sample to each class
   D = zeros (n_rows, k);
 
-  best = Inf;
+  best         = Inf;
   best_centers = [];
   for rep = 1:replicates
     ## check for the 'start' property
     switch (lower (start))
       case "sample"
-        idx = randperm (n_rows, k);
+        idx     = randperm (n_rows, k);
         centers = data(idx, :);
       case "plus"                  # k-means++, by Arthur and Vassilios(?)
         centers(1,:) = data(randi (n_rows),:);
-       d = inf (n_rows, 1);       # Distance to nearest centroid so far
-       for i = 2:k
-         d = min (d, dist (data, centers(i-1, :)));
-         centers(i,:) = data(find (cumsum (d) > rand * sum (d), 1), :);
-       endfor
+        d            = inf (n_rows, 1);    # Distance to nearest centroid so 
far
+        for i = 2:k
+          d            = min (d, dist (data, centers(i - 1, :)));
+          centers(i,:) = data(find (cumsum (d) > rand * sum (d), 1), :);
+        endfor
       case "cluster"
-        idx = randperm (n_rows, max (k, ceil (n_rows/10)));
-        [~, centers] = kmeans (data(idx,:), k, "start", "sample",
+        idx          = randperm (n_rows, max (k, ceil (n_rows / 10)));
+        [~, centers] = kmeans (data(idx,:), k, "start", "sample", ...
                                "distance", distance);
       case "uniform"
-       # vectorised 'min_data + range .* rand'
+        # vectorised 'min_data + range .* rand'
         centers = bsxfun (@plus, min_data,
                           bsxfun (@times, range, rand (k, columns (data))));
       otherwise
@@ -323,13 +325,9 @@
     ## Run the algorithm
     iter = 1;
 
-        ## Classify once before the loop; to set sumd, and  if  max_iter == 0
+    ## Classify once before the loop; to set sumd, and  if  max_iter == 0
     ## Compute distances and classify
-    for i = 1:k
-      D (:, i) = dist (data, centers(i, :));
-    endfor
-    [~, classes] = min (D, [], 2);
-    sumd = obj_cost (D, classes);
+    [D, classes, sumd] = update_dist (data, centers, D, k, dist);
 
     while (err > 0.001 && iter++ <= max_iter)
       ## Calculate new centroids
@@ -345,18 +343,18 @@
             ## farthest from any centroid (and not replacing an empty cluster
             ## from earlier in this pass) and add it to the empty cluster
             case 'singleton'
-             available = setdiff(1:n_rows, replaced_centroids);
-             [~, idx] = max (min (D(available,:)'));
-             idx = available(idx);
+             available          = setdiff (1:n_rows, replaced_centroids);
+             [~, idx]           = max (min (D(available,:)'));
+             idx                = available(idx);
              replaced_centroids = [replaced_centroids, idx];
 
-             classes(idx) = i;
-             membership(idx)=1;
+             classes(idx)    = i;
+             membership(idx) = 1;
 
            ## if 'drop' then set C and D to NA
            case 'drop'
             centers(i,:) = NA;
-            D(i,:) = NA;
+            D(i,:)       = NA;
 
            ## if 'error' then throw the error
             otherwise
@@ -370,16 +368,9 @@
         endif
       endfor
 
-      ## Compute distances
-      for i = 1:k
-        D (:, i) = dist (data, centers(i, :));
-      endfor
-
-      ## Classify
-      [~, classes] = min (D, [], 2);
-
+      ## Compute distances, classes and sums
+      [D, classes, new_sumd] = update_dist (data, centers, D, k, dist);
       ## calculate the difference in the sum of distances
-      new_sumd = obj_cost (D, classes);
       err  = sum (sumd - new_sumd);
       ## update the current sum of distances
       sumd = new_sumd;
@@ -390,22 +381,30 @@
     endif
   endfor
   centers = best_centers;
-  sumd = best';
+  ## Compute final distances, classes and sums
+  [D, classes, sumd] = update_dist (data, centers, D, k, dist);
 
-  final_classes = NA (original_rows,1);
-  final_classes(data_idx) = classes;        ## other positions already NaN / NA
-  classes = final_classes;
-endfunction
+  ## Return with equal size as inputs
+  if (original_rows != rows (data))
+    final           = NA (original_rows,1);
+    final(data_idx) = classes;        ## other positions already NaN / NA
+    classes         = final;
+  endif
 
-## calculate the sum of within-class distances
-function obj = obj_cost (D, classes)
-  obj = zeros (1,columns (D));
-  for i = 1:columns (D)
-    idx = (classes == i);
-    obj(i) = sum (D(idx,i));
-  end
 endfunction
 
+## Update distances, classes and sums
+function [D, classes, sumd] = update_dist (data, centers, D, k, dist)
+    for i = 1:k
+      D (:, i) = dist (data, centers(i, :));
+    endfor
+    [~, classes] = min (D, [], 2);
+    ## calculate the sum of within-class distances
+    sumd = zeros (k, 1);
+    for i = 1:k
+      sumd(i) = sum (D(classes == i,i));
+    endfor
+endfunction
 ## Test input parsing
 %!error kmeans (rand (3,2), 4);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/inst/linkage.m 
new/statistics-1.4.2/inst/linkage.m
--- old/statistics-1.4.1/inst/linkage.m 2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/inst/linkage.m 2020-03-23 18:58:16.000000000 +0100
@@ -107,7 +107,7 @@
             "centroid"; "median"; "ward" },
    "distfunc", {(@(x) min(x))                                # single
                 (@(x) max(x))                                # complete
-                (@(x,i,j,w) sum(diag(q=w([i,j]))*x)/sum(q))  # average
+                (@(x,i,j,w) sum(diag(w([i,j]))*x)/sum(w([i,j])))  # average
                 (@(x) mean(x))                               # weighted
                 (@massdist)                                  # centroid
                 (@(x,i) massdist(x,i))                       # median
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/statistics-1.4.1/install-conditionally/distributions/geocdf.m 
new/statistics-1.4.2/install-conditionally/distributions/geocdf.m
--- old/statistics-1.4.1/install-conditionally/distributions/geocdf.m   
2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/install-conditionally/distributions/geocdf.m   
2020-03-23 18:58:16.000000000 +0100
@@ -20,8 +20,8 @@
 ## For each element of @var{x}, compute the cumulative distribution function
 ## (CDF) at @var{x} of the geometric distribution with parameter @var{p}.
 ##
-## The geometric distribution models the number of failures (@var{x}-1) of a
-## Bernoulli trial with probability @var{p} before the first success (@var{x}).
+## The geometric distribution models the number of failures (@var{x}) of a
+## Bernoulli trial with probability @var{p} before the first success.
 ## @end deftypefn
 
 ## Author: KH <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/statistics-1.4.1/install-conditionally/distributions/geoinv.m 
new/statistics-1.4.2/install-conditionally/distributions/geoinv.m
--- old/statistics-1.4.1/install-conditionally/distributions/geoinv.m   
2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/install-conditionally/distributions/geoinv.m   
2020-03-23 18:58:16.000000000 +0100
@@ -20,8 +20,8 @@
 ## For each element of @var{x}, compute the quantile (the inverse of the CDF)
 ## at @var{x} of the geometric distribution with parameter @var{p}.
 ##
-## The geometric distribution models the number of failures (@var{x}-1) of a
-## Bernoulli trial with probability @var{p} before the first success (@var{x}).
+## The geometric distribution models the number of failures (@var{x}) of a
+## Bernoulli trial with probability @var{p} before the first success.
 ## @end deftypefn
 
 ## Author: KH <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/statistics-1.4.1/install-conditionally/distributions/geopdf.m 
new/statistics-1.4.2/install-conditionally/distributions/geopdf.m
--- old/statistics-1.4.1/install-conditionally/distributions/geopdf.m   
2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/install-conditionally/distributions/geopdf.m   
2020-03-23 18:58:16.000000000 +0100
@@ -20,8 +20,8 @@
 ## For each element of @var{x}, compute the probability density function (PDF)
 ## at @var{x} of the geometric distribution with parameter @var{p}.
 ##
-## The geometric distribution models the number of failures (@var{x}-1) of a
-## Bernoulli trial with probability @var{p} before the first success (@var{x}).
+## The geometric distribution models the number of failures (@var{x}) of a
+## Bernoulli trial with probability @var{p} before the first success.
 ## @end deftypefn
 
 ## Author: KH <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/statistics-1.4.1/install-conditionally/distributions/geornd.m 
new/statistics-1.4.2/install-conditionally/distributions/geornd.m
--- old/statistics-1.4.1/install-conditionally/distributions/geornd.m   
2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/install-conditionally/distributions/geornd.m   
2020-03-23 18:58:16.000000000 +0100
@@ -32,8 +32,8 @@
 ## If no size arguments are given then the result matrix is the size of
 ## @var{p}.
 ##
-## The geometric distribution models the number of failures (@var{x}-1) of a
-## Bernoulli trial with probability @var{p} before the first success (@var{x}).
+## The geometric distribution models the number of failures (@var{x}) of a
+## Bernoulli trial with probability @var{p} before the first success.
 ## @end deftypefn
 
 ## Author: KH <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/statistics-1.4.1/install-conditionally/distributions/unifrnd.m 
new/statistics-1.4.2/install-conditionally/distributions/unifrnd.m
--- old/statistics-1.4.1/install-conditionally/distributions/unifrnd.m  
2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/install-conditionally/distributions/unifrnd.m  
2020-03-23 18:58:16.000000000 +0100
@@ -1,5 +1,6 @@
 ## Copyright (C) 2012 Rik Wehbring
 ## Copyright (C) 1995-2016 Kurt Hornik
+## Copyright (C) 2019 Anthony Morast
 ##
 ## This program is free software: you can redistribute it and/or
 ## modify it under the terms of the GNU General Public License as
@@ -81,7 +82,7 @@
   endif
 
   if (isscalar (a) && isscalar (b))
-    if ((-Inf < a) && (a < b) && (b < Inf))
+    if ((-Inf < a) && (a <= b) && (b < Inf))
       rnd = a + (b - a) * rand (sz, cls);
     else
       rnd = NaN (sz, cls);
@@ -89,7 +90,7 @@
   else
     rnd = a + (b - a) .* rand (sz, cls);
 
-    k = !(-Inf < a) | !(a < b) | !(b < Inf);
+    k = !(-Inf < a) | !(a <= b) | !(b < Inf);
     rnd(k) = NaN;
   endif
 
@@ -127,3 +128,8 @@
 %!error unifrnd (ones (2,2), 2, 3)
 %!error unifrnd (ones (2,2), 2, [3, 2])
 %!error unifrnd (ones (2,2), 2, 2, 3)
+
+%!assert (unifrnd (0,0), 0)
+%!assert (unifrnd (1,1), 1)
+%!assert (unifrnd (1,0), NaN)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/statistics-1.4.1/install-conditionally/tests/kolmogorov_smirnov_test.m 
new/statistics-1.4.2/install-conditionally/tests/kolmogorov_smirnov_test.m
--- old/statistics-1.4.1/install-conditionally/tests/kolmogorov_smirnov_test.m  
2019-03-17 14:45:17.000000000 +0100
+++ new/statistics-1.4.2/install-conditionally/tests/kolmogorov_smirnov_test.m  
2020-03-23 18:58:16.000000000 +0100
@@ -1,4 +1,4 @@
-## Copyright (C) 1995-2017 Kurt Hornik
+## Copyright (C) 1995-2019 Kurt Hornik
 ##
 ## This program is free software: you can redistribute it and/or
 ## modify it under the terms of the GNU General Public License as
@@ -64,16 +64,15 @@
 
   n = length (x);
   s = sort (x);
-  try
+
+  if exist (sprintf ("%scdf", dist))
     f = str2func (sprintf ("%scdf", dist));
-  catch
-    try
-      f = str2func (sprintf ("%s_cdf", dist));
-    catch
-      error ("kolmogorov_smirnov_test: no %scdf or %s_cdf function found",
-             dist, dist);
-    end_try_catch
-  end_try_catch
+  elseif exist (sprintf ("%s_cdf", dist))
+    f = str2func (sprintf ("%s_cdf", dist));
+  else
+    error ("kolmogorov_smirnov_test: no %scdf or %s_cdf function found",
+           dist, dist);
+  endif
 
   alt = "!=";
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/src/configure 
new/statistics-1.4.2/src/configure
--- old/statistics-1.4.1/src/configure  2019-03-19 17:32:11.669852774 +0100
+++ new/statistics-1.4.2/src/configure  2020-03-23 18:58:16.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for statistics 1.4.1.
+# Generated by GNU Autoconf 2.69 for statistics 1.4.2.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -576,8 +576,8 @@
 # Identity of this package.
 PACKAGE_NAME='statistics'
 PACKAGE_TARNAME='statistics'
-PACKAGE_VERSION='1.4.1'
-PACKAGE_STRING='statistics 1.4.1'
+PACKAGE_VERSION='1.4.2'
+PACKAGE_STRING='statistics 1.4.2'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -624,7 +624,6 @@
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -694,7 +693,6 @@
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -947,15 +945,6 @@
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1093,7 +1082,7 @@
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir runstatedir
+               libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1206,7 +1195,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures statistics 1.4.1 to adapt to many kinds of systems.
+\`configure' configures statistics 1.4.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1246,7 +1235,6 @@
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1273,7 +1261,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of statistics 1.4.1:";;
+     short | recursive ) echo "Configuration of statistics 1.4.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1352,7 +1340,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-statistics configure 1.4.1
+statistics configure 1.4.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1407,7 +1395,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by statistics $as_me 1.4.1, which was
+It was created by statistics $as_me 1.4.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3318,7 +3306,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by statistics $as_me 1.4.1, which was
+This file was extended by statistics $as_me 1.4.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3371,7 +3359,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-statistics config.status 1.4.1
+statistics config.status 1.4.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/statistics-1.4.1/src/configure.ac 
new/statistics-1.4.2/src/configure.ac
--- old/statistics-1.4.1/src/configure.ac       2019-03-17 14:45:17.000000000 
+0100
+++ new/statistics-1.4.2/src/configure.ac       2020-03-23 18:58:16.000000000 
+0100
@@ -1,8 +1,24 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
+### Copyright (C) 2019-2020 John Donoghue <[email protected]>
+### Copyright (C) 2018      Olaf Till <[email protected]>
+###
+### This program is free software; you can redistribute it and/or
+### modify it under the terms of the GNU General Public License as
+### published by the Free Software Foundation; either version 3 of the
+### License, or (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+### General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program; if not, see
+### <http://www.gnu.org/licenses/>.
 
 AC_PREREQ([2.69])
-AC_INIT([statistics], [1.4.1])
+AC_INIT([statistics], [1.4.2])
 
 AC_CANONICAL_TARGET
 


Reply via email to