Micro Linear Algebra Package - muLAPack
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lag
.gitignore
LICENSE
Makefile
README.md
fp_matrix.c
fp_matrix.h

README.md

NOTE

This library has been deprecated. Future development will be done in the fork uLAPack.

Embedded LAPack

Micro/Embedded Linear Algebra Package

A Linear Algebra package to execute matrix math on an embedded system. This library can create and manipulate floating point matrices. This package was created because I wanted to perform regressions (using fp_matrix_poly_fit()) on a microcontroller where a sensor array of inputs would correlate to some output.

The floating point data type container can be changed to any ANSI floating point type. Simply edit the FLOATING_POINT_CONTAINER macro in fp_matrix.h.

Currently: My Polynomial Fitting function on my x86 2.7 GHz Intel Core i5 machine times 0.005s. MATLAB takes 0.004s on the same machine using the same algorithm. The outputs are identical with double floating point precision.

Further optimizations can be performed by switching to optimized closed-form matrix inversions for matrices with known dimensions. Currently, the library uses a generalized inversion technique which may or may not be overkill for matrices of a small dimension. In several functions in this library (poly_fit() for example), memory is dynamically allocated and free'd in loops. Time can be saved by only allocating once, and writing to the same data structure in the conditional loops.

Functions included:

  • Matrix Inverse
  • Matrix Pseudo-Inverse
  • Transpose
  • Matrix/Vector Product
  • Matrix/Vector Sum
  • LQ-Decomposition (L being a lower triangular matrix)
  • Least-Squares Approximation
  • n-th Degree Polynomial Fitting (Approximating the coefficients of p(x), where y=Ax, and x->p~->y)

TODO:

  • Fix memory leak problem in polynomial fit
  • Make some functions public
  • Write documentation for Polynomial Fit and LQ
  • Time on various architectures
  • Optimize dynamic allocation in looping algorithms