changeset 4031:2168f4a0e88d

[project @ 2002-08-10 04:22:52 by jwe]
author jwe
date Sat, 10 Aug 2002 04:22:52 +0000
parents 22bd65326ec1
children 20d706a6740f
files scripts/ChangeLog scripts/configure.in scripts/deprecated/Makefile.in scripts/deprecated/is_bool.m scripts/deprecated/is_complex.m scripts/deprecated/is_global.m scripts/deprecated/is_list.m scripts/deprecated/is_matrix.m scripts/deprecated/is_stream.m scripts/deprecated/is_struct.m scripts/miscellaneous/bincoeff.m scripts/specfun/beta.m scripts/special-matrix/invhilb.m scripts/statistics/distributions/beta_cdf.m scripts/statistics/distributions/binomial_cdf.m scripts/statistics/distributions/f_cdf.m scripts/statistics/distributions/gamma_cdf.m scripts/statistics/distributions/gamma_pdf.m scripts/statistics/distributions/poisson_cdf.m scripts/statistics/distributions/poisson_pdf.m scripts/statistics/distributions/t_cdf.m
diffstat 21 files changed, 332 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/ChangeLog	Sat Aug 10 04:22:52 2002 +0000
@@ -1,3 +1,25 @@
+2002-08-09  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* configure.in (AC_CONFIG_FILES): Add deprecated/Makefile to the
+	list.
+	* deprecated/Makefile.in: New file.
+
+2002-08-09  Paul Kienzle <pkienzle@users.sf.net>
+
+	* statistics/distributions/beta_cdf.m: Replace betai with betainc.
+	* statistics/distributions/binomial_cdf.m: Likewise.
+	* statistics/distributions/f_cdf.m: Likewise.
+	* statistics/distributions/t_cdf.m: Likewise.
+
+	* miscellaneous/bincoeff.m: Replace lgamma with gammaln.
+	* specfun/beta.m: Likewise.
+	* special-matrix/invhilb.m: Likewise (but it is only in a comment).
+	* statistics/distributions/gamma_pdf.m: Likewise.
+	* statistics/distributions/poisson_pdf.m: Likewise.
+
+	* statistics/distributions/gamma_cdf.m: replace gammai with gammainc
+	* statistics/distributions/poisson_cdf.m: Likewise.
+
 2002-08-09  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* deprecated/is_bool.m: New file.
--- a/scripts/configure.in	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/configure.in	Sat Aug 10 04:22:52 2002 +0000
@@ -27,9 +27,10 @@
 
 AC_PROG_INSTALL
 
