[SciPy-dev] Where is the hyperu source?

Robert Kern robert.kern at gmail.com
Thu Dec 22 14:11:26 CST 2005


Tom Loredo wrote:
> Hi folks,
> 
> Where is the source code that calculates scipy.special.hyperu?
> I've done a "grep -i hyperu" in cephes and other subdirs of
> special, and can't find it.

[special]$ grep -ri hyperu .
Binary file ./_cephes.so matches
./_cephesmodule.c:      f = PyUFunc_FromFuncAndData(cephes3_functions,
hypU_data, cephes_4_types, 2, 3, 1, PyUFunc_None, "hyperu", hyperu_doc, 0);

...

hypU_data contains the appropriate function pointers.

[special]$ grep -ri hypu .
Binary file ./_cephes.so matches
./_cephesmodule.c:static void * hypU_data[] = { (void *)hypU_wrap, (void
*)hypU_wrap, };
./_cephesmodule.c:      f = PyUFunc_FromFuncAndData(cephes3_functions,
hypU_data, cephes_4_types, 2, 3, 1, PyUFunc_None, "hyperu", hyperu_doc, 0);
./specfun_wrappers.c:double hypU_wrap(double a, double b, double x) {

...

Looking at hypU_wrap in specfun_wrappers.c:

double hypU_wrap(double a, double b, double x) {
  double out;
  int md; /* method code --- not returned */

  F_FUNC(chgu,CHGU)(&a, &b, &x, &out, &md);
  if (out == 1e300) out = INFINITY;
  return out;

}

scipy/Lib/special/specfun/specfun.f:

        SUBROUTINE CHGU(A,B,X,HU,MD)
C
C       =======================================================
C       Purpose: Compute the confluent hypergeometric function
C                U(a,b,x)
C       Input  : a  --- Parameter
C                b  --- Parameter
C                x  --- Argument  ( x > 0 )
C       Output:  HU --- U(a,b,x)
C                MD --- Method code
C       Routines called:
C            (1) CHGUS for small x ( MD=1 )
C            (2) CHGUL for large x ( MD=2 )
C            (3) CHGUBI for integer b ( MD=3 )
C            (4) CHGUIT for numerical integration ( MD=4 )
C       =======================================================

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Scipy-dev mailing list