Search for a linear algebra library for embedded systems (without malloc and free)

I use to work with microcontrollers. In RTOS, which I use in my applications, there are no free and malloc (and other calls like assert), sometimes they may be available, but I prefer to have everything static on my system.

I started using linear algebra, but most of them need dynamic memory. My matrices are dense and "small" (no more than 10x10).

I really like Eigen (everything may be static at compile time), but apparently there is an error causing statements that are not provided by my RTOS OS (even with -DNDEBUG). The library should provide matrix decomposition procedures (e.g. QR, Cholesky, LU ...)

I would prefer C instead of C ++. Any suggestions? Thank you very much in advance!

+4
source share
3 answers

Is there something wrong with CLAPACK? Or even direct Fortran LAPACK (you can compile it with gfortran, which is part of gcc).

[C] LAPACK routines accept all memory buffers in their arguments as already allocated, and do not make any heap allocation for themselves at all. For routines that take “working” buffers in addition to other arguments (for example, dgesdd for computing SVDs), you can usually call them with a special “only size” argument and return in response to the required size for the buffers to work, which you can then distribute as you wish.

+4
source

Revision of the assert macro seems like a good solution.

But you can even provide your own malloc and a free implementation, or statically link to the appropriate memory management library: http://blog.reverberate.org/2009/02/one-malloc-to-rule-them-all.html

+1
source

If Q16.16 fixed-point math is appropriate for your application, libfixmatrix might be an option:

https://github.com/PetteriAimonen/libfixmatrix

0
source

All Articles