-AC_CONFIG_FILES([Makefile audio/Makefile control/Makefile control/base/Makefile \
-	  control/hinf/Makefile control/obsolete/Makefile \
-	  control/system/Makefile control/util/Makefile elfun/Makefile \
+AC_CONFIG_FILES([Makefile audio/Makefile control/Makefile \
+	  control/base/Makefile control/hinf/Makefile \
+	  control/obsolete/Makefile control/system/Makefile \
+	  control/util/Makefile deprecated/Makefile elfun/Makefile \
 	  finance/Makefile general/Makefile image/Makefile io/Makefile \
 	  linear-algebra/Makefile miscellaneous/Makefile plot/Makefile \
 	  polynomial/Makefile quaternion/Makefile set/Makefile \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/Makefile.in	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,75 @@
+#
+# Makefile for octave's scripts/deprecated directory
+#
+# John W. Eaton
+# jwe@bevo.che.wisc.edu
+# University of Wisconsin-Madison
+# Department of Chemical Engineering
+
+TOPDIR = ../..
+
+script_sub_dir = deprecated
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+include $(TOPDIR)/Makeconf
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+SOURCES = *.m
+
+DISTFILES = Makefile.in $(SOURCES)
+
+FCN_FILES = $(wildcard $(srcdir)/*.m)
+FCN_FILES_NO_DIR = $(notdir $(FCN_FILES))
+
+BINDISTFILES = $(FCN_FILES)
+
+all:
+.PHONY: all
+
+install install-strip:
+	$(top_srcdir)/mkinstalldirs $(fcnfiledir)/$(script_sub_dir)
+	for f in $(FCN_FILES_NO_DIR); do \
+	  rm -f $(fcnfiledir)/$(script_sub_dir)/$$f; \
+	  $(INSTALL_DATA) $(srcdir)/$$f $(fcnfiledir)/$(script_sub_dir)/$$f; \
+	done
+.PHONY: install install-strip
+
+uninstall:
+	for f in $(FCN_FILES_NO_DIR); \
+	  do rm -f $(fcnfiledir)/$(script_sub_dir)/$$f; \
+	done
+.PHONY: uninstall
+
+clean:
+.PHONY: clean
+
+tags: $(SOURCES)
+	ctags $(SOURCES)
+
+TAGS: $(SOURCES)
+	etags $(SOURCES)
+
+mostlyclean: clean
+.PHONY: mostlyclean
+
+distclean: clean
+	rm -f Makefile
+.PHONY: distclean
+
+maintainer-clean: distclean
+	rm -f tags TAGS
+.PHONY: maintainer-clean
+
+dist:
+	ln $(DISTFILES) ../../`cat ../../.fname`/scripts/deprecated
+.PHONY: dist
+
+bin-dist:
+	ln $(BINDISTFILES) ../../`cat ../../.fname`/scripts/deprecated
+.PHONY: bin-dist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/is_bool.m	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,31 @@
+## Copyright (C) 2002 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} is_bool (@var{a})
+## This function has been deprecated.  Use isbool instead.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = is_bool (varargin)
+
+  retval = isbool (varargin{:});
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/is_complex.m	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,31 @@
+## Copyright (C) 2002 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} is_complex (@var{a})
+## This function has been deprecated.  Use iscomplex instead.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = is_complex (varargin)
+
+  retval = iscomplex (varargin{:});
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/is_global.m	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,31 @@
+## Copyright (C) 2002 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} is_global (@var{a})
+## This function has been deprecated.  Use isglobal instead.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = is_global (varargin)
+
+  retval = isglobal (varargin{:});
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/is_list.m	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,31 @@
+## Copyright (C) 2002 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} is_list (@var{a})
+## This function has been deprecated.  Use islist instead.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = is_list (varargin)
+
+  retval = islist (varargin{:});
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/is_matrix.m	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,31 @@
+## Copyright (C) 2002 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} is_matrix (@var{a})
+## This function has been deprecated.  Use ismatrix instead.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = is_matrix (varargin)
+
+  retval = ismatrix (varargin{:});
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/is_stream.m	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,31 @@
+## Copyright (C) 2002 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} is_stream (@var{a})
+## This function has been deprecated.  Use isstream instead.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = is_stream (varargin)
+
+  retval = isstream(varargin{:});
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/is_struct.m	Sat Aug 10 04:22:52 2002 +0000
@@ -0,0 +1,31 @@
+## Copyright (C) 2002 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} is_struct (@var{a})
+## This function has been deprecated.  Use isstruct instead.
+## @end deftypefn
+
+## Author: jwe
+
+function retval = is_struct (varargin)
+
+  retval = isstruct (varargin{:});
+
+endfunction
--- a/scripts/miscellaneous/bincoeff.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/miscellaneous/bincoeff.m	Sat Aug 10 04:22:52 2002 +0000
@@ -83,14 +83,14 @@
 
   ind = find ((k > 0) & ((n == real (round (n))) & (n < 0)));
   if any (ind)
-    b(ind) = (-1) .^ k(ind) .* exp (lgamma (abs (n(ind)) + k(ind)) ...
-        - lgamma (k(ind) + 1) - lgamma (abs (n(ind))));
+    b(ind) = (-1) .^ k(ind) .* exp (gammaln (abs (n(ind)) + k(ind)) ...
+        - gammaln (k(ind) + 1) - gammaln (abs (n(ind))));
   endif
 
   ind = find ((k > 0) & ((n != real (round (n))) | (n >= k)));
   if (length (ind) > 0)
-    b(ind) = exp (lgamma (n(ind) + 1) - lgamma (k(ind) + 1) ...
-        - lgamma (n(ind) - k(ind) + 1));
+    b(ind) = exp (gammaln (n(ind) + 1) - gammaln (k(ind) + 1) ...
+        - gammaln (n(ind) - k(ind) + 1));
   endif
 
   ## clean up rounding errors
--- a/scripts/specfun/beta.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/specfun/beta.m	Sat Aug 10 04:22:52 2002 +0000
@@ -45,6 +45,6 @@
     usage ("beta (a, b)");
   endif
 
-  retval = exp (lgamma (a) + lgamma (b) - lgamma (a+b));
+  retval = exp (gammaln (a) + gammaln (b) - gammaln (a+b));
 
 endfunction
--- a/scripts/special-matrix/invhilb.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/special-matrix/invhilb.m	Sat Aug 10 04:22:52 2002 +0000
@@ -85,7 +85,7 @@
     ## machine number, the result is also exact.  Otherwise we calculate
     ## (-1)^(i+j)*p(i)*(p(j)/(i+j-1)).
     ##
-    ## The Octave bincoeff routine uses transcendental functions (lgamma
+    ## The Octave bincoeff routine uses transcendental functions (gammaln
     ## and exp) rather than multiplications, for the sake of speed.  
     ## However, it rounds the answer to the nearest integer, which 
     ## justifies the claim about exactness made above.
--- a/scripts/statistics/distributions/beta_cdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/beta_cdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -57,7 +57,7 @@
 
   k = find ((x > 0) & (x < 1) & (a > 0) & (b > 0));
   if (any (k))
-    cdf (k) = betai (a(k), b(k), x(k));
+    cdf (k) = betainc (x(k), a(k), b(k));
   endif
 
   cdf = reshape (cdf, r, c);
--- a/scripts/statistics/distributions/binomial_cdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/binomial_cdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -60,7 +60,7 @@
 	    & (p >= 0) & (p <= 1));
   if (any (k))
     tmp = floor (x(k));
-    cdf(k) = 1 - betai (tmp + 1, n(k) - tmp, p(k));
+    cdf(k) = 1 - betainc (p(k), tmp + 1, n(k) - tmp);
   endif
 
   cdf = reshape (cdf, r, c);
--- a/scripts/statistics/distributions/f_cdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/f_cdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -57,7 +57,7 @@
 
   k = find ((x > 0) & (x < Inf) & (m > 0) & (n > 0));
   if (any (k))
-    cdf(k) = 1 - betai (n(k) / 2, m(k) / 2, 1 ./ (1 + m(k) .* x(k) ./ n(k)));
+    cdf(k) = 1 - betainc (1 ./ (1 + m(k) .* x(k) ./ n(k)), n(k) / 2, m(k) / 2);
   endif
 
   cdf = reshape (cdf, r, c);
--- a/scripts/statistics/distributions/gamma_cdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/gamma_cdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -52,7 +52,7 @@
 
   k = find ((x > 0) & (a > 0) & (b > 0));
   if (any (k))
-    cdf (k) = gammai (a(k), b(k) .* x(k));
+    cdf (k) = gammainc (b(k) .* x(k), a(k));
   endif
 
   cdf = reshape (cdf, r, c);
--- a/scripts/statistics/distributions/gamma_pdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/gamma_pdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -59,7 +59,7 @@
   k = find ((x > 0) & (a > 1) & (b > 0));
   if (any (k))
     pdf(k) = exp (a(k) .* log (b(k)) + (a(k)-1) .* log (x(k))
-		  - b(k) .* x(k) - lgamma (a(k)));
+		  - b(k) .* x(k) - gammaln (a(k)));
   endif
 
   pdf = reshape (pdf, r, c);
--- a/scripts/statistics/distributions/poisson_cdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/poisson_cdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -56,7 +56,7 @@
 
   k = find ((x >= 0) & (x < Inf) & (l > 0));
   if (any (k))
-    cdf(k) = 1 - gammai (floor (x(k)) + 1, l(k));
+    cdf(k) = 1 - gammainc (l(k), floor (x(k)) + 1);
   endif
 
   cdf = reshape (cdf, r, c);
--- a/scripts/statistics/distributions/poisson_pdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/poisson_pdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -50,7 +50,7 @@
 
   k = find ((x >= 0) & (x < Inf) & (x == round (x)) & (l > 0));
   if (any (k))
-    pdf(k) = exp (x(k) .* log (l(k)) - l(k) - lgamma (x(k) + 1));
+    pdf(k) = exp (x(k) .* log (l(k)) - l(k) - gammaln (x(k) + 1));
   endif
 
   pdf = reshape (pdf, r, c);
--- a/scripts/statistics/distributions/t_cdf.m	Fri Aug 09 19:00:16 2002 +0000
+++ b/scripts/statistics/distributions/t_cdf.m	Sat Aug 10 04:22:52 2002 +0000
@@ -56,7 +56,7 @@
 
   k = find ((x > -Inf) & (x < Inf) & (n > 0));
   if (any (k))
-    cdf(k) = betai (n(k) / 2, 1 / 2, 1 ./ (1 + x(k) .^ 2 ./ n(k))) / 2;
+    cdf(k) = betainc (1 ./ (1 + x(k) .^ 2 ./ n(k)), n(k) / 2, 1 / 2) / 2;
     ind = find (x(k) > 0);
     if (any (ind))
       cdf(k(ind)) = 1 - cdf(k(ind));