## Matrix library for MicroPython

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Iyassou
Posts: 37
Joined: Sun Jun 26, 2016 9:15 am

### Re: Matrix library for MicroPython

efahl wrote:
Fri Aug 24, 2018 7:57 pm
Just an aside, what are you using these 3x3 matrices for?
At the moment I'm not actively using umatrix. Back when I needed it I wanted to handle RGB and later RGB-IR photosensor measurements for a particular application. I decided to write it because the alternative 350 ms were too costly for me. I only got into quadcopters and some of the math applied on them a year later and that was when I understood the need for fast matrix inversion and decided to pursue it for others' needs.
efahl wrote:
Fri Aug 24, 2018 7:57 pm
If they are 3D spatial transformations, then the matrix is orthonormal and its inverse is also its transpose. Our multibody dynamics code uses this to good advantage, and we have also added multiply_inverse and divide_inverse methods on the matrix class so we don't even take the transpose, we just flip the order of evaluation in the inner loop, resulting in enormous speed improvements over actually calculating inverses.
Are you talking about 4x4 quaternion matrices? I found quaternions and 3D rotations to be fascinating but difficult so I haven't grasped all their aspects: pardon me if the previous question is ignorant.
Either way this is very cool and neat to know, thanks for sharing

efahl
Posts: 10
Joined: Sat Dec 23, 2017 2:02 pm

### Re: Matrix library for MicroPython

Iyassou wrote:
Sat Aug 25, 2018 5:43 pm
Are you talking about 4x4 quaternion matrices? I found quaternions and 3D rotations to be fascinating but difficult so I haven't grasped all their aspects: pardon me if the previous question is ignorant.
Either way this is very cool and neat to know, thanks for sharing
No, 3x3 direction cosine matrices (just the 3D extension of planar 2x2 rotation matrices). It's basically the same thing you do render the pixels of a line on the screen at some angle, but generalized to 3-space and applied to the various landmarks on physical bodies.