# HG changeset patch # User Rik # Date 1305091884 25200 # Node ID 48b9e8344a03c01a775f1e80e6f98a99c0b60d7d # Parent 0e3d7ad937fe1537b7cac14d665e46480187a89b# Parent 2c54fde0f39737ead891b3659f04339e7b4e5d33 Periodic merge of stable to default. diff --git a/mkoctfile.in b/mkoctfile.in --- a/mkoctfile.in +++ b/mkoctfile.in @@ -336,8 +336,8 @@ incflags="$incflags -I." output_ext=".mex" ;; - -W*) - pass_on_options="$pass_on_options $1" + -W,*) + pass_on_options="$pass_on_options ${1:3}" ;; *) echo "mkoctfile: unrecognized argument $1" 1>&2 diff --git a/scripts/miscellaneous/mkoctfile.m b/scripts/miscellaneous/mkoctfile.m --- a/scripts/miscellaneous/mkoctfile.m +++ b/scripts/miscellaneous/mkoctfile.m @@ -51,12 +51,13 @@ ## Add the run-time path to the link command. ## ## @item -Wl,@dots{} -## Pass flags though the linker like "-Wl,-rpath=@dots{}". +## Pass flags through the linker e.g. "-Wl,-rpath=@dots{}". ## The quotes are needed since commas are interpreted as command ## separators. ## -## @item -W@dots{} -## Pass flags though the compiler like "-Wa,OPTION". +## @item -W,@dots{} +## Pass flags through the compiler, e.g. "-W,-O2". The quotes are needed +## since commas are interpreted as command separators. ## ## @item -c ## Compile but do not link. diff --git a/scripts/specfun/betaln.m b/scripts/specfun/betaln.m --- a/scripts/specfun/betaln.m +++ b/scripts/specfun/betaln.m @@ -21,16 +21,17 @@ ## Return the natural logarithm of the Beta function, ## @tex ## $$ -## B (a, b) = \log {\Gamma (a) \Gamma (b) \over \Gamma (a + b)}. +## {\rm betaln} (a, b) = \ln (B (a,b)) \equiv \ln ({\Gamma (a) \Gamma (b) \over \Gamma (a + b)}). ## $$ ## @end tex ## @ifnottex ## ## @example -## betaln (a, b) = gammaln (a) + gammaln (b) - gammaln (a + b) +## betaln (a, b) = log (beta (a, b)) ## @end example ## ## @end ifnottex +## calculated in a way to reduce the occurrence of underflow. ## @seealso{beta, betainc, gammaln} ## @end deftypefn @@ -39,14 +40,18 @@ ## Keywords: log beta special function function retval = betaln (a, b) + if (nargin != 2) print_usage (); endif retval = gammaln (a) + gammaln (b) - gammaln (a + b); + endfunction -%!assert (betaln(3,4),log(beta(3,4)),eps) + +%!assert (betaln (3,4), log (beta(3,4)),eps); -%!error (betaln(1.)) -%!error (betaln(1.,1.,1.)) +%% Test input validation +%!error (betaln (1)) +%!error (betaln (1,2,3)) diff --git a/scripts/statistics/distributions/gampdf.m b/scripts/statistics/distributions/gampdf.m --- a/scripts/statistics/distributions/gampdf.m +++ b/scripts/statistics/distributions/gampdf.m @@ -48,7 +48,7 @@ pdf (k) = NaN; endif - k = find ((x > 0) & (a > 0) & (a <= 1) & (b > 0)); + k = find ((x >= 0) & (a > 0) & (a <= 1) & (b > 0)); if (any (k)) if (isscalar(a) && isscalar(b)) pdf(k) = (x(k) .^ (a - 1)) ... @@ -59,7 +59,7 @@ endif endif - k = find ((x > 0) & (a > 1) & (b > 0)); + k = find ((x >= 0) & (a > 1) & (b > 0)); if (any (k)) if (isscalar(a) && isscalar(b)) pdf(k) = exp (- a .* log (b) + (a-1) .* log (x(k)) diff --git a/src/DLD-FUNCTIONS/betainc.cc b/src/DLD-FUNCTIONS/betainc.cc --- a/src/DLD-FUNCTIONS/betainc.cc +++ b/src/DLD-FUNCTIONS/betainc.cc @@ -35,10 +35,10 @@ DEFUN_DLD (betainc, args, , "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} betainc (@var{x}, @var{a}, @var{b})\n\ -Return the incomplete Beta function,\n\ +Return the regularized incomplete Beta function,\n\ @tex\n\ $$\n\ - \\beta (x, a, b) = B (a, b)^{-1} \\int_0^x t^{(a-z)} (1-t)^{(b-1)} dt.\n\ + I (x, a, b) = {1 \\over {B (a, b)}} \\int_0^x t^{(a-z)} (1-t)^{(b-1)} dt.\n\ $$\n\ @end tex\n\ @ifnottex\n\ @@ -46,11 +46,12 @@ \n\ @smallexample\n\ @group\n\ - x\n\ - /\n\ -betainc (x, a, b) = beta (a, b)^(-1) | t^(a-1) (1-t)^(b-1) dt.\n\ - /\n\ - t=0\n\ +@c spacing appears odd here, but is correct after Makeinfo\n\ + x\n\ + 1 /\n\ +betainc (x, a, b) = ----------- | t^(a-1) (1-t)^(b-1) dt.\n\ + beta (a, b) /\n\ + t=0\n\ @end group\n\ @end smallexample\n\ \n\ diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -1455,6 +1455,8 @@ (@var{v1}, @dots{}) must be specified as character strings.\n\ \n\ @table @code\n\ +@item -append\n\ +Append to the destination instead of overwriting.\n\ @item -ascii\n\ Save a single matrix in a text file without header or any other information.\n\ \n\ diff --git a/src/mappers.cc b/src/mappers.cc --- a/src/mappers.cc +++ b/src/mappers.cc @@ -550,11 +550,12 @@ \n\ @example\n\ @group\n\ - z\n\ - /\n\ +@c spacing appears odd here, but is correct after Makeinfo\n\ + z\n\ + /\n\ erf (z) = (2/sqrt (pi)) | e^(-t^2) dt\n\ - /\n\ - t=0\n\ + /\n\ + t=0\n\ @end group\n\ @end example\n\ \n\ @@ -607,7 +608,7 @@ Compute the inverse error function, i.e., @var{y} such that\n\ \n\ @example\n\ - erf(@var{y}) == @var{x}\n\ + erf (@var{y}) == @var{x}\n\ @end example\n\ @seealso{erf, erfc, erfcx}\n\ @end deftypefn") @@ -644,7 +645,7 @@ $1 - {\\rm erf} (z)$.\n\ @end tex\n\ @ifnottex\n\ -@code{1 - erf (@var{z})}.\n\ +@w{@code{1 - erf (@var{z})}}.\n\ @end ifnottex\n\ @seealso{erfcx, erf, erfinv}\n\ @end deftypefn") @@ -671,10 +672,16 @@ @deftypefn {Mapping Function} {} erfcx (@var{z})\n\ Compute the scaled complementary error function,\n\ @tex\n\ -$z^2 (1 - {\\rm erf} (z))$.\n\ +$$\n\ + e^{z^2} {\\rm erfc} (z) \\equiv e^{z^2} (1 - {\\rm erf} (z))\n\ +$$\n\ @end tex\n\ @ifnottex\n\ -@code{z^2*(1 - erf (@var{z}))}.\n\ +\n\ +@example\n\ +exp (z^2) * erfc (x)\n\ +@end example\n\ +\n\ @end ifnottex\n\ @seealso{erfc, erf, erfinv}\n\ @end deftypefn") @@ -879,7 +886,8 @@ \n\ @example\n\ @group\n\ - infinity\n\ +@c spacing appears odd here, but is correct after Makeinfo\n\ + infinity\n\ /\n\ gamma (z) = | t^(z-1) exp (-t) dt.\n\ /\n\