Question
CMSIS DSP matrix inverse
Posted on June 08, 2013 at 01:32
Hi,
i realized a test source code for matrix inversion. I used the CMSIS DSP library which include arm_mat_inverse_f I also took a look at arm_matrix_example_fc... but i had 1 problem and 1 question.float32_t AT_f32[16];
const float32_t A_f32[16] = { 1.0, 0, 4.0, 0, 1.0, 0, 0, 20, 1.0, 0, 4.0, 0, 1.0, 0, 0, 10, }; arm_matrix_instance_f32 A; /* Matrix A Instance */ arm_matrix_instance_f32 AT; /* Matrix AT(A transpose) instance */ uint32_t srcRows, srcColumns; /* Temporary variables */ arm_status status; srcRows = 4; srcColumns = 4; arm_mat_init_f32(&A, srcRows, srcColumns, (float32_t *)A_f32); arm_mat_init_f32(&AT, srcRows, srcColumns, AT_f32); QUESTION: Why A_f32 it's converted in float32_t pointer??? And why AT_f32 that is the same variable type it's treated in a different manner? PROBLEM: This is MY code:#include ''arm_math.h''
float32_t matrix[4] ={5,0,0,2}; float32_t matrix2[4]; int main( void ) { arm_matrix_instance_f32 mat; arm_matrix_instance_f32 mat2; arm_mat_init_f32(&mat,2,2,(float32_t *)matrix); arm_mat_init_f32(&mat2,2,2,matrix2); arm_status state; while (1) { state = arm_mat_inverse_f32(&mat,&mat2); } } BUT what happens? The first inversion put the inverse of matin mat2 taht put the inverse of matrix in matrix2.This is right! But unfortunately the state become ARM_MATH_SINGULAR and matrix becomes IDENTITY MATRIX!!! And also with the identity matrix in the second cicle the state remains ARM_MATH_SINGULAR.... Does anyone have suggestion/solutions? Thanks!!! #matrix-inverse-dsp-cmsis