# HG changeset patch # User jwe # Date 1081394652 0 # Node ID c89b9abf2ffd7fa7854c8afc630effc295c5dd28 # Parent d62c421f448b3036651ee0b9e47aee58f189199b [project @ 2004-04-08 03:24:12 by jwe] diff --git a/scripts/statistics/distributions/beta_rnd.m b/scripts/statistics/distributions/beta_rnd.m --- a/scripts/statistics/distributions/beta_rnd.m +++ b/scripts/statistics/distributions/beta_rnd.m @@ -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 diff --git a/scripts/statistics/distributions/binomial_rnd.m b/scripts/statistics/distributions/binomial_rnd.m --- a/scripts/statistics/distributions/binomial_rnd.m +++ b/scripts/statistics/distributions/binomial_rnd.m @@ -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 diff --git a/scripts/statistics/distributions/cauchy_rnd.m b/scripts/statistics/distributions/cauchy_rnd.m --- a/scripts/statistics/distributions/cauchy_rnd.m +++ b/scripts/statistics/distributions/cauchy_rnd.m @@ -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 diff --git a/scripts/statistics/distributions/chisquare_rnd.m b/scripts/statistics/distributions/chisquare_rnd.m --- a/scripts/statistics/distributions/chisquare_rnd.m +++ b/scripts/statistics/distributions/chisquare_rnd.m @@ -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 diff --git a/scripts/statistics/distributions/gamma_rnd.m b/scripts/statistics/distributions/gamma_rnd.m --- a/scripts/statistics/distributions/gamma_rnd.m +++ b/scripts/statistics/distributions/gamma_rnd.m @@ -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 diff --git a/scripts/statistics/distributions/normal_rnd.m b/scripts/statistics/distributions/normal_rnd.m --- a/scripts/statistics/distributions/normal_rnd.m +++ b/scripts/statistics/distributions/normal_rnd.m @@ -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 diff --git a/scripts/statistics/distributions/uniform_rnd.m b/scripts/statistics/distributions/uniform_rnd.m --- a/scripts/statistics/distributions/uniform_rnd.m +++ b/scripts/statistics/distributions/uniform_rnd.m @@ -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