Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

gamma function?

Adam_H_
Beginner
248 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
Black Belt
248 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.

Greg_T_
Valued Contributor I
248 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.

Martyn_C_Intel
Employee
248 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).

Adam_H_
Beginner
248 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.  

Reply