micropython-mtx: Extra-fast Matrix Multiplication and Linear System Solver on MicroPython
Posted: Tue Jul 23, 2019 1:09 pm
Hello,
I want to announce micropython-mtx, a small MicroPython library designed to do two things only:
- multiply a matrix
- solve a system of linear equations
https://gitlab.com/nickoala/micropython-mtx
I was doing some planar homography on OpenMV Cam, wanting to find some libraries for simple matrix calculations. I was able to find two (previously announced on this forum):
viewtopic.php?t=1169
viewtopic.php?t=5160
But I found them too "heavy" for my purpose. They offer a numpy-like API which is good for manipulating, analyzing, and experimenting with data. In an embedded environment (in which MicroPython is expected to be used), usually we just want to apply some algorithms. In my case, I only need matrix multiplication and linear system solving. A lot of numpy-like functionalities, if I use those 2 libraries, become dead weight, using up memory and dragging down speed.
So, I decided to roll my own. The result is micropython-mtx. It is pure Python, simple to use, and fast. Hopefully it will be useful to someone.
I want to announce micropython-mtx, a small MicroPython library designed to do two things only:
- multiply a matrix
- solve a system of linear equations
https://gitlab.com/nickoala/micropython-mtx
I was doing some planar homography on OpenMV Cam, wanting to find some libraries for simple matrix calculations. I was able to find two (previously announced on this forum):
viewtopic.php?t=1169
viewtopic.php?t=5160
But I found them too "heavy" for my purpose. They offer a numpy-like API which is good for manipulating, analyzing, and experimenting with data. In an embedded environment (in which MicroPython is expected to be used), usually we just want to apply some algorithms. In my case, I only need matrix multiplication and linear system solving. A lot of numpy-like functionalities, if I use those 2 libraries, become dead weight, using up memory and dragging down speed.
So, I decided to roll my own. The result is micropython-mtx. It is pure Python, simple to use, and fast. Hopefully it will be useful to someone.