[Pkg-octave-commit] [SCM] octave-statistics branch, master, updated. 0d6a53c17b466b222e7cf164c79c59bae22fb0e9
Rafael Laboissiere
rafael at debian.org
Mon Jun 1 07:51:58 UTC 2009
The following commit has been merged in the master branch:
commit 0d6a53c17b466b222e7cf164c79c59bae22fb0e9
Author: Rafael Laboissiere <rafael at debian.org>
Date: Mon Jun 1 09:35:25 2009 +0200
Add patch for making the tests of function pdist succeed
diff --git a/debian/changelog b/debian/changelog
index 14354ac..ce2fa01 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+octave-statistics (1.0.8-2) UNRELEASED; urgency=low
+
+ * debian/patches/fix-pdist-test.diff: Add patch for making the tests of
+ function pdist succeed
+
+ -- Rafael Laboissiere <rafael at debian.org> Mon, 01 Jun 2009 09:32:02 +0200
+
octave-statistics (1.0.8-1) unstable; urgency=low
* New upstream version
diff --git a/debian/patches/fix-pdist-test.diff b/debian/patches/fix-pdist-test.diff
new file mode 100644
index 0000000..b29d718
--- /dev/null
+++ b/debian/patches/fix-pdist-test.diff
@@ -0,0 +1,138 @@
+This patch makes the tests of function pdist succeed. It was taken
+from the upstream SVN repository at:
+
+ http://octave.svn.sourceforge.net/viewvc/octave?view=rev&revision=5884
+
+with the following commit message:
+
+ Author: fpoto (Francesco Potortì)
+ Date: Sun May 31 23:27:35 2009 UTC (8 hours, 12 minutes ago)
+ Log Message:
+
+ Apparently an old version was committed.
+
+ Now useless ", 1" strings are removed from var, cor, sum, abs,
+ Errors for 1-D vectors are not called any more.
+
+ -- Rafael Laboissiere <rafael at debian.org> Mon, 01 Jun 2009 09:32:02 +0200
+
+--- a/inst/pdist.m
++++ b/inst/pdist.m
+@@ -21,8 +21,8 @@
+ ##
+ ## Return the distance between any two rows in @var{x}.
+ ##
+-## @var{x} is the @var{n}x at var{d} matrix representing @var{q} row vectors of
+-## size @var{d}.
++## @var{x} is the @var{n}x at var{d} matrix representing @var{q} row
++## vectors of size @var{d}.
+ ##
+ ## The output is a dissimilarity matrix formatted as a row vector
+ ## @var{y}, @math{(n-1)*n/2} long, where the distances are in
+@@ -112,6 +112,10 @@
+ endif
+
+ y = [];
++ if (rows(x) == 1)
++ return;
++ endif
++
+ if (ischar (metric))
+ order = nchoosek(1:rows(x),2);
+ Xi = order(:,1);
+@@ -120,73 +124,71 @@
+ metric = lower (metric);
+ switch (metric)
+ case "euclidean"
+- diff = X(:,Xi) - X(:,Yi);
++ d = X(:,Xi) - X(:,Yi);
+ if (str2num(version()(1:3)) > 3.1)
+- y = norm (diff, "cols");
++ y = norm (d, "cols");
+ else
+- y = sqrt (sumsq (diff, 1));
++ y = sqrt (sumsq (d));
+ endif
+
+ case "seuclidean"
+- diff = X(:,Xi) - X(:,Yi);
+- weights = inv (diag (var (x, 1)));
+- y = sqrt (sum ((weights * diff) .* diff, 1));
++ d = X(:,Xi) - X(:,Yi);
++ weights = inv (diag (var (x)));
++ y = sqrt (sum ((weights * d) .* d));
+
+ case "mahalanobis"
+- diff = X(:,Xi) - X(:,Yi);
++ d = X(:,Xi) - X(:,Yi);
+ weights = inv (cov (x));
+- y = sqrt (sum ((weights * diff) .* diff, 1));
++ y = sqrt (sum ((weights * d) .* d));
+
+ case "cityblock"
+- diff = X(:,Xi) - X(:,Yi);
++ d = X(:,Xi) - X(:,Yi);
+ if (str2num(version()(1:3)) > 3.1)
+- y = norm (diff, 1, "cols");
++ y = norm (d, 1, "cols");
+ else
+- y = sum (abs (diff), 1);
++ y = sum (abs (d));
+ endif
+
+ case "minkowski"
+- diff = X(:,Xi) - X(:,Yi);
++ d = X(:,Xi) - X(:,Yi);
+ p = 2; # default
+ if (nargin > 2)
+ p = varargin{1}; # explicitly assigned
+ endif;
+ if (str2num(version()(1:3)) > 3.1)
+- y = norm (diff, p, "cols");
++ y = norm (d, p, "cols");
+ else
+- y = (sum ((abs (diff)).^p, 1)).^(1/p);
++ y = (sum ((abs (d)).^p)).^(1/p);
+ endif
+
+ case "cosine"
+ prod = X(:,Xi) .* X(:,Yi);
+- weights = sumsq (X(:,Xi), 1) .* sumsq (X(:,Yi), 1);
++ weights = sumsq (X(:,Xi)) .* sumsq (X(:,Yi));
+ y = 1 - sum (prod) ./ sqrt (weights);
+
+ case "correlation"
+- error ("pdist: cannot compute correlation distance between 1-D vectors")
+ corr = cor (X);
+ y = 1 - corr (sub2ind (size (corr), Xi, Yi))';
+
+ case "spearman"
+- error ("pdist: cannot compute spearman distance between 1-D vectors")
+ corr = spearman (X);
+ y = 1 - corr (sub2ind (size (corr), Xi, Yi))';
+
+ case "hamming"
+- diff = logical (X(:,Xi) - X(:,Yi));
+- y = sum (diff, 1) / rows (X);
++ d = logical (X(:,Xi) - X(:,Yi));
++ y = sum (d) / rows (X);
+
+ case "jaccard"
+- diff = logical (X(:,Xi) - X(:,Yi));
++ d = logical (X(:,Xi) - X(:,Yi));
+ weights = X(:,Xi) | X(:,Yi);
+- y = sum (diff & weights, 1) ./ sum (weights, 1);
++ y = sum (d & weights) ./ sum (weights);
+
+ case "chebychev"
+- diff = X(:,Xi) - X(:,Yi);
++ d = X(:,Xi) - X(:,Yi);
+ if (str2num(version()(1:3)) > 3.1)
+- y = norm (diff, Inf, "cols");
++ y = norm (d, Inf, "cols");
+ else
+- y = max (abs (diff), 1);
++ y = max (abs (d));
+ endif
+
+ endswitch
diff --git a/debian/patches/series b/debian/patches/series
index 68a7154..57f96e2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
data-files-for-tests.diff
+fix-pdist-test.diff
--
octave-statistics
More information about the Pkg-octave-commit
mailing list