-
Notifications
You must be signed in to change notification settings - Fork 94
Timing
Data obtained using a 3.6 GHz 10-Core Intel Core i9, Python 3.8.5 and Numpy 1.19.1.
Base package timing to create a rotation matrix, and to convert between SO(3) and SE(3) NumPy matrices
transforms.rotx: 0.374 μs
transforms.trotx: 0.502 μs
transforms.t2r: 0.05 μs
transforms.r2t: 0.099 μs
The spatial math class add overhead
SE3.Rx: 1.07 μs
SE3(): 0.305 μs
largely in the instance constructor process, we see that the null constructor takes 0.3 μs
The effect of value checking can be seen when creating an SE3
instance from a NumPy matrix value
SE3(T1): 3.6 μs
SE3(T1, check=False):0.144 μs
Multiplication using the overloaded class operator vs native NumPy also shows some constructor overhead
SE3 *: 0.472 μs
4x4 @: 0.107 μs
T1 * T2 (R, t): 0.217 μs
but the NumPy @
operator if faster than coding the multiplication in terms of the R and t partitions of the SE(3) matrix.
Inverse also shows some constructor overhead
SE3.inv: 0.703 μs
base.trinv: 0.382 μs
np.linalg.inv: 0.443 μs
but it is interesting to note that exploiting the structure of the SE(3) matrix makes trinv()
16% faster than the general matrix inverse in NumPy.
To build an SE(3) matrix it is fastest to
T = np.zeros((4,4))
T[3,3] = 1
T[:3,:3] = R
T[:3,3] = t
np.eye(4)
is slower even though the bottom right element doesn't need to be explicitly set. np.pad
or stack
is way slower.