# HG changeset patch # User jwe # Date 1109021008 0 # Node ID 9cb38bfb04eacfb6aa51d5a04b86c9484efb8d2e # Parent ee2af1e830b28e1ccb69bf341032cae95666ffbc [project @ 2005-02-21 21:23:28 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2005-02-21 David Bateman + + * statistics/distributions/poisson_rnd.m: fix for lambda of zero. + From Mark van Rossum . + Fix for row vectors with at least one element of lambda not in + (0, Inf). + 2005-02-21 John W. Eaton * statistics/base/qqplot.m: Use feval instead of eval. diff --git a/scripts/statistics/distributions/poisson_rnd.m b/scripts/statistics/distributions/poisson_rnd.m --- 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; diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2005-02-21 John W. Eaton + * 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. diff --git a/src/ov-builtin.cc b/src/ov-builtin.cc --- 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 '{': diff --git a/src/ov-usr-fcn.cc b/src/ov-usr-fcn.cc --- 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 '{':