Mercurial > octave-nkf
comparison scripts/statistics/distributions/poisspdf.m @ 19867: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 | d9341b422488 |
comparison
equal
deleted
inserted
replaced
19866:a1acca0c2216 | 19867:9fc020886ae9 |
---|---|
30 | 30 |
31 if (nargin != 2) | 31 if (nargin != 2) |
32 print_usage (); | 32 print_usage (); |
33 endif | 33 endif |
34 | 34 |
35 if (!isscalar (lambda)) | 35 if (! isscalar (lambda)) |
36 [retval, x, lambda] = common_size (x, lambda); | 36 [retval, x, lambda] = common_size (x, lambda); |
37 if (retval > 0) | 37 if (retval > 0) |
38 error ("poisspdf: X and LAMBDA must be of common size or scalars"); | 38 error ("poisspdf: X and LAMBDA must be of common size or scalars"); |
39 endif | 39 endif |
40 endif | 40 endif |
68 %!assert (poisspdf (x, ones (1,5)), y, eps) | 68 %!assert (poisspdf (x, ones (1,5)), y, eps) |
69 %!assert (poisspdf (x, 1), y, eps) | 69 %!assert (poisspdf (x, 1), y, eps) |
70 %!assert (poisspdf (x, [1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)], eps) | 70 %!assert (poisspdf (x, [1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)], eps) |
71 %!assert (poisspdf ([x, NaN], 1), [y, NaN], eps) | 71 %!assert (poisspdf ([x, NaN], 1), [y, NaN], eps) |
72 | 72 |
73 %% Test class of input preserved | 73 ## Test class of input preserved |
74 %!assert (poisspdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) | 74 %!assert (poisspdf (single ([x, NaN]), 1), single ([y, NaN]), eps ("single")) |
75 %!assert (poisspdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) | 75 %!assert (poisspdf ([x, NaN], single (1)), single ([y, NaN]), eps ("single")) |
76 | 76 |
77 %% Test input validation | 77 ## Test input validation |
78 %!error poisspdf () | 78 %!error poisspdf () |
79 %!error poisspdf (1) | 79 %!error poisspdf (1) |
80 %!error poisspdf (1,2,3) | 80 %!error poisspdf (1,2,3) |
81 %!error poisspdf (ones (3), ones (2)) | 81 %!error poisspdf (ones (3), ones (2)) |
82 %!error poisspdf (ones (2), ones (3)) | 82 %!error poisspdf (ones (2), ones (3)) |