Introduction > Matrix Storage Modes

Matrix Storage Modes

In this section, the word matrix is used to refer to a mathematical object and the word array is used to refer to its representation as a C data structure. In the following list of array types, the C Stat Library functions require input consisting of matrix dimension values and all values for the matrix entries. These values are stored in row-major order in the arrays.

Each function processes the input array and typically returns a pointer to a “result.” For exam­ple, in solving linear regression, the pointer points to the estimated coefficients. Normally, the input array values are not changed by the functions.

In the C Stat Library, an array is a pointer to a contiguous block of data. An array is not a point­er to a pointer to the rows of the matrix. Typical declarations are as follows:

         float *a = {1, 2, 3, 4};
         float b[2][2] = {1, 2, 3, 4};
         float c[] = {1, 2, 3, 4};

General Mode

A general matrix is a square n × n matrix. The data type of a general array can be int, float, or double.

Rectangular Mode

A rectangular matrix is an m × n matrix. The data type of a rectangular array can be int, float, or double.

Symmetric Mode

A symmetric matrix is a square n × n matrix A, such that AT = A. (The matrix AT is the transpose of A.) The data type of a symmetric array can be int, float, or double.


RW_logo.jpg
Contact Support