NMSIS-DSP
Version 1.3.1
NMSIS DSP Software Library
|
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: More...
Modules | |
Householder transform of a vector | |
Computes the Householder transform of a vector x. | |
Matrix Addition | |
Adds two matrices. | |
Cholesky and LDLT decompositions | |
Computes the Cholesky or LL^t decomposition of a matrix. | |
Complex Matrix Multiplication | |
Complex Matrix multiplication is only defined if the number of columns of the first matrix equals the number of rows of the second matrix. Multiplying an M x N matrix with an N x P matrix results in an M x P matrix. | |
Complex Matrix Transpose | |
Tranposes a complex matrix. | |
Matrix Initialization | |
Initializes the underlying matrix data structure. The functions set the numRows , numCols , and pData fields of the matrix data structure. | |
Matrix Inverse | |
Computes the inverse of a matrix. | |
Matrix Multiplication | |
Multiplies two matrices. | |
QR decomposition of a Matrix | |
Computes the QR decomposition of a matrix M using Householder algorithm. | |
Matrix Scale | |
Multiplies a matrix by a scalar. This is accomplished by multiplying each element in the matrix by the scalar. For example: | |
Matrix Subtraction | |
Subtract two matrices. | |
Matrix Transpose | |
Tranposes a matrix. | |
Matrix Vector Multiplication | |
Multiplies a matrix and a vector. | |
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. } riscv_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]
whereriscv_matrix_instance_f32 S = {nRows, nColumns, pData};
riscv_matrix_instance_q31 S = {nRows, nColumns, pData};
riscv_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.RISCV_MATH_SIZE_MISMATCHOtherwise the functions return
RISCV_MATH_SUCCESSThere is some overhead associated with this matrix size checking. The matrix size checking is enabled via the #define
RISCV_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
RISCV_MATH_SUCCESS
.