[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3.0.4 last call for patches
From: |
Daniel J Sebald |
Subject: |
Re: 3.0.4 last call for patches |
Date: |
Tue, 13 Jan 2009 00:28:23 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
Jaroslav Hajek wrote:
Hello,
I'm about to make a release candidate for 3.0.4 (which I originally
wanted to do in December). We have more than 50 fixes since 3.0.3.
http://hg.tw-math.de/release-3-0-x/
If you care for a particular patch to be transplanted to 3.0.4
(bugfixes only), please point me to it.
This one...
Dan
diff -Pur octave/scripts/ChangeLog octave_mod/scripts/ChangeLog
--- octave/scripts/ChangeLog 2009-01-12 23:53:52.419414735 -0600
+++ octave_mod/scripts/ChangeLog 2009-01-13 00:04:49.560570406 -0600
@@ -1,3 +1,7 @@
+2009-01-13 Daniel J Sebald <address@hidden>
+
+ * set/unique.m: Fix for vertical array inputs.
+
2009-01-12 John W. Eaton <address@hidden>
* optimization/fzero.m, optimization/fsolve.m: Style fixes.
diff -Pur octave/scripts/set/unique.m octave_mod/scripts/set/unique.m
--- octave/scripts/set/unique.m 2009-01-12 01:04:35.000000000 -0600
+++ octave_mod/scripts/set/unique.m 2009-01-12 02:03:40.000000000 -0600
@@ -74,8 +74,10 @@
if (optrows)
n = size (x, 1);
+ dim = 1;
else
n = numel (x);
+ dim = (size (x, 1) == 1) + 1;
endif
y = x;
@@ -108,7 +110,11 @@
if (nargout >= 3)
j = i;
- j(i) = cumsum ([1, !match]);
+ if (dim == 1)
+ j(i) = cumsum ([1; !match]);
+ else
+ j(i) = cumsum ([1, !match]);
+ end
endif
if (optfirst)
@@ -128,7 +134,7 @@
%!assert(unique([1;2]),[1;2])
%!assert(unique([1,NaN,Inf,NaN,Inf]),[1,Inf,NaN,NaN])
%!assert(unique({'Foo','Bar','Foo'}),{'Bar','Foo'})
-%!assert(unique({'Foo','Bar','FooBar'}),{'Bar','Foo','FooBar'})
+%!assert(unique({'Foo','Bar','FooBar'}'),{'Bar','Foo','FooBar'}')
%!test
%! [a,i,j] = unique([1,1,2,3,3,3,4]);
@@ -137,7 +143,20 @@
%! assert(j,[1,1,2,3,3,3,4])
%!
%!test
-%! [a,i,j] = unique([1,1,2,3,3,3,4],'first');
-%! assert(a,[1,2,3,4])
-%! assert(i,[1,3,4,7])
-%! assert(j,[1,1,2,3,3,3,4])
+%! [a,i,j] = unique([1,1,2,3,3,3,4]','first');
+%! assert(a,[1,2,3,4]')
+%! assert(i,[1,3,4,7]')
+%! assert(j,[1,1,2,3,3,3,4]')
+%!
+%!test
+%! [a,i,j] = unique({'z'; 'z'; 'z'});
+%! assert(a,{'z'})
+%! assert(i,[3]')
+%! assert(j,[1,1,1]')
+%!
+%!test
+%! A=[1,2,3;1,2,3];
+%! [a,i,j] = unique(A,'rows');
+%! assert(a,[1,2,3])
+%! assert(A(i,:),a)
+%! assert(a(j,:),A)