changeset 6339:20c48710b2c7

[project @ 2007-02-22 18:22:24 by dbateman] ChangeLog
author dbateman
date Thu, 22 Feb 2007 18:22:24 +0000
parents ec88b4ab6d10
children 6d7b7c7cad61
files scripts/ChangeLog scripts/miscellaneous/doc.m scripts/sparse/treeplot.m scripts/statistics/distributions/betarnd.m scripts/statistics/distributions/chi2rnd.m scripts/statistics/distributions/exprnd.m scripts/statistics/distributions/frnd.m scripts/statistics/distributions/gamrnd.m scripts/statistics/distributions/poissrnd.m scripts/statistics/distributions/trnd.m
diffstat 10 files changed, 21 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/ChangeLog	Thu Feb 22 18:22:24 2007 +0000
@@ -1,3 +1,7 @@
+2007-02-22  David Bateman  <dbateman@free.fr>
+
+	* pkg/pkg.m (fix_depends): Support > and < operators as well. 
+
 2007-02-22  John W. Eaton  <jwe@octave.org>
 
 	* plot/__uiobject_draw_axes__.m: If not using gnuplot for images,
--- a/scripts/miscellaneous/doc.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/miscellaneous/doc.m	Thu Feb 22 18:22:24 2007 +0000
@@ -51,7 +51,7 @@
     endif
 
     if (ftype == 2 || ftype == 3)
-      ffile = file_in_loadpath (strcat (fname, "."));
+      ffile = which (fname);
     else
       ffile = "";
     endif
--- a/scripts/sparse/treeplot.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/sparse/treeplot.m	Thu Feb 22 18:22:24 2007 +0000
@@ -152,8 +152,6 @@
       
     endif
   endif
-  St;
-  Skelet;
 endfunction
 
 %!demo
--- a/scripts/statistics/distributions/betarnd.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/statistics/distributions/betarnd.m	Thu Feb 22 18:22:24 2007 +0000
@@ -79,7 +79,8 @@
     if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf)))
       rnd = NaN * ones (sz);
     else
-      rnd = betainv (rand(sz), a, b);
+      r1 = randg(a,sz); 
+      rnd = r1 ./ (r1 + randg(b,sz));
     endif
   else
     rnd = zeros (sz);
@@ -91,7 +92,8 @@
 
     k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf));
     if (any (k))
-      rnd(k) = betainv (rand (size (k)), a(k), b(k));
+      r1 = randg(a(k),size(k)); 
+      rnd(k) = r1 ./ (r1 + randg(b(k),size(k)));
     endif
   endif
 
--- a/scripts/statistics/distributions/chi2rnd.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/statistics/distributions/chi2rnd.m	Thu Feb 22 18:22:24 2007 +0000
@@ -69,7 +69,7 @@
      if (find (!(n > 0) | !(n < Inf)))
        rnd = NaN * ones (sz);
      else
-       rnd =  chi2inv (rand (sz), n);
+       rnd = 2 * randg(n/2, sz)
      endif
   else
     [retval, n, dummy] = common_size (n, ones (sz));
@@ -85,7 +85,7 @@
 
     k = find ((n > 0) & (n < Inf));
     if (any (k))
-      rnd(k) = chi2inv (rand (size (k)), n(k));
+      rnd(k) = 2 * randg(n(k)/2, size(k))
     endif
   endif
 
--- a/scripts/statistics/distributions/exprnd.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/statistics/distributions/exprnd.m	Thu Feb 22 18:22:24 2007 +0000
@@ -69,7 +69,7 @@
 
   if (isscalar (l))
     if ((l > 0) && (l < Inf))
-      rnd = - log (1 - rand (sz)) ./ l;
+      rnd = rande(sz) / l;
     else
       rnd = NaN * ones (sz);
     endif
@@ -81,7 +81,7 @@
     endif
     k = find ((l > 0) & (l < Inf));
     if (any (k))
-      rnd(k) = - log (1 - rand (size (k))) ./ l(k);
+      rnd(k) = rande(size(k)) / l(k);
     endif
   endif
 
--- a/scripts/statistics/distributions/frnd.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/statistics/distributions/frnd.m	Thu Feb 22 18:22:24 2007 +0000
@@ -80,7 +80,7 @@
 
   if (isscalar (m) && isscalar (n))
     if ((m > 0) && (m < Inf) && (n > 0) && (n < Inf))
-      rnd =  finv (rand (sz), m, n);
+      rnd = n ./ m .* randg(m/2,sz) ./ randg(n/2,sz);
     else
       rnd = NaN * ones (sz);
     endif
@@ -96,7 +96,7 @@
     k = find ((m > 0) & (m < Inf) &
               (n > 0) & (n < Inf));
     if (any (k))
-      rnd(k) = finv (rand (size (k)), m(k), n(k));
+      rnd(k) = n(k) ./ m(k) .* randg(m(k)./2,size(k)) ./ randg(n(k)./2,size(k));
     endif
   endif
 
--- a/scripts/statistics/distributions/gamrnd.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/statistics/distributions/gamrnd.m	Thu Feb 22 18:22:24 2007 +0000
@@ -82,7 +82,7 @@
     if (find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf)))
       rnd = NaN * ones (sz);
     else
-      rnd =  gaminv (rand (sz), a, b);
+      rnd = randg(a,sz)/b;
     endif
   else 
     k = find (!(a > 0) | !(a < Inf) | !(b > 0) | !(b < Inf));
@@ -91,7 +91,7 @@
     endif
     k = find ((a > 0) & (a < Inf) & (b > 0) & (b < Inf));
     if (any (k))
-      rnd(k) = gaminv (rand (size (k)), a(k), b(k));
+      rnd(k) = randg(a(k),size(k))/b(k);
     endif
   endif
 
--- a/scripts/statistics/distributions/poissrnd.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/statistics/distributions/poissrnd.m	Thu Feb 22 18:22:24 2007 +0000
@@ -69,18 +69,7 @@
     if (!(l >= 0) | !(l < Inf))
       rnd = NaN * ones (sz);
     elseif ((l > 0) & (l < Inf))
-      num = zeros (sz);
-      sum = - log (1 - rand (sz)) ./ l;
-      while (1)
-	ind = find (sum < 1);
-	if (any (ind))
-          sum(ind) = (sum(ind) - log (1 - rand (size (ind))) / l);
-          num(ind) = num(ind) + 1;
-	else
-          break;
-	endif
-      endwhile
-      rnd = num;
+      rnd = randp(l, sz);
     else
       rnd = zeros (sz);
     endif
@@ -94,20 +83,7 @@
 
     k = find ((l > 0) & (l < Inf));
     if (any (k))
-      l = l(k);
-      num = zeros (size (k));
-      sum = - log (1 - rand (size (k))) ./ l;
-      while (1)
-	ind = find (sum < 1);
-	if (any (ind))
-          sum(ind) = (sum(ind)
-                      - log (1 - rand (size (ind))) ./ l(ind));
-          num(ind) = num(ind) + 1;
-	else
-          break;
-	endif
-      endwhile
-      rnd(k) = num;
+      rnd(k) = randp(l(k), size(k));
     endif
   endif
 
--- a/scripts/statistics/distributions/trnd.m	Thu Feb 22 07:07:20 2007 +0000
+++ b/scripts/statistics/distributions/trnd.m	Thu Feb 22 18:22:24 2007 +0000
@@ -70,7 +70,7 @@
     if (!(n > 0) || !(n < Inf))
       rnd = NaN * ones (sz);
     elseif ((n > 0) && (n < Inf))
-      rnd = tinv (rand (sz), n);
+      rnd = randn(sz) ./ sqrt(2*randg(n/2,sz)./n); 
     else
       rnd = zeros (size (n));
     endif
@@ -84,7 +84,7 @@
 
     k = find ((n > 0) & (n < Inf));
     if (any (k))
-      rnd(k) = tinv (rand (size (k)), n(k));
+      rnd(k) = randn(size(k)) ./ sqrt(2*randg(n(k)/2,size(k))./n(k)); 
     endif
   endif