Matrix Example

group MatrixExample

Refer riscv_matrix_example_f32.c


Demonstrates the use of Matrix Transpose, Matrix Muliplication, and Matrix Inverse functions to apply least squares fitting to input data. Least squares fitting is the procedure for finding the best-fitting curve that minimizes the sum of the squares of the offsets (least square error) from a given set of data.


The linear combination of parameters considered is as follows:

A * X = B, where X is the unknown value and can be estimated from A & B.

The least squares estimate X is given by the following equation:

X = Inverse(A * A) * A * B

Block Diagram:


Variables Description:

  • A_f32 input matrix in the linear combination equation

  • B_f32 output matrix in the linear combination equation

  • X_f32 unknown matrix estimated using A_f32 & B_f32 matrices

NMSIS DSP Software Library Functions Used:

  • riscv_mat_init_f32()

  • riscv_mat_trans_f32()

  • riscv_mat_mult_f32()

  • riscv_mat_inverse_f32()