# HG changeset patch # User jwe # Date 1191680120 0 # Node ID 0a64abe792f42ddc6e9de1e9901799a1f1e699ed # Parent c8fc3487ed2c5824767156da7e75632a6b8a9b2c [project @ 2007-10-06 14:15:19 by jwe] diff -r c8fc3487ed2c -r 0a64abe792f4 ChangeLog --- a/ChangeLog Sat Oct 06 12:57:59 2007 +0000 +++ b/ChangeLog Sat Oct 06 14:15:20 2007 +0000 @@ -1,3 +1,7 @@ +2007-10-06 John W. Eaton + + * configure.in: Check for lgamma and tgamma. + 2007-10-04 John W. Eaton * configure.in (UGLY_DEFS): Delete special case for darwin. diff -r c8fc3487ed2c -r 0a64abe792f4 configure.in --- a/configure.in Sat Oct 06 12:57:59 2007 +0000 +++ b/configure.in Sat Oct 06 14:15:20 2007 +0000 @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.578 $) +AC_REVISION($Revision: 1.579 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1432,12 +1432,12 @@ AC_CHECK_FUNCS(atexit basename bcopy bzero canonicalize_file_name chmod \ dup2 endgrent endpwent execvp fcntl fork getcwd getegid geteuid \ getgid getgrent getgrgid getgrnam getpgrp getpid getppid getpwent \ - getpwuid gettimeofday getuid getwd _kbhit kill link localtime_r \ + getpwuid gettimeofday getuid getwd _kbhit kill lgamma link localtime_r \ lstat memmove mkdir mkfifo mkstemp on_exit pipe poll putenv raise \ readlink realpath rename resolvepath rindex rmdir round select setgrent \ setlocale setpwent setvbuf sigaction siglongjmp sigpending sigprocmask \ sigsuspend snprintf stat strcasecmp strdup strerror stricmp \ - strncasecmp strnicmp strptime strsignal symlink tempnam umask \ + strncasecmp strnicmp strptime strsignal symlink tempnam tgamma umask \ uname unlink usleep utime vfprintf vsprintf vsnprintf waitpid \ _chmod _snprintf x_utime _utime32) diff -r c8fc3487ed2c -r 0a64abe792f4 liboctave/ChangeLog --- a/liboctave/ChangeLog Sat Oct 06 12:57:59 2007 +0000 +++ b/liboctave/ChangeLog Sat Oct 06 14:15:20 2007 +0000 @@ -1,3 +1,11 @@ +2007-10-06 John W. Eaton + + * lo-specfun.cc: (zlgamma): Delete. + (xgamma): Use C library gamma function if available. + (xlgamma): Use C library lgamma function if available. + (xlgamma) [! HAVE_LGAMMA]: Allow calculation for any value of X + other than NaN or Inf. + 2007-10-05 John W. Eaton * lo-specfun.cc (zlgamma): New function. diff -r c8fc3487ed2c -r 0a64abe792f4 liboctave/lo-specfun.cc --- a/liboctave/lo-specfun.cc Sat Oct 06 12:57:59 2007 +0000 +++ b/liboctave/lo-specfun.cc Sat Oct 06 14:15:20 2007 +0000 @@ -160,6 +160,9 @@ double xgamma (double x) { +#if defined (HAVE_TGAMMA) + return tgamma (x); +#else double result; if (xisnan (x)) @@ -168,42 +171,29 @@ result = octave_Inf; else F77_XFCN (xdgamma, XDGAMMA, (x, result)); + return result; +#endif } double xlgamma (double x) { +#if defined (HAVE_LGAMMA) + return lgamma (x); +#else double result; double sgngam; if (xisnan (x)) result = x; - else if (x <= 0 || xisinf (x)) + else if (xisinf (x)) result = octave_Inf; else F77_XFCN (dlgams, DLGAMS, (x, result, sgngam)); return result; -} - -Complex -zlgamma (double x) -{ - Complex result; - - if (xisnan (x)) - result = x; - else if (x > 0) - result = xlgamma (x); - else - { - double tmp = xgamma (x); - - result = tmp < 0 ? std::log (Complex (tmp)) : log (tmp); - } - - return result; +#endif } static inline Complex diff -r c8fc3487ed2c -r 0a64abe792f4 liboctave/lo-specfun.h --- a/liboctave/lo-specfun.h Sat Oct 06 12:57:59 2007 +0000 +++ b/liboctave/lo-specfun.h Sat Oct 06 14:15:20 2007 +0000 @@ -59,7 +59,6 @@ extern OCTAVE_API double xgamma (double x); extern OCTAVE_API double xlgamma (double x); -extern OCTAVE_API Complex zlgamma (double x); extern OCTAVE_API Complex besselj (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr); diff -r c8fc3487ed2c -r 0a64abe792f4 src/ChangeLog --- a/src/ChangeLog Sat Oct 06 12:57:59 2007 +0000 +++ b/src/ChangeLog Sat Oct 06 14:15:20 2007 +0000 @@ -1,3 +1,9 @@ +2007-10-06 John W. Eaton + + * mappers.cc (install_mapper_functions): Undo previous change. + Fix doc string for lgamma. + (xzlgamma): Delete. + 2007-10-05 John W. Eaton * graphics.h.in (axes::properties): New property, colororder. diff -r c8fc3487ed2c -r 0a64abe792f4 src/mappers.cc --- a/src/mappers.cc Sat Oct 06 12:57:59 2007 +0000 +++ b/src/mappers.cc Sat Oct 06 14:15:20 2007 +0000 @@ -172,21 +172,6 @@ return 0; } -// FIXME -- maybe our mapper function structure should alow for -// functions that take real arguments and produce complex values. -static Complex -xzlgamma (const Complex& x) -{ - Complex retval; - - if (x.imag () != 0) - error ("lgamma: expecting real arguments"); - else - retval = zlgamma (x.real ()); - - return retval; -} - void install_mapper_functions (void) { @@ -542,11 +527,12 @@ Return 1 for characters that are hexadecimal digits.\n\ @end deftypefn"); - DEFUN_MAPPER (lgamma, 0, 0, 0, xlgamma, 0, xzlgamma, 0.0, octave_Inf, 0, 1, + DEFUN_MAPPER (lgamma, 0, 0, 0, xlgamma, 0, 0, 0.0, 0.0, 0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} lgamma (@var{x})\n\ @deftypefnx {Mapping Function} {} gammaln (@var{x})\n\ -Return the natural logarithm of the gamma function.\n\ +Return the natural logarithm of the absolute value of the gamma\n\ +function of @var{x}.\n\ @seealso{gamma, gammai}\n\ @end deftypefn");