changeset 33516:ffc7bb75ea3e

unique.m: Remove newlines and space comments to follow Octave conventions. * unique.m: Remove newlines and space comments to follow Octave conventions.
author Rik <rik@octave.org>
date Thu, 02 May 2024 16:38:45 -0700
parents 786d203458bd
children c1e5ee7d07b5
files scripts/set/unique.m
diffstat 1 files changed, 7 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/set/unique.m	Thu May 02 16:12:36 2024 -0700
+++ b/scripts/set/unique.m	Thu May 02 16:38:45 2024 -0700
@@ -227,16 +227,13 @@
     endif
   endif
 
-
   ## Calculate i and j outputs (2nd and 3rd outputs)
   if (nargout > 1)
-
     if (optsorted)
-
       idx = find (match);
 
       if (! optlegacy && optfirst)
-        idx += 1;   # in-place is faster than other forms of increment
+        idx += 1;
       endif
 
       i = j;
@@ -245,9 +242,7 @@
       if (nargout > 2)
         j(j) = cumsum (! [false; match(:)]);
       endif
-
     else
-
       ## Get inverse of sort index j so that sort(x)(k) = x(j)(k) = x.
       k = j;  # cheap way to copy dimensions
       k(j) = 1:n;
@@ -275,25 +270,23 @@
 
         ni = numel (i);
 
-        u = find (uniquex); # Linear index of unique elements of sort(x)
-        l = u(cumsum (uniquex)); # Expand u for all elements in sort(x)
+        u = find (uniquex);       # Linear index of unique elements of sort(x)
+        l = u(cumsum (uniquex));  # Expand u for all elements in sort(x)
 
-        p = j; # cheap way to copy dimensions
-        p(i) = 1:ni; # set p to contain the vector positions of i.
+        p = j;  # cheap way to copy dimensions
+        p(i) = 1:ni;  # set p to contain the vector positions of i.
 
-        j = p(j(l(k))); # Replace j with 3rd output mapping y->x.
-
+        j = p(j(l(k)));  # Replace j with 3rd output mapping y->x.
       endif
     endif
 
     if (optlegacy && isrowvec)
       i = i.';
-
       if (nargout > 2)
         j = j.';
       endif
+    endif
 
-    endif
   endif
 
 endfunction
@@ -461,4 +454,3 @@
 %!error <invalid option> unique ({"a", "b", "c"}, "rows", "UnknownOption2")
 %!error <invalid option> unique ({"a", "b", "c"}, "UnknownOption1", "last")
 %!warning <"rows" is ignored for cell arrays> unique ({"1"}, "rows");
-