I want to invert a $6 \times 6$ complex matrix on the ARM Cortex M4F processor. I have the C code to invert a real matrix using the CMSIS library. Has anyone written a similar C code for complex matrices? Can the CMSIS library be used to do complex matrix multiplications?
-
2$\begingroup$ Here, Asking for code written to your specification is explicitly off-topic. Also, have you incorported the comments you got on your identical electronics.stackexchange.com/questions/632579/… ?! $\endgroup$– Marcus MüllerCommented Aug 26, 2022 at 13:02
2 Answers
If you have a library for real-valued inversion you can expand your matrix (A) from 6x6 complex to be a 12x12 real-valued matrix (B) using
B=[ Real(A) -Imag(A);
Imag(A) Real(A)]
Once you have the inverse you can convert back to complex accordingly.
-
-
$\begingroup$ Is there a way this can be optimized? I have to calculate the inverse of the entire 12x12 matrix. Instead is there a method wherein we can calculate the inverse of half of the matrix instead? $\endgroup$ Commented Sep 8, 2022 at 8:42
-
1$\begingroup$ Unfortunately, there are not short-cuts for this. The complexity of inverting a 6x6 complex-valued matrix is the same as the complexity of a 12x12 real-valued matrix. $\endgroup$– HarrisCommented Sep 18, 2022 at 12:02
I’m not sure it’s as specific as you need it, but Dave Stewart wrote the Meschach library that includes zm_inverse()
which takes the inverse of a complex matrix.
All of it is written in C
and the source code is freely available.