We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi there,
I am trying to invert a matrix using arm_mat_inverse_f32(). I am getting correct results for some martices, but in the code below status3 = ARM_MATH_SINGULAR. status1 and 2 = ARM_MATH_SUCCESS.
Any ideas what is wrong here? Note that det(m3) = -921600, i.e. not singular.
I am using arm_math v1.5.3 on an Atmel SAM E70
arm_matrix_instance_f32 mat1, mat2, mat3; arm_matrix_instance_f32 inv1, inv2, inv3; #define SIZE1 (6) #define SIZE2 (4) float32_t m1[SIZE1*SIZE1] ={ 7.6294, 1.1843, 1.0842, 1.7056, 1.3111, 0.8036, 1.1843, 7.0938, 1.4429, 1.9244, 0.9154, 1.0024, 1.0842, 1.4429, 7.6006, 0.7976, 1.1649, 1.1927, 1.7056, 1.9244, 0.7976, 6.0714, 1.2414, 0.9802, 1.3111, 0.9154, 1.1649, 1.2414, 7.3110, 0.2683, 0.8036, 1.0024, 1.1927, 0.9802, 0.2683, 7.6469 }; float32_t m2[SIZE1*SIZE1] = { 2.4086, -1.7141, 0.9385, 1.9594, -0.4342, 1.3369, 5.1228, 0.3019, -1.9435, 0.3259, 0.0788, 1.3030, -1.8536, -1.3981, 0.0812, -3.1542, 0.2977, 1.2532, -8.8154, 0.4773, -0.6195, 1.2333, -0.1475, 1.1768, 1.6616, 1.9255, 0.8342, -1.4220, -0.6654, 1.0847, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000, 1.0000}; float32_t m3[SIZE2*SIZE2] = { 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}; float32_t m1int[SIZE1*SIZE1]; float32_t m3int[SIZE2*SIZE2]; arm_mat_init_f32(&mat1, SIZE1, SIZE1, (float32_t *) m1); arm_mat_init_f32(&inv1, SIZE1, SIZE1, m1int); arm_mat_init_f32(&mat2, SIZE1, SIZE1, (float32_t *) m2); arm_mat_init_f32(&inv2, SIZE1, SIZE1, m1int); arm_mat_init_f32(&mat3, SIZE2, SIZE2, (float32_t *) m3); arm_mat_init_f32(&inv3, SIZE2, SIZE2, m3int); // status1 = arm_mat_inverse_f32(&mat1, &inv1); status2 = arm_mat_inverse_f32(&mat2, &inv2); status3 = arm_mat_inverse_f32(&mat3, &inv3);