I've starting writing the kalman algorithm in a CoreFlight app. It receives GPS data messages from another application that handles the serial parsing, and this one is supposed to run the kalman filter.

I've got most of it working right now, but I stuck on how to calculate the inverse of a matrix in C. I've been using the GSL library for the matrix math, since it supports BLAS functions and it makes it easy to write the code for an arbitrary matrix size, but I just can't figure out the inverse thing.

## Discussions

## Become a Hackaday.io Member

Create an account to leave a comment. Already have an account? Log In.

If you are using an ARM Cortex M chip, you can use the CMSIS DSP library. It is especially fast for 8/16 bit math because of the multiple data instructions: https://github.com/ARM-software/CMSIS_5/tree/develop/CMSIS/DSP/Source/MatrixFunctions

Are you sure? yes | no

This is a raspberry pi zero (CoreFlight requires a proper OS with a filesystem and whatnot), so I don't think that'll work for this.

Are you sure? yes | no

Good point. It still might be useful as a reference if you can't find a suitable library (https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/DSP/Source/MatrixFunctions/arm_mat_inverse_f64.c)

Good luck.

Are you sure? yes | no

Maybe https://www.thecrazyprogrammer.com/2017/02/c-c-program-find-inverse-matrix.html ?

Are you sure? yes | no

Thanks, I'll give that a shot.

Are you sure? yes | no