AnsweredAssumed Answered

CMSIS DSP matrix inverse

Question asked by MangoniDario on Jun 8, 2013
Latest reply on Jun 14, 2013 by mangoni.dario
Hi,
i realized a test source code for matrix inversion. I used the CMSIS DSP library which include arm_mat_inverse_f32.
I also took a look at arm_matrix_example_f32.c...
but i had 1 problem and 1 question.

float32_t AT_f32[16];
const float32_t A_f32[16] = 
{   
        1.0,            32.0,           4.0,            128.0, 
        1.0,            32.0,           64.0,           2048.0,
        1.0,            16.0,           4.0,            64.0,
        1.0,            16.0,           64.0,           1024.0,
}; 
 
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 mat in 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!!!

Outcomes