Deprecated Features and Renamed Routines
Automatic Workspace Allocation
FORTRAN subroutines that work with arrays as input and output often require extra arrays for use as workspace while doing computations or moving around data. IMSL routines generally do not require the user explicitly to allocate such arrays for use as workspace. On most systems the workspace allocation is handled transparently. The only limitation is the actual amount of memory available on the system.
On some systems the workspace is allocated out of a stack that is passed as a FORTRAN array in a named common block WORKSP. A very similar use of a workspace stack is described by Fox et al. (1978, pages 116‑121). (For compatiblity with older versions of the IMSL Libraries, space is allocated from the COMMON block, if possible.)
The arrays for workspace appear as arguments in lower‑level routines. For example, the IMSL routine FREQ (see Chapter 1, “Basic Statistics”), which computes frequency tabulations, needs arrays for workspace. FREQ allocates arrays from the common area and passes them to the lower‑level routine F2EQ, which does the computations. In the “Comments” section of the documentation for FREQ, the amount of workspace is noted, and the call to F2EQ is described. This scheme for using lower‑level routines is followed throughout the IMSL Libraries. The names of these routines have a “2” in the second position (or in the third position in double precision routines having a “D” prefix). The user can provide workspace explicitly and call directly the “2‑level” routine, which is documented along with the main routine. In a very few cases, the 2‑level routine allows additional options that the main routine does not allow.
Prior to returning to the calling program, a routine that allocates workspace generally deallocates that space, so that it becomes available for use in other routines. There are some exceptions to this, as noted in the section “IDO Routines” which follows later in this chapter.
Changing the Amount of Space Allocated
This section is relevant only to those systems on which the transparent workspace allocator is not available.
By default, the total amount of space allocated in the common area for storage of numeric data is 5000 numeric storage units. (A numeric storage unit is the amount of space required to store an integer or a real number. By comparison, a double precision unit is twice this amount. Therefore the total amount of space allocated in the common area for storage of numeric data is 2500 double precision units.) This space is allocated as needed for INTEGER, REAL, or other numeric data. For larger problems in which the default amount of workspace is insufficient, the user can change the allocation by supplying the FORTRAN statements to define the array in the named common block and by informing the IMSL workspace allocation system of the new size of the common array. To request 7000 units, the statements are
COMMON /WORKSP/ RWKSP
REAL RWKSP(7000)
CALL IWKIN(7000)
If an IMSL routine attempts to allocate workspace in excess of the amount available in the common stack, the routine issues a fatal error message that indicates how much space is needed and prints statements like those above to guide the user in allocating the necessary amount. The program below uses IMSL routine PERMA (Chapter 19, “Utilities”) to permute rows or columns of a matrix. This routine requires workspace equal to the number of columns, which in this example is too large. (Note that the work vector RWKSP must also provide extra space for bookkeeping.)
! Specifications for local variables
INTEGER NRA, NCA, LDA, IPERMU(6000), IPATH
REAL A(2,6000)
! Specifications for subroutines
EXTERNAL PERMA
!
NRA = 2
NCA = 6000
LDA = 2
! Initialize permutation index
DO 10 I = 1, NCA
IPERMU(I) = NCA + 1 - I
10 CONTINUE
IPATH = 2
CALL PERMA (NRA, NCA, A, LDA, IPERMU, IPATH, A, LDA)
END
Output
*** TERMINAL ERROR 10 from PERMA. Insufficient workspace for current
*** allocation(s). Correct by calling IWKIN from main program with
*** the three following statements: (REGARDLESS OF PRECISION)
*** COMMON /WORKSP/ RWKSP
*** REAL RWKSP(6018)
*** CALL IWKIN(6018)
*** TERMINAL ERROR 10 from PERMA. Workspace allocation was based on NCA =
*** 6000.
In most cases, the amount of workspace is dependent on the parameters of the problem so the amount needed is known exactly. In a few cases, however, the amount of workspace is dependent on the data (for example, if it is necessary to count all of the unique values in a vector), so the IMSL routine cannot tell in advance exactly how much workspace is needed. In such cases the error message printed is an estimate of the amount of space required.
IDO Routines
Some routines with an argument named “IDO” allocate workspace automatically and store intermediate results in elements of workspace that are referenced in subsequent calls. Typically, these routines are called in a loop. With each call, some rows of the data set are input to the routine and statistics stored in workspace are updated. In this case, the workspace must be preserved between calls.
For these routines, when IDO indicates this is the first call, the routine allocates workspace; when IDO indicates this is the last call, the routine deallocates the workspace. Because of the way this workspace is allocated and deallocated, no IMSL routine requiring additional automatic workspace can be used between these two calls. If it is necessary to call additional routines requiring workspace, use the 2‑level routines and explicitly allocate the work arrays.
Not all IDO routines require workspace to be preserved between their first and last call. Some may not even use workspace. Others may allocate and deallocate workspace with each call. The statement “workspace should not be changed between calls” will be in the description of the “IDO” routine that requires that workspace be preserved. (This statement will occur in the description of one or more of the workspace arguments for the 2‑level routine.)
Character Workspace
Since character arrays cannot be equivalenced with numeric arrays, a separate named common block WKSPCH is provided for character workspace. In most respects this stack is managed in the same way as the numeric stack. The default size of the character workspace is 2000 character units. (A character unit is the amount of space required to store one character.) The routine analogous to IWKIN used to change the default allocation is IWKCIN.
The routines in the following list are being deprecated in Version 2.0 of STAT/LIBRARY. A deprecated routine is one that is no longer used by anything in the library but is being included in the product for those users who may be currently referencing it in their application. However, any future versions of STAT/LIBRARY will not include these routines. If any of these routines are being called within an application, it is recommended that you change your code or retain the deprecated routine before replacing this library with the next version. Most of these routines were called by users only when they needed to set up their own workspace. Thus, the impact of these changes should be limited.
DHOUAP
DHOUTR
DG2DF
DG2IN
DG3DF
G2DF
G2IN
G3DF
SHOUAP
SHOUTR
The following routines have been renamed due to naming conflicts with other software manufacturers.
CTIME — replaced with CPSEC
DTIME — replaced with TIMDY
PAGE — replaced with PGOPT