# Inverting $6 \times 6$ complex matrix on the ARM Cortex M4F processor

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?

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.

• This worked. Thanks a lot! Aug 31, 2022 at 2:41
• 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? Sep 8, 2022 at 8:42
• 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. 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.