Skip to content

A C++ header only linear algebra math library for embedded device

License

Notifications You must be signed in to change notification settings

geniusdo/EmbeddedMath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmbeddedMath

LOGO

A C++ header only linear algebra math library for embedded device.

Purpose:

Bringing a smooth linear algebra development experience, with an Eigen-like interface, even on embedded devices!

Features:

  • 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.

Usage:

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!

Example:

A typical example of this library is to implement a kalman filter, which can be found at Embedded-ESKF.

Dependencies:

  • C++17 or later (test witharm-none-eabi-g++ 10.3.1)
  • Posix math library (e.g., math.h)

License:

The code is under Apache License 2.0.

Any issues or suggestions, please open an issue or PR.

Give me a star if you like it!

About

A C++ header only linear algebra math library for embedded device

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published