IMSL Fortran Math Special Functions Library
 
Introduction
The IMSL Fortran Numerical Libraries
The IMSL Libraries consist of two separate, but coordinated Libraries that allow easy user access. These Libraries are organized as follows:
*MATH LIBRARY general applied mathematics and special functions
The User’s Guide for IMSL MATH LIBRARY has two parts:
1. MATH LIBRARY
2. MATH LIBRARY Special Functions
*STAT/LIBRARY statistics
Most of the routines are available in both single and double precision versions. Many routines are also available for complex and complex‑double precision arithmetic. The same user interface is found on the many hardware versions that span the range from personal computer to supercomputer. Note that some IMSL routines are not distributed for FORTRAN compiler environments that do not support double precision complex data. The specific names of the IMSL routines that return or accept the type double complex begin with the letter “Z” and, occasionally, “DC.”
Getting Started
IMSL MATH LIBRARY Special Functions is a collection of FORTRAN subroutines and functions useful in research and statistical analysis. Each routine is designed and documented to be used in research activities as well as by technical specialists.
To use any of these routines, you must write a program in FORTRAN (or possibly some other language) to call the MATH LIBRARY Special Functions routine. Each routine conforms to established conventions in programming and documentation. We give first priority in development to efficient algorithms, clear documentation, and accurate results. The uniform design of the routines makes it easy to use more than one routine in a given application. Also, you will find that the design consistency enables you to apply your experience with one MATH LIBRARY Special Functions routine to all other IMSL routines that you use.
Finding the Right Routine
The organization of IMSL MATH LIBRARY Special Functions closely parallels that of the National Bureau of Standards’ Handbook of Mathematical Functions, edited by Abramowitz and Stegun (1964). Corresponding to the NBS Handbook, functions are arranged into separate chapters, such as elementary functions, trigonometric and hyperbolic functions, exponential integrals, gamma function and related functions, and Bessel functions. To locate the right routine for a given problem, you may use either the table of contents located in each chapter introduction, or one of the indexes at the end of this manual.
Organization of the Documentation
This manual contains a concise description of each routine, with at least one demonstrated example of each routine, including sample input and results. You will find all information pertaining to the Special Functions Library in this manual. Moreover, all information pertaining to a particular routine is in one place within a chapter.
Each chapter begins with an introduction followed by a table of contents that lists the routines included in the chapter. Documentation of the routines consists of the following information:
*IMSL Routine’s Generic Name
*Purpose: a statement of the purpose of the routine. If the routine is a function rather than a subroutine the purpose statement will reflect this fact.
*Function Return Value: a description of the return value (for functions only).
*Required Arguments: a description of the required arguments in the order of their occurrence. Input arguments usually occur first, followed by input/output arguments, with output arguments described last. Futhermore, the following terms apply to arguments:
Input Argument must be initialized; it is not changed by the routine.
Input/Output Argument must be initialized; the routine returns output through this argument; cannot be a constant or an expression.
Input or Output Select appropriate option to define the argument as either input or output. See individual routines for further instructions.
Output No initialization is necessary; cannot be a constant or an expression. The routine returns output through this argument.
*Optional Arguments: a description of the optional arguments in the order of their occurrence.
*Fortran 90 Interface: a section that describes the generic and specific interfaces to the routine.
*Fortran 77 Style Interface: an optional section, which describes Fortran 77 style interfaces, is supplied for backwards compatibility with previous versions of the Library.
*ScaLAPACK Interface: an optional section, which describes an interface to a ScaLAPACK based version of this routine.
*Description: a description of the algorithm and references to detailed information. In many cases, other IMSL routines with similar or complementary functions are noted.
*Comments: details pertaining to code usage.
*Programming notes: an optional section that contains programming details not covered elsewhere.
*Example: at least one application of this routine showing input and required dimension and type statements.
*Output: results from the example(s). Note that unique solutions may differ from platform to platform.
*Additional Examples: an optional section with additional applications of this routine showing input and required dimension and type statements.
Naming Conventions
The names of the routines are mnemonic and unique. Most routines are available in both a single precision and a double precision version, with names of the two versions sharing a common root. The root name is also the generic interface name. The name of the double precision specific version begins with a“D”. The single precision specific version begins with an “S_”. For example, the following pairs are precision specific names of routines in the two different precisions: S_GAMDF/D_GAMDF (the root is “GAMDF ,” for “Gamma distribution function”) and S_POIDF/D_POIDF (the root is “POIDF,” for “Poisson distribution function”). The precision specific names of the IMSL routines that return or accept the type complex data begin with the letter “C_” or “Z_” for complex or double complex, respectively. Of course the generic name can be used as an entry point for all precisions supported.
When this convention is not followed the generic and specific interfaces are noted in the documentation. For example, in the case of the BLAS and trigonometric intrinsic functions where standard names are already established, the standard names are used as the precision specific names. There may also be other interfaces supplied to the routine to provide for backwards compatibility with previous versions of the Library. These alternate interfaces are noted in the documentation when they are available.
Except when expressly stated otherwise, the names of the variables in the argument lists follow the FORTRAN default type for integer and floating point. In other words, a variable whose name begins with one of the letters “I” through “N” is of type INTEGER, and otherwise is of type REAL or DOUBLE PRECISION, depending on the precision of the routine.
An assumed‑size array with more than one dimension that is used as a FORTRAN argument can have an assumed‑size declarator for the last dimension only. In the MATH LIBRARY Special Functions routines, the information about the first dimension is passed by a variable with the prefix “LD” and with the array name as the root. For example, the argument LDA contains the leading dimension of array A. In most cases, information about the dimensions of arrays is obtained from the array through the use of Fortran 90’s size function. Therefore, arguments carrying this type of information are usually defined as optional arguments.
Where appropriate, the same variable name is used consistently throughout a chapter in the MATH LIBRARY Special Functions. For example, in the routines for random number generation, NR denotes the number of random numbers to be generated, and R or IR denotes the array that stores the numbers.
When writing programs accessing the MATH LIBRARY Special Functions, the user should choose FORTRAN names that do not conflict with names of IMSL subroutines, functions, or named common blocks. The careful user can avoid any conflicts with IMSL names if, in choosing names, the following rules are observed:
*Do not choose a name that appears in the Alphabetical Summary of Routines, at the end of the User’s Manual, nor one of these names preceded by a D, S_, D_, C_, or Z_.
*Do not choose a name consisting of more than three characters with a numeral in the second or third position.
For further details, see the section on Reserved Names in the Reference Material.
Using Library Subprograms
The documentation for the routines uses the generic name and omits the prefix, and hence the entire suite of routines for that subject is documented under the generic name.
Examples that appear in the documentation also use the generic name. To further illustrate this principle, note the BSJNS documentation (see Chapter 6, “Bessel Functions”, of this manual). A description is provided for just one data type. There are four documented routines in this subject area: S_BSJNS, D_BSJNS, C_BSJNS, and Z_BSJNS.
These routines constitute single‑precision, double‑precision, complex, and complex double‑precision versions of the code.
The appropriate routine is identified by the Fortran 90 compiler. Use of a module is required with the routines. The naming convention for modules joins the suffix “_int” to the generic routine name. Thus, the line “use BSJNS_INT” is inserted near the top of any routine that calls the subprogram “BSJNS”. More inclusive modules are also available. For example, the module named imsl_libraries contains the interface modules for all routines in the library.
When dealing with a complex matrix, all references to the transpose of a matrix, are replaced by the adjoint matrix
where the overstrike denotes complex conjugation. IMSL Fortran Numerical Library linear algebra software uses this convention to conserve the utility of generic documentation for that code subject. All references to orthogonal matrices are to be replaced by their complex counterparts, unitary matrices. Thus, an n x n orthogonal matrix Q satisfies the condition . An n x n unitary matrix V satisfies the analogous condition for complex matrices, .
Programming Conventions
In general, the IMSL MATH LIBRARY Special Functions codes are written so that computations are not affected by underflow, provided the system (hardware or software) places a zero value in the register. In this case, system error messages indicating underflow should be ignored.
IMSL codes also are written to avoid overflow. A program that produces system error messages indicating overflow should be examined for programming errors such as incorrect input data, mismatch of argument types, or improper dimensioning.
In many cases, the documentation for a routine points out common pitfalls that can lead to failure of the algorithm.
Library routines detect error conditions, classify them as to severity, and treat them accordingly. This error‑handling capability provides automatic protection for the user without requiring the user to make any specific provisions for the treatment of error conditions. See the section on User Errors in the Reference Material for further details.