CMSIS-DSP
Version 1.5.1
CMSIS DSP Software Library
|
Content | |
Matrix Addition | |
Complex Matrix Multiplication | |
Matrix Initialization | |
Matrix Inverse | |
Matrix Multiplication | |
Matrix Scale | |
Matrix Subtraction | |
Matrix Transpose | |
This set of functions provides basic matrix math operations. The functions operate on matrix data structures. For example, the type definition for the floating-point matrix structure is shown below:
typedef struct { uint16_t numRows; // number of rows of the matrix. uint16_t numCols; // number of columns of the matrix. float32_t *pData; // points to the data of the matrix. } arm_matrix_instance_f32;
There are similar definitions for Q15 and Q31 data types.
The structure specifies the size of the matrix and then points to an array of data. The array is of size numRows X numCols
and the values are arranged in row order. That is, the matrix element (i, j) is stored at:
pData[i*numCols + j]
arm_mat_init_f32()
, arm_mat_init_q31()
and arm_mat_init_q15()
for floating-point, Q31 and Q15 types, respectively.wherearm_matrix_instance_f32 S = {nRows, nColumns, pData};
arm_matrix_instance_q31 S = {nRows, nColumns, pData};
arm_matrix_instance_q15 S = {nRows, nColumns, pData};
nRows
specifies the number of rows, nColumns
specifies the number of columns, and pData
points to the data array.ARM_MATH_SIZE_MISMATCHOtherwise the functions return
ARM_MATH_SUCCESSThere is some overhead associated with this matrix size checking. The matrix size checking is enabled via the #define
ARM_MATH_MATRIX_CHECKwithin the library project settings. By default this macro is defined and size checking is enabled. By changing the project settings and undefining this macro size checking is eliminated and the functions run a bit faster. With size checking disabled the functions always return
ARM_MATH_SUCCESS
.