numpy

Performance of common biomechanics linear algebra operations in Numpy

Klevis Aliaj
950 words
Before building more complex logic into my codebase, I wanted to compare the performance of different methods of computing common biomechanics linear algebra operations in Numpy. As is common in biomechanics and robotics, I use a 4x4 homogeneous matrix to represent a coordinate system or pose, and correspondingly 3D vectors are upgraded to homogeneous coordinates. I knew that numpy.einsum could accommodate all linear algebra operations I am interested in performing, but I was curious to compare its performance against numpy.matmul for operations that could be performed just by matrix multiplication. Thanks to Numpy's broadcasting algorithm a considerable number of operation can be performed using numpy.matmul.