Mercurial > octave-nkf
comparison scripts/statistics/distributions/exppdf.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 ("exppdf: X and LAMBDA must be of common size or scalars"); | 38 error ("exppdf: X and LAMBDA must be of common size or scalars"); |
39 endif | 39 endif |
40 endif | 40 endif |
67 %! y = gampdf (x, 1, 2); | 67 %! y = gampdf (x, 1, 2); |
68 %!assert (exppdf (x, 2*ones (1,5)), y) | 68 %!assert (exppdf (x, 2*ones (1,5)), y) |
69 %!assert (exppdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) | 69 %!assert (exppdf (x, 2*[1 0 NaN 1 1]), [y(1) NaN NaN y(4:5)]) |
70 %!assert (exppdf ([x, NaN], 2), [y, NaN]) | 70 %!assert (exppdf ([x, NaN], 2), [y, NaN]) |
71 | 71 |
72 %% Test class of input preserved | 72 ## Test class of input preserved |
73 %!assert (exppdf (single ([x, NaN]), 2), single ([y, NaN])) | 73 %!assert (exppdf (single ([x, NaN]), 2), single ([y, NaN])) |
74 %!assert (exppdf ([x, NaN], single (2)), single ([y, NaN])) | 74 %!assert (exppdf ([x, NaN], single (2)), single ([y, NaN])) |
75 | 75 |
76 %% Test input validation | 76 ## Test input validation |
77 %!error exppdf () | 77 %!error exppdf () |
78 %!error exppdf (1) | 78 %!error exppdf (1) |
79 %!error exppdf (1,2,3) | 79 %!error exppdf (1,2,3) |
80 %!error exppdf (ones (3), ones (2)) | 80 %!error exppdf (ones (3), ones (2)) |
81 %!error exppdf (ones (2), ones (3)) | 81 %!error exppdf (ones (2), ones (3)) |