Introduction

Memory Allocation for Output Arrays

Many functions return a pointer to an array containing the computed answers. If the function invo­cation uses the optional arguments

IMSLS_RETURN_USER, float a[]

then 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 IMSLS_RETURN_USER, then a pointer to the function is internally initialized (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.) 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 al­located by the user or are to be allocated internally by the function. For example, in many functions, the optional arguments

IMSLS_ANOVA_TABLE, float **anova_table   (Output)
IMSLS_ANOVA_TABLE_USER, float anova_table[]   (Output)

specify two mutually exclusive optional arguments. If the first option is chosen,
float **anova_table refers to the address of a pointer to an internally allocated array containing the analysis of variance statistics. On return, the pointer is initialized (through a memory allocation request to malloc), and the array is stored there. Typically, float *anova_table is declared, &anova_table is used as an argument to this function, and free(anova_table) is used to release the space. In the second option, the analysis of variance statistics are stored in the user-pro­vided array anova_table.


Visual Numerics, Inc.
Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260