# HG changeset patch # User jwe # Date 1192465915 0 # Node ID 4d4197ffb09dd47293a3c583458ed850662648a2 # Parent 120f3135952f9802c9732e8087fc83cfc256ce5c [project @ 2007-10-15 16:31:55 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -10,6 +10,9 @@ 2007-10-15 David Bateman + * plot/print.m: Call drawnow before printing to ensure the plot is + on the screen. + * testfun/test.m: In error/warning blocks test for an error before a warning to avoid unexpected failures. diff --git a/scripts/plot/print.m b/scripts/plot/print.m --- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -128,6 +128,10 @@ debug = false; debug_file = "octave-print-commands.log"; + ## Ensure the last figure is on the screen for single line commands like + ## plot(...); print(...); + drawnow (); + for i = 1:nargin arg = varargin{i}; if (ischar (arg)) diff --git a/scripts/statistics/distributions/frnd.m b/scripts/statistics/distributions/frnd.m --- a/scripts/statistics/distributions/frnd.m +++ b/scripts/statistics/distributions/frnd.m @@ -78,16 +78,33 @@ if (isscalar (m) && isscalar (n)) - if ((m > 0) && (m < Inf) && (n > 0) && (n < Inf)) - rnd = n ./ m .* randg(m/2,sz) ./ randg(n/2,sz); + if (isinf (m) || isinf (n)) + if (isinf (m)) + rnd = ones (sz); + else + rnd = 2 ./ m .* randg(m / 2, sz); + endif + if (! isinf (n)) + rnd = 0.5 .* n .* rnd ./ randg (n / 2, sz); + endif + elseif ((m > 0) && (m < Inf) && (n > 0) && (n < Inf)) + rnd = n ./ m .* randg (m / 2, sz) ./ randg (n / 2, sz); else rnd = NaN * ones (sz); endif else rnd = zeros (sz); - k = find (!(m > 0) | !(m < Inf) | - !(n > 0) | !(n < Inf)); + k = find (isinf(m) | isinf(n)); + if (any (k)) + rnd (k) = 1; + k2 = find (!isinf(m) & isinf(n)); + rnd (k2) = 2 ./ m(k2) .* randg (m(k2) ./ 2, size(k2)); + k2 = find (isinf(m) & !isinf(n)); + rnd (k2) = 0.5 .* n(k2) .* rnd(k2) ./ randg (n(k2) ./ 2, size(k2)); + endif + + k = find (!(m > 0) | !(n > 0)); if (any (k)) rnd(k) = NaN; endif