Many
functions return a pointer to an array containing the computed answers.
If the function invocation uses the optional arguments
IMSL_RETURN_USER, float a[ ]
the computed answers are stored in the user-provided array a, and
the pointer returned by the function is set to point to the user-provided
array a. If an invocation does not use IMSL_RETURN_USER, the function
initializes the pointer (through a memory allocation request to
malloc) and stores the answers there. (To release this space, free
can be used. Both malloc and free are standard C library functions
declared in the header <stdlib.h>.) In this way, the allocation
of space for the computed answers can be made either by the user
or internally by the function.
Similarly, other optional arguments specify whether additional
computed output arrays are allocated by the user or are to be allocated
internally by the function. For example, in many functions in "Linear
Systems," the optional arguments
IMSL_INVERSE_USER, float inva[] (Output)
IMSL_INVERSE, float **p_inva (Output)
specify two mutually exclusive optional arguments. If the first
option is chosen, the inverse of the matrix is stored in the user-provided
array inva. In the second option, float **p_inva refers to
the address of a pointer to the inverse. If the second option is
chosen, on return the pointer is initialized (through a memory allocation
request to malloc), and the inverse of the matrix is stored there.
Typically, float *p_inva is declared, &p_inva is used
as an argument to this function and free(p_inva) is used to release
the space.