Mercurial > hg > octave-nkf
changeset 5154:9cb38bfb04ea
[project @ 2005-02-21 21:23:28 by jwe]
author | jwe |
---|---|
date | Mon, 21 Feb 2005 21:23:28 +0000 |
parents | ee2af1e830b2 |
children | ee50a5f1e541 |
files | scripts/ChangeLog scripts/statistics/distributions/poisson_rnd.m src/ChangeLog src/ov-builtin.cc src/ov-usr-fcn.cc |
diffstat | 5 files changed, 25 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2005-02-21 David Bateman <dbateman@free.fr> + + * statistics/distributions/poisson_rnd.m: fix for lambda of zero. + From Mark van Rossum <mvanross@inf.ed.ac.uk>. + Fix for row vectors with at least one element of lambda not in + (0, Inf). + 2005-02-21 John W. Eaton <jwe@octave.org> * statistics/base/qqplot.m: Use feval instead of eval.
--- a/scripts/statistics/distributions/poisson_rnd.m +++ b/scripts/statistics/distributions/poisson_rnd.m @@ -66,7 +66,7 @@ if (isscalar (l)) - if (!(l > 0) | !(l < Inf)) + if (!(l >= 0) | !(l < Inf)) rnd = NaN * ones (sz); elseif ((l > 0) & (l < Inf)) num = zeros (sz); @@ -87,7 +87,7 @@ else rnd = zeros (sz); - k = find (!(l > 0) | !(l < Inf)); + k = find (!(l >= 0) | !(l < Inf)); if (any (k)) rnd(k) = NaN; endif @@ -101,7 +101,7 @@ ind = find (sum < 1); if (any (ind)) sum(ind) = (sum(ind) - - log (1 - rand (length (ind), 1)) ./ l(ind)); + - log (1 - rand (size (ind))) ./ l(ind)); num(ind) = num(ind) + 1; else break;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2005-02-21 John W. Eaton <jwe@octave.org> + * ov-builtin.cc (octave_builtin::subsref): If nargout is 0 and we + have additional indexing to perform, set it to 1 before calling + do_multi_index_op. + * ov-usr-fcn.cc (octave_user_function::subsref): Likewise. + * DLD-FUNCTIONS/gplot.l (send_to_plot_stream): Replot with no previous plot is a no-op. (makeplot): Likewise.
--- a/src/ov-builtin.cc +++ b/src/ov-builtin.cc @@ -61,7 +61,11 @@ switch (type[0]) { case '(': - retval = do_multi_index_op (nargout, idx.front ()); + { + int tmp_nargout = (type.length () > 0 && nargout == 0) ? 1 : nargout; + + retval = do_multi_index_op (tmp_nargout, idx.front ()); + } break; case '{':
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -294,7 +294,11 @@ switch (type[0]) { case '(': - retval = do_multi_index_op (nargout, idx.front ()); + { + int tmp_nargout = (type.length () > 0 && nargout == 0) ? 1 : nargout; + + retval = do_multi_index_op (tmp_nargout, idx.front ()); + } break; case '{':