Mercurial > octave-antonio
comparison scripts/general/circshift.m @ 19833:9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Try to trim long lines to < 80 chars.
Use '##' for single line comments.
Use '(...)' around tests for if/elseif/switch/while.
Abut cell indexing operator '{' next to variable.
Abut array indexing operator '(' next to variable.
Use space between negation operator '!' and following expression.
Use two newlines between endfunction and start of %!test or %!demo code.
Remove unnecessary parens grouping between short-circuit operators.
Remove stray extra spaces (typos) between variables and assignment operators.
Remove stray extra spaces from ends of lines.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 23 Feb 2015 14:54:39 -0800 |
parents | 4197fc428c7d |
children | 7503499a252b |
comparison
equal
deleted
inserted
replaced
19832:a1acca0c2216 | 19833:9fc020886ae9 |
---|---|
40 ## @result{} 3, 1, 2 | 40 ## @result{} 3, 1, 2 |
41 ## 6, 4, 5 | 41 ## 6, 4, 5 |
42 ## 9, 7, 8 | 42 ## 9, 7, 8 |
43 ## @end group | 43 ## @end group |
44 ## @end example | 44 ## @end example |
45 ## @seealso {permute, ipermute, shiftdim} | 45 ## @seealso{permute, ipermute, shiftdim} |
46 ## @end deftypefn | 46 ## @end deftypefn |
47 | 47 |
48 function y = circshift (x, n) | 48 function y = circshift (x, n) |
49 | 49 |
50 if (nargin != 2) | 50 if (nargin != 2) |
92 %!assert (circshift ([], 1), []) | 92 %!assert (circshift ([], 1), []) |
93 | 93 |
94 %!assert (circshift (eye (3), 1), circshift (eye (3), 1)) | 94 %!assert (circshift (eye (3), 1), circshift (eye (3), 1)) |
95 %!assert (circshift (eye (3), 1), [0,0,1;1,0,0;0,1,0]) | 95 %!assert (circshift (eye (3), 1), [0,0,1;1,0,0;0,1,0]) |
96 | 96 |
97 %% Test input validation | 97 ## Test input validation |
98 %!error circshift () | 98 %!error circshift () |
99 %!error circshift (1) | 99 %!error circshift (1) |
100 %!error circshift (1,2,3) | 100 %!error circshift (1,2,3) |
101 %!error circshift (1, ones (2,2)) | 101 %!error circshift (1, ones (2,2)) |
102 %!error circshift (1, [1 2 3]) | 102 %!error circshift (1, [1 2 3]) |