MathcadArrayAllocate

BOOL MathcadArrayAllocate(array, rows, cols, allocateReal,
allocateImaginary)
COMPLEXARRAY* const array;
unsigned int rows;
unsigned int cols;
BOOL allocateReal;
BOOL allocateImaginary;

Allocates memory for a COMPLEXARRAY of cols columns and rows rows. Sets the hReal, hImag, rows and cols members of the argument array.

Parameter

Description

array

Points to the COMPLEXARRAY structure that is to be filled with the information about an array.

The COMPLEXARRAY structure has the following form:

	typedef struct tagCOMPLEXARRAY {
unsigned int rows;
unsigned int cols;
double **hReal;
double **hImag;
} COMPLEXARRAY;

rows

Row dimension of the array that is being allocated. After a successful allocation, the rows member of the argument array is set to the value of rows.

cols

Column dimension of the array that is being allocated. After a successful allocation, the cols member of the argument array is set to the value of cols.

allocateReal

Boolean flag indicating whether a memory block should be allocated to store the real part of the array. If allocateReal is FALSE the function does not allocate storage for the real part of the array and sets the hReal member to NULL.

allocateImag

Boolean flag indicating whether a memory block should be allocated to store the imaginary part of the array. If allocateImag is FALSE the function does not allocate storage for the imaginary part of the array and sets the hImag member to NULL.

Return value

Returns TRUE if the allocation is successful, FALSE otherwise.

Notes:

hReal and hImag members of the argument array are allocated as a 2-dimensional array of the range [0 .. cols – 1][0 .. rows – 1]. Free memory using MathcadArrayFree. To allocate memory for scalars, use MathcadAllocate. See the example.