tinymatrixmath
|
This library is a collection of functions and classes for doing math on small matrices with less than 2kb of instruction memory and 1kb of RAM.
It is available as:
TARGET_LINK_LIBRARIES (${EXECUTABLE_NAME} tinymatrixmath)
) compatible with C++ 11+It sacrifices some of the power of more feature-rich libraries like Basic Linear Algebra or Eigen to minimize memory footprint and standardize matrix storage across devices, possibly simplifying the process of passing matrices around across devices.
The Sheldrake library employs this library to send matrices between desktop environments and microcontrollers.
Despite this library being "tiny", it supports many common matrix operations including:
Elements with 🚧 are not yet stable or implemented.
Most common mistakes with matrix operations are checked for at compile-time, so there's no need to worry about deploying code with the following issues:
Matrices with less than 256 rows and 256 columns are supported by this library (if your device can store a matrix with a whopping 263kb RAM!). Larger matrices might be processed more efficiently with Eigen.
Here are some examples of how to use the library:
Including the library
Creating a 3x3 identity matrix:
Creating a 3x3 matrix from a float array
Getting the inverse of a square matrix
Printing a matrix to Serial if the Arduio library is available
Getting the determinant of a square matrix
Use any sized matrix
Invalid matrix multiplication is checked at compile-time.
Elementwise scalar operations are supported
1x1 matrices can be implicitly cast to Scalars
The following projects were initially generated from this template:
For making your own CMake/Arduino library from this template, complete the following steps:
src
) and add your own.project ("tinymatrixmath" C CXX)
, replace tinymatrixmath
wtih the name of your project. We'll use this name later.add_library (${PROJECT_NAME}
. Replace that list with a list of the files that belong to your new library..github/workflows/cmake_docs.yml
, there is a line containing make tinymatrixmath_doxygen -j
. Replace tinymatrixmath
with the name of your project.docs
branch: ```sh git switch –orphan docs git commit –allow-empty -m "Initial commit on orphan branch" git push -u origin docs ```settings -> Pages -> Build and deployment -> Branch
, select the docs
branch.settings -> Actions -> General -> Workflow Permissions
, select the Read and write permissions
radio button to allow the docs workflow to push to the docs
branch.examples
folder and place all your Arduino example sketches there.cmake_examples
folder and place all your CMake example executables there. Update cmake_examples/CmakeLists.txt
accordingly.test
folder and place all your unit tests there. Update test/CMakeLists.txt
accordingly.And you're finally done!
If you run into any issues along the way, file them here