comparison scripts/set/uniquetol.m @ 31551:fd29c7a50a78 stable

maint: use commas, semicolons consistently with Octave conventions. * makeValidName.m: Remove %!test and move BIST %!asserts to column 1. * base64decode.m, base64encode.m, which.m, logm.m, uniquetol.m, perms.m: Delete semicolon (';') at end of %!assert BIST. * lin2mu.m, interp2.m, interpn.m, lsqnonneg.m, pqpnonneg.m, uniquetol.m, betainc.m, normalize.m: Add semicolon (';') to end of assert statement within %!test BIST. * __memoize__.m, tar_is_bsd.m, publish.m: Add semicolon (';') to line with keyword "persistent". * stft.m: Use comma (',') after "case" keyword when code immediately follows. * gallery.m: Align commas used in case statements in massive switch block. Remove unnecessary parentheses around a numeric case argument. * ranks.m: Remove semicolon (';') from case statemnt argument.
author Rik <rik@octave.org>
date Sat, 26 Nov 2022 06:32:08 -0800
parents 4581402b1c5b
children 597f3ee61a48
comparison
equal deleted inserted replaced
31549:ed7b17c7ddf3 31551:fd29c7a50a78
306 306
307 %!assert (uniquetol ([1 1 2; 1 2 1; 1 1 2+10*eps]), [1;2]) 307 %!assert (uniquetol ([1 1 2; 1 2 1; 1 1 2+10*eps]), [1;2])
308 %!assert (uniquetol ([1 1 2; 1 0 1; 1 1 2+10*eps], "byrows", true), 308 %!assert (uniquetol ([1 1 2; 1 0 1; 1 1 2+10*eps], "byrows", true),
309 %! [1 0 1; 1 1 2]) 309 %! [1 0 1; 1 1 2])
310 %!assert (uniquetol ([1]), [1]) 310 %!assert (uniquetol ([1]), [1])
311 %!assert (uniquetol ([2, 1]), [1, 2]); 311 %!assert (uniquetol ([2, 1]), [1, 2])
312 %!assert (uniquetol ([1; 2]), [1; 2]) 312 %!assert (uniquetol ([1; 2]), [1; 2])
313 %!assert (uniquetol ([-Inf, 1, NaN, Inf, NaN, Inf]), [-Inf, 1, Inf, NaN, NaN]); 313 %!assert (uniquetol ([-Inf, 1, NaN, Inf, NaN, Inf]), [-Inf, 1, Inf, NaN, NaN])
314 %!assert (uniquetol ([1,2,2,3,2,4], "byrows", true), [1,2,2,3,2,4]) 314 %!assert (uniquetol ([1,2,2,3,2,4], "byrows", true), [1,2,2,3,2,4])
315 %!assert (uniquetol ([1,2,2,3,2,4]), [1,2,3,4]) 315 %!assert (uniquetol ([1,2,2,3,2,4]), [1,2,3,4])
316 %!assert (uniquetol ([1,2,2,3,2,4].', "byrows", true), [1;2;3;4]) 316 %!assert (uniquetol ([1,2,2,3,2,4].', "byrows", true), [1;2;3;4])
317 %!assert (uniquetol (sparse ([2,0;2,0])), sparse ([0;2])) 317 %!assert (uniquetol (sparse ([2,0;2,0])), sparse ([0;2]))
318 %!assert (uniquetol (sparse ([1,2;2,3])), sparse ([1;2;3])) 318 %!assert (uniquetol (sparse ([1,2;2,3])), sparse ([1;2;3]))
323 %! single ([1;2;3;4])) 323 %! single ([1;2;3;4]))
324 324
325 ## Test 2D array sorting 325 ## Test 2D array sorting
326 %!test 326 %!test
327 %! a = [magic(3); 2 * magic(3)]; 327 %! a = [magic(3); 2 * magic(3)];
328 %! assert (uniquetol (a), [1:10,12,14,16,18]') 328 %! assert (uniquetol (a), [1:10,12,14,16,18]');
329 %! assert (uniquetol (a, "byrows", true), sortrows (a)) 329 %! assert (uniquetol (a, "byrows", true), sortrows (a));
330 330
331 ## Matlab compatibility of output 331 ## Matlab compatibility of output
332 %!test 332 %!test
333 %! x = 1:0.045:3; 333 %! x = 1:0.045:3;
334 %! y = uniquetol (x, 0.1, "datascale", 1); 334 %! y = uniquetol (x, 0.1, "datascale", 1);