IMSL Fortran Math Special Functions Library
 
Module Usage
Users are required to incorporate a “use” statement near the top of their program for the IMSL routine being called when writing new code that uses this library. However, legacy code which calls routines in the previous version of the library without the presence of a “use” statement will continue to work as before. The example programs throughout this manual demonstrate the syntax for including use statements in your program. In addition to the examples programs, common cases of when and how to employ a use statement are described below.
*Users writing new programs calling the generic interface to IMSL routines must include a use statement near the top of any routine that calls the IMSL routines. The naming convention for modules joins the suffix “_int” to the generic routine name. For example, if a new program is written calling the IMSL routines LFTRG and LFSRG, then the following use statements should be inserted near the top of the program
USE LFTRG_INT
USE LFSRG_INT
In addition to providing interface modules for each routine individually, we also provide a module named “imsl_libraries”, which contains the generic interfaces for all routines in the library. For programs that call several different IMSL routines using generic interfaces, it can be simpler to insert the line
USE IMSL_LIBRARIES
rather than list use statements for every IMSL subroutine called.
*Users wishing to update existing programs to call other routines from this library should incorporate a use statement for the new routine being called. (Here, the term “new routine” implies any routine in the library, only “new” to the user’s program.) For example, if a call to the generic interface for the routine LSARG is added to an existing program, then
USE LSARG_INT
should be inserted near the top of your program.
*Users wishing to update existing programs to call the new generic versions of the routines must change their calls to the existing routines to match the new calling sequences and use either the routine specific interface modules or the all encompassing “imsl_libraries” module.
*Code which employed the “use numerical_libraries” statement from the previous version of the library will continue to work properly with this version of the library.
Programming Tips
It is strongly suggested that users force all program variables to be explicitly typed. This is done by including the line “IMPLICIT NONE” as close to the first line as possible. Study some of the examples accompanying an IMSL Fortran Numerical Library routine early on. These examples are available online as part of the product.
Each subject routine called or otherwise referenced requires the “use” statement for an interface block designed for that subject routine. The contents of this interface block are the interfaces to the separate routines available for that subject. Packaged descriptive names for option numbers that modify documented optional data or internal parameters might also be provided in the interface block. Although this seems like an additional complication, many typographical errors are avoided at an early stage in development through the use of these interface blocks. The “use” statement is required for each routine called in the user’s program.
However, if one is only using the Fortran 77 interfaces supplied for backwards compatibility then the “use” statements are not required.
Optional Subprogram Arguments
IMSL Fortran Numerical Library routines have required arguments and may have optional arguments. All arguments are documented for each routine. For example, consider the routine GCIN which evaluates the inverse of a general continuous CDF. The required arguments are P, X, and F. The optional arguments are IOPT and M. Both IOPT and M take on default values so are not required as input by the user unless the user wishes for these arguments to take on some value other than the default. Often there are other output arguments that are listed as optional because although they may contain information that is closely connected with the computation they are not as compelling as the primary problem. In our example code, GCIN, if the user wishes to input the optional argument “IOPT” then the use of the keyword “IOPT=” in the argument list to assign an input value to IOPT would be necessary.
For compatibility with previous versions of the IMSL Libraries, the NUMERICAL_LIBRARIES interface module includes backwards compatible positional argument interfaces to all routines which existed in the Fortran 77 version of the Library. Note that it is not necessary to use “use” statements when calling these routines by themselves. Existing programs which called these routines will continue to work in the same manner as before.
Error Handling
The routines in IMSL MATH LIBRARY Special Functions attempt to detect and report errors and invalid input. Errors are classified and are assigned a code number. By default, errors of moderate or worse severity result in messages being automatically printed by the routine. Moreover, errors of worse severity cause program execution to stop. The severity level as well as the general nature of the error is designated by an “error type” with numbers from 0 to 5. An error type 0 is no error; types 1 through 5 are progressively more severe. In most cases, you need not be concerned with our method of handling errors. For those interested, a complete description of the error‑handling system is given in the Reference Material, which also describes how you can change the default actions and access the error code numbers.