changeset 4856:c89b9abf2ffd

[project @ 2004-04-08 03:24:12 by jwe]
author jwe
date Thu, 08 Apr 2004 03:24:12 +0000
parents d62c421f448b
children 9794d526639c
files scripts/statistics/distributions/beta_rnd.m scripts/statistics/distributions/binomial_rnd.m scripts/statistics/distributions/cauchy_rnd.m scripts/statistics/distributions/chisquare_rnd.m scripts/statistics/distributions/gamma_rnd.m scripts/statistics/distributions/normal_rnd.m scripts/statistics/distributions/uniform_rnd.m
diffstat 7 files changed, 70 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/statistics/distributions/beta_rnd.m	Wed Apr 07 02:41:22 2004 +0000
+++ b/scripts/statistics/distributions/beta_rnd.m	Thu Apr 08 03:24:12 2004 +0000
@@ -51,6 +51,11 @@
       error ("beta_rnd: c must be a positive integer");
     endif
     sz = [r, c];
+
+    if (any (size (a) != 1) && ((length (size (a)) != length (sz)) ||
+				any (size (a) != sz)))
+      error ("beta_rnd: a and b must be scalar or of size [r,c]");
+    endif
   elseif (nargin == 3)
     if (isscalar (r) && (r > 0))
       sz = [r, r];
@@ -59,6 +64,11 @@
     else
       error ("beta_rnd: r must be a postive integer or vector");
     endif
+
+    if (any (size (a) != 1) && ((length (size (a)) != length (sz)) ||
+				any (size (a) != sz)))
+      error ("beta_rnd: a and b must be scalar or of size sz");
+    endif
   elseif (nargin == 2)
     sz = size(a);
   else
--- a/scripts/statistics/distributions/binomial_rnd.m	Wed Apr 07 02:41:22 2004 +0000
+++ b/scripts/statistics/distributions/binomial_rnd.m	Thu Apr 08 03:24:12 2004 +0000
@@ -51,6 +51,11 @@
       error ("binomial_rnd: c must be a positive integer");
     endif
     sz = [r, c];
+
+    if (any (size (n) != 1) && ((length (size (n)) != length (sz)) ||
+				any (size (n) != sz)))
+      error ("binomial_rnd: n and must be scalar or of size [r, c]");
+    endif
   elseif (nargin == 3)
     if (isscalar (r) && (r > 0))
       sz = [r, r];
@@ -59,6 +64,11 @@
     else
       error ("binomial_rnd: r must be a postive integer or vector");
     endif
+
+    if (any (size (n) != 1) && ((length (size (n)) != length (sz)) ||
+				any (size (n) != sz)))
+      error ("binomial_rnd: n and must be scalar or of size sz");
+    endif
   elseif (nargin == 2)
     sz = size(n);
   else
--- a/scripts/statistics/distributions/cauchy_rnd.m	Wed Apr 07 02:41:22 2004 +0000
+++ b/scripts/statistics/distributions/cauchy_rnd.m	Thu Apr 08 03:24:12 2004 +0000
@@ -50,6 +50,11 @@
       error ("cauchy_rnd: c must be a positive integer");
     endif
     sz = [r, c];
+
+    if (any (size (l) != 1) && ((length (size (l)) != length (sz)) ||
+				any (size (l) != sz)))
+      error ("cauchy_rnd: lambda and sigma must be scalar or of size [r, c]");
+    endif
   elseif (nargin == 3)
     if (isscalar (r) && (r > 0))
       sz = [r, r];
@@ -58,6 +63,11 @@
     else
       error ("cauchy_rnd: r must be a postive integer or vector");
     endif
+
+    if (any (size (l) != 1) && ((length (size (l)) != length (sz)) ||
+				any (size (l) != sz)))
+      error ("cauchy_rnd: lambda and sigma must be scalar or of size sz");
+    endif
   elseif (nargin == 2)
     sz = size(l);
   else
--- a/scripts/statistics/distributions/chisquare_rnd.m	Wed Apr 07 02:41:22 2004 +0000
+++ b/scripts/statistics/distributions/chisquare_rnd.m	Thu Apr 08 03:24:12 2004 +0000
@@ -41,6 +41,11 @@
       error ("chisquare_rnd: c must be a positive integer");
     endif
     sz = [r, c];
