diff scripts/sparse/sprandn.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 26bd6008fc9c
line wrap: on
line diff
--- a/scripts/sparse/sprandn.m	Mon Feb 23 16:42:25 2015 +0000
+++ b/scripts/sparse/sprandn.m	Mon Feb 23 14:54:39 2015 -0800
@@ -57,13 +57,13 @@
 endfunction
 
 
-%% Test 3-input calling form
+## Test 3-input calling form
 %!test
 %! s = sprandn (4, 10, 0.1);
 %! assert (size (s), [4, 10]);
 %! assert (nnz (s) / numel (s), 0.1);
 
-%% Test 4-input calling form
+## Test 4-input calling form
 %!test
 %! d = rand ();
 %! s1 = sprandn (100, 100, d, 0.4);
@@ -76,14 +76,18 @@
 %! assert (nnz (s2) / (100*100), d, 0.02);
 %! assert (svd (s3)', [5 4 3 2], sqrt (eps));
 
-%% Test 1-input calling form
+## Test 1-input calling form
 %!test
 %! s = sprandn (sparse ([1 2 3], [3 2 3], [2 2 2]));
 %! [i, j] = find (s);
 %! assert (sort (i), [1 2 3]');
 %! assert (sort (j), [2 3 3]');
 
-%% Test input validation
+## Test very large, very low density matrix doesn't fail
+%!test
+%! s = sprandn (1e6,1e6,1e-7);
+
+## Test input validation
 %!error sprandn ()
 %!error sprandn (1, 2)
 %!error sprandn (1, 2, 3, 4)
@@ -99,7 +103,3 @@
 %!error <RC must be between 0 and 1> sprandn (2, 2, 0.2, -1)
 %!error <RC must be between 0 and 1> sprandn (2, 2, 0.2, 2)
 
-%% Test very large, very low density matrix doesn't fail
-%!test
-%! s = sprandn (1e6,1e6,1e-7);
-