Mercurial > octave
diff libinterp/corefcn/rand.cc @ 17336:b81b9d079515
Use '##' for comments which stand alone on a line.
* libinterp/corefcn/besselj.cc, libinterp/corefcn/conv2.cc,
libinterp/corefcn/pinv.cc, libinterp/corefcn/rand.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/sqrtm.cc,
libinterp/dldfcn/qr.cc, libinterp/parse-tree/pt-eval.cc,
scripts/general/cplxpair.m, scripts/general/repmat.m, scripts/help/doc.m,
scripts/help/doc_cache_create.m, scripts/image/colorcube.m,
scripts/image/hsv2rgb.m, scripts/image/image.m, scripts/io/strread.m,
scripts/io/textscan.m, scripts/miscellaneous/bzip2.m,
scripts/miscellaneous/edit.m, scripts/miscellaneous/gzip.m,
scripts/optimization/__all_opts__.m, scripts/optimization/fminbnd.m,
scripts/optimization/sqp.m, scripts/pkg/private/get_forge_pkg.m,
scripts/plot/area.m, scripts/plot/stemleaf.m, scripts/plot/surfc.m,
scripts/plot/uiresume.m, scripts/plot/zlabel.m, scripts/polynomial/mkpp.m,
scripts/polynomial/ppval.m, scripts/set/intersect.m, scripts/signal/freqz.m,
scripts/sparse/pcg.m, scripts/sparse/pcr.m, scripts/sparse/svds.m,
scripts/sparse/treelayout.m, scripts/specfun/ellipke.m,
scripts/special-matrix/toeplitz.m, scripts/strings/dec2base.m,
scripts/strings/strsplit.m, scripts/testfun/test.m, test/build-sparse-tests.sh,
test/index.tst, test/system.tst:
Use '##' for comments which stand alone on a line.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 28 Aug 2013 08:27:38 -0700 |
parents | bc924baa2c4e |
children | 0b7f5c56f853 |
line wrap: on
line diff
--- a/libinterp/corefcn/rand.cc Wed Aug 28 08:41:55 2013 +0100 +++ b/libinterp/corefcn/rand.cc Wed Aug 28 08:27:38 2013 -0700 @@ -49,7 +49,7 @@ /* %!shared __random_statistical_tests__ -%! # Flag whether the statistical tests should be run in "make check" or not +%! ## Flag whether the statistical tests should be run in "make check" or not %! __random_statistical_tests__ = 0; */ @@ -502,16 +502,16 @@ /* %!test -%! # Test fixed state +%! ## Test fixed state %! rand ("state", 1); %! assert (rand (1,6), [0.1343642441124013 0.8474337369372327 0.763774618976614 0.2550690257394218 0.495435087091941 0.4494910647887382], 1e-6); %!test -%! # Test fixed seed +%! ## Test fixed seed %! rand ("seed", 1); %! assert (rand (1,6), [0.8668024251237512 0.9126510815694928 0.09366085007786751 0.1664607301354408 0.7408077004365623 0.7615650338120759], 1e-6); %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! rand ("state", 12); %! x = rand (100000, 1); %! assert (max (x) < 1); #*** Please report this!!! *** @@ -523,7 +523,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! rand ("seed", 12); %! x = rand (100000, 1); %! assert (max (x) < 1); #*** Please report this!!! *** @@ -593,16 +593,16 @@ /* %!test -%! # Test fixed state +%! ## Test fixed state %! randn ("state", 1); %! assert (randn (1, 6), [-2.666521678978671 -0.7381719971724564 1.507903992673601 0.6019427189162239 -0.450661261143348 -0.7054431351574116], 1e-6); %!test -%! # Test fixed seed +%! ## Test fixed seed %! randn ("seed", 1); %! assert (randn (1, 6), [-1.039402365684509 -1.25938892364502 0.1968704611063004 0.3874166905879974 -0.5976632833480835 -0.6615074276924133], 1e-6); %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randn ("state", 12); %! x = randn (100000, 1); %! assert (mean (x), 0, 0.01); @@ -612,7 +612,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randn ("seed", 12); %! x = randn (100000, 1); %! assert (mean (x), 0, 0.01); @@ -664,16 +664,16 @@ /* %!test -%! # Test fixed state +%! ## Test fixed state %! rande ("state", 1); %! assert (rande (1, 6), [3.602973885835625 0.1386190677555021 0.6743112889616958 0.4512830847258422 0.7255744741233175 0.3415969205292291], 1e-6); %!test -%! # Test fixed seed +%! ## Test fixed seed %! rande ("seed", 1); %! assert (rande (1, 6), [0.06492075175653866 1.717980206012726 0.4816154008731246 0.5231300676241517 0.103910739364359 1.668931916356087], 1e-6); %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally +%! ## statistical tests may fail occasionally %! rande ("state", 1); %! x = rande (100000, 1); %! assert (min (x) > 0); # *** Please report this!!! *** @@ -684,7 +684,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally +%! ## statistical tests may fail occasionally %! rande ("seed", 1); %! x = rande (100000, 1); %! assert (min (x)>0); # *** Please report this!!! *** @@ -812,49 +812,49 @@ %! assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]); # *** Please report %!test -%! # Test fixed state +%! ## Test fixed state %! randg ("state", 1); %! assert (randg (0.1, 1, 6), [0.0103951513331241 8.335671459898252e-05 0.00138691397249762 0.000587308416993855 0.495590518784736 2.3921917414795e-12], 1e-6); %!test -%! # Test fixed state +%! ## Test fixed state %! randg ("state", 1); %! assert (randg (0.95, 1, 6), [3.099382433255327 0.3974529788871218 0.644367450750855 1.143261091802246 1.964111762696822 0.04011915547957939], 1e-6); %!test -%! # Test fixed state +%! ## Test fixed state %! randg ("state", 1); %! assert (randg (1, 1, 6), [0.2273389379645993 1.288822625058359 0.2406335209340746 1.218869553370733 1.024649860162554 0.09631230343599533], 1e-6); %!test -%! # Test fixed state +%! ## Test fixed state %! randg ("state", 1); %! assert (randg (10, 1, 6), [3.520369644331133 15.15369864472106 8.332112081991205 8.406211067432674 11.81193475187611 10.88792728177059], 1e-5); %!test -%! # Test fixed state +%! ## Test fixed state %! randg ("state", 1); %! assert (randg (100, 1, 6), [75.34570255262264 115.4911985594699 95.23493031356388 95.48926019250911 106.2397448229803 103.4813150404118], 1e-4); %!test -%! # Test fixed seed +%! ## Test fixed seed %! randg ("seed", 1); %! assert (randg (0.1, 1, 6), [0.07144210487604141 0.460641473531723 0.4749028384685516 0.06823389977216721 0.000293838675133884 1.802567535340305e-12], 1e-6); %!test -%! # Test fixed seed +%! ## Test fixed seed %! randg ("seed", 1); %! assert (randg (0.95, 1, 6), [1.664905071258545 1.879976987838745 1.905677795410156 0.9948706030845642 0.5606933236122131 0.0766092911362648], 1e-6); %!test -%! # Test fixed seed +%! ## Test fixed seed %! randg ("seed", 1); %! assert (randg (1, 1, 6), [0.03512085229158401 0.6488978862762451 0.8114678859710693 0.1666885763406754 1.60791552066803 1.90356981754303], 1e-6); %!test -%! # Test fixed seed +%! ## Test fixed seed %! randg ("seed", 1); %! assert (randg (10, 1, 6), [6.566435813903809 10.11648464202881 10.73162078857422 7.747178077697754 6.278522491455078 6.240195751190186], 1e-5); %!test -%! # Test fixed seed +%! ## Test fixed seed %! randg ("seed", 1); %! assert (randg (100, 1, 6), [89.40208435058594 101.4734725952148 103.4020004272461 93.62763214111328 88.33104705810547 88.1871337890625], 1e-4); %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("state", 12); %! a = 0.1; %! x = randg (a, 100000, 1); @@ -865,7 +865,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("state", 12); %! a = 0.95; %! x = randg (a, 100000, 1); @@ -876,7 +876,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("state", 12); %! a = 1; %! x = randg (a, 100000, 1); @@ -887,7 +887,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("state", 12); %! a = 10; %! x = randg (a, 100000, 1); @@ -898,7 +898,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("state", 12); %! a = 100; %! x = randg (a, 100000, 1); @@ -912,7 +912,7 @@ %!assert (randg ([-inf, -1, 0, inf, nan]), [nan, nan, nan, nan, nan]) # *** Please report %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("seed", 12); %! a = 0.1; %! x = randg (a, 100000, 1); @@ -923,7 +923,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("seed", 12); %! a = 0.95; %! x = randg (a, 100000, 1); @@ -934,7 +934,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("seed", 12); %! a = 1; %! x = randg (a, 100000, 1); @@ -945,7 +945,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("seed", 12); %! a = 10; %! x = randg (a, 100000, 1); @@ -956,7 +956,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randg ("seed", 12); %! a = 100; %! x = randg (a, 100000, 1); @@ -1034,33 +1034,33 @@ %! randp ("state", 12); %! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]); # *** Please report %!test -%! # Test fixed state +%! ## Test fixed state %! randp ("state", 1); %! assert (randp (5, 1, 6), [5 5 3 7 7 3]) %!test -%! # Test fixed state +%! ## Test fixed state %! randp ("state", 1); %! assert (randp (15, 1, 6), [13 15 8 18 18 15]) %!test -%! # Test fixed state +%! ## Test fixed state %! randp ("state", 1); %! assert (randp (1e9, 1, 6), [999915677 999976657 1000047684 1000019035 999985749 999977692], -1e-6) %!test -%! # Test fixed state +%! ## Test fixed state %! randp ("seed", 1); %! %%assert (randp (5, 1, 6), [8 2 3 6 6 8]) %! assert (randp (5, 1, 5), [8 2 3 6 6]) %!test -%! # Test fixed state +%! ## Test fixed state %! randp ("seed", 1); %! assert (randp (15, 1, 6), [15 16 12 10 10 12]) %!test -%! # Test fixed state +%! ## Test fixed state %! randp ("seed", 1); %! assert (randp (1e9, 1, 6), [1000006208 1000012224 999981120 999963520 999963072 999981440], -1e-6) %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randp ("state", 12); %! for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03] %! x = randp (a (1), 100000, 1); @@ -1073,7 +1073,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randp ("state", 12); %! for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03] %! x = randp (a(1)*ones (100000, 1), 100000, 1); @@ -1089,7 +1089,7 @@ %! assert (randp ([-inf, -1, 0, inf, nan]), [nan, nan, 0, nan, nan]); # *** Please report %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randp ("seed", 12); %! for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03] %! x = randp (a(1), 100000, 1); @@ -1102,7 +1102,7 @@ %! endif %!test %! if (__random_statistical_tests__) -%! # statistical tests may fail occasionally. +%! ## statistical tests may fail occasionally. %! randp ("seed", 12); %! for a = [5, 15, 1e9; 0.03, 0.03, -5e-3; 0.03, 0.03, 0.03] %! x = randp (a(1)*ones (100000, 1), 100000, 1);