IMSL Fortran Stat Library
 
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_UVSTA/D_UVSTA (the root is “UVSTA ,” for “Basic Univariate Statistics”) and S_TWFRQ/D_TWFRQ (the root is “TWFRQ,” for “Two-Way Frequency Table”). Of course the generic name can be used as an entry point for all precisions supported.
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 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 STAT LIBRARY. 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 STAT LIBRARY, 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 section of this manual.
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 OWFRQ documentation (see Chapter 1, “Basic Statistics”), for tallying observation into a one-way frequency table. A description is provided for just one data type. There are two documented routines in this subject area: S_OWFRQ and D_OWFRQ.
These routines constitute single-precision and 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 OWFRQ_INT” is inserted near the top of any routine that calls the subprogram “OWFRQ”. More inclusive modules are also available. For example, the module named “imsl_libraries” contains the interface modules for all routines in the library.
Programming Conventions
In general, the IMSL STAT LIBRARY 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.
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 use of a “use” statement will continue to work as before. Also, 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.
Users wishing to update existing programs so as to call other routines from this library should incorporate a use statement for the specific new routine being called. (Here, the term “new routine” implies any routine in the library, only “new” to the user’s program.) Use of the more encompassing “imsl_libraries” module in this case could result in argument mismatches for the “old” routine(s) being called. (This would be caught by the compiler.)
Users wishing to update existing programs so as to call the new generic versions of the routines must change their calls to the existing routines so as to match the new calling sequences and use either the routine specific interface modules or the all encompassing “imsl_libraries” module.