+
+    if (any (size (n) != 1) && ((length (size (n)) != length (sz)) ||
+				any (size (n) != sz)))
+      error ("chisquare_rnd: n must be scalar or of size [r, c]");
+    endif
   elseif (nargin == 2)
     if (isscalar (r) && (r > 0))
       sz = [r, r];
@@ -49,6 +54,11 @@
     else
       error ("chisquare_rnd: r must be a postive integer or vector");
     endif
+
+    if (any (size (n) != 1) && ((length (size (n)) != length (sz)) ||
+				any (size (n) != sz)))
+      error ("chisquare_rnd: n must be scalar or of size sz");
+    endif
   elseif (nargin == 1)
     sz = size(n);
   else
--- a/scripts/statistics/distributions/gamma_rnd.m	Wed Apr 07 02:41:22 2004 +0000
+++ b/scripts/statistics/distributions/gamma_rnd.m	Thu Apr 08 03:24:12 2004 +0000
@@ -51,6 +51,11 @@
       error ("gamma_rnd: c must be a positive integer");
     endif
     sz = [r, c];
+
+    if (any (size (a) != 1) && ((length (size (a)) != length (sz)) ||
+				any (size (a) != sz)))
+      error ("gamma_rnd: a and b must be scalar or of size [r, c]");
+    endif
   elseif (nargin == 3)
     if (isscalar (r) && (r > 0))
       sz = [r, r];
@@ -59,6 +64,11 @@
     else
       error ("uniform_rnd: r must be a postive integer or vector");
     endif
+
+    if (any (size (a) != 1) && ((length (size (a)) != length (sz)) ||
+				any (size (a) != sz)))
+      error ("gamma_rnd: a and b must be scalar or of size sz");
+    endif
   elseif (nargin == 2)
     sz = size(a);
   else
--- a/scripts/statistics/distributions/normal_rnd.m	Wed Apr 07 02:41:22 2004 +0000
+++ b/scripts/statistics/distributions/normal_rnd.m	Thu Apr 08 03:24:12 2004 +0000
@@ -51,6 +51,11 @@
       error ("normal_rnd: c must be a positive integer");
     endif
     sz = [r, c];
+
+    if (any (size (m) != 1) && ((length (size (m)) != length (sz)) ||
+				any (size (m) != sz)))
+      error ("normal_rnd: m and v must be scalar or of size [r, c]");
+    endif
   elseif (nargin == 3)
     if (isscalar (r) && (r > 0))
       sz = [r, r];
@@ -59,6 +64,11 @@
     else
       error ("normal_rnd: r must be a postive integer or vector");
     endif
+
+    if (any (size (m) != 1) && ((length (size (m)) != length (sz)) ||
+				any (size (m) != sz)))
+      error ("normal_rnd: m and v must be scalar or of size sz");
+    endif
   elseif (nargin == 2)
     sz = size(m);
   else
--- a/scripts/statistics/distributions/uniform_rnd.m	Wed Apr 07 02:41:22 2004 +0000
+++ b/scripts/statistics/distributions/uniform_rnd.m	Thu Apr 08 03:24:12 2004 +0000
@@ -50,6 +50,11 @@
       error ("uniform_rnd: c must be a positive integer");
     endif
     sz = [r, c];
+
+    if (any (size (a) != 1) && ((length (size (a)) != length (sz)) ||
+				any (size (a) != sz)))
+      error ("uniform_rnd: a and b must be scalar or of size [r, c]");
+    endif
   elseif (nargin == 3)
     if (isscalar (r) && (r > 0))
       sz = [r, r];
@@ -58,6 +63,11 @@
     else
       error ("uniform_rnd: r must be a postive integer or vector");
     endif
+
+    if (any (size (a) != 1) && ((length (size (a)) != length (sz)) ||
+				any (size (a) != sz)))
+      error ("uniform_rnd: a and b must be scalar or of size sz");
+    endif
   elseif (nargin == 2)
     sz = size(a);
   else