A C++ header only linear algebra math library for embedded device.
Bringing a smooth linear algebra development experience, with an Eigen-like interface, even on embedded devices!
- Eigen-like API: Use the same API as Eigen, but with only static memory allocation.
- Small footprint: Only a few kilobytes of code, with no dependencies on external libraries.
- Fast performance: Optimized for speed and efficiency, with template metaprogramming.
- Cross-platform compatibility: Works on any platform that supports C++17 or later.
- Easy to use: Simply include the header file in your project and start using the API.
- Test coverage: The library is thoroughly tested and has a high test coverage rate.
By simply aliasing Eigen
to EmbeddedMath
, you can use the same API as Eigen on microcontrollers with C++ support enabled.
#include <EmbeddedMath.hpp>
namespace Eigen = EmbeddedMath; // Alias EmbeddedMath to Eigen
int main() {
// Create a quaternion (w, x, y, z)
Eigen::Quaternionf q(0.707f, 0.0f, 0.707f, 0.0f); // 90-degree rotation around the Y axis
// Convert quaternion to rotation matrix
Eigen::Matrix3f rotation_matrix = q.toRotationMatrix();
// Rotate a vector
Eigen::Vector3f v(1.0f, 0.0f, 0.0f);
Eigen::Vector3f rotated_v = rotation_matrix * v;
return 0;
}
Simply drag and drop the EmbeddedMath.hpp
file into your project, and you're all set to get started!
A typical example of this library is to implement a kalman filter, which can be found at Embedded-ESKF.
- C++17 or later (test with
arm-none-eabi-g++ 10.3.1
) - Posix math library (e.g.,
math.h
)
The code is under Apache License 2.0.
Give me a star if you like it!