Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

gamma function?

Adam_H_
Beginner
811 Views

I've been going in circles on this one (I'm probably orbiting a very simple answer).  Is there a gamma function (for non-integers) in version 11.0?  There are some indications from my searching that it exists in the libimf library but I thought that this was linked by default.  I tried forcing this through "-L -limf" and didn't find "gamma" or "tgamma".  I also tried MKL but I'm not finding it there either.  Thanks!

0 Kudos
4 Replies
mecej4
Honored Contributor III
811 Views

I believe that some the Intel RT libraries (such as libmmd.lib) contain a gamma function callable from C. I can only see lower-case names containing 'gamma' in the symbols in, for example, libmmd.lib.  I believe that that function gives ln Γ(x), rather than Γ(x).

Fortran 2008 provides the gamma function, but your 11.1 compiler probably does not.

However, the old Amos library at http://www.netlib.org/amos/ should serve you fine for now.

0 Kudos
Greg_T_
Valued Contributor I
811 Views

Hi Adam,

You could obtain a gamma function subroutine source file that you could include in your project from the NIST Guide to Available Mathematical Software (GAMS): http://gams.nist.gov/

At that site you can use the name search for "gamma" to find several possible routines that might be useful.

Regards,
Greg T.

0 Kudos
Martyn_C_Intel
Employee
811 Views

I believe the Intel Fortran Compiler version 12.0 introduced the Fortran 2008 intrinsics GAMMA() and LOG_GAMMA()   (along with various others, such as Bessel functions,  error functions and a bunch of other Fortran 2008 features.). The library containing them, libimf, is linked automatically.

The version 11 compiler is simply too old to have all these features from Fortran 2008. Are you able to upgrade? (Current compiler version is 17.0).

0 Kudos
Adam_H_
Beginner
811 Views

Thanks, everyone!  The source code that Greg T. suggested is tempting since I don't have to go through the hassle of upgrading the compiler.  However, an upgrade is probably the best solution at this point since I'm many versions behind.  

0 Kudos
Reply