Reputation: 79
I have 3, 3X3 matrices stored in numpy arrays. I want to get the product, to compute a rotation matrix.
Currently what I am doing is
rotation_matrix = (a * b * c)
but I don't know if this is the correct way to multiply matrices - should I be using .dot
I have also tried with rotation_matrix = pre_rotation.dot(result_pre_tilt).dot(post_rotation)
and rotation_matrix = np.multiply(result_pre_tilt, pre_rotation, post_rotation)
a = np.array(
[[-0.25091924 0. -0. ]
[-0. -0.35485339 0. ]
[ 0. 0. 0.70710678]])
b = np.array(
[[ 0.10040533 -0. 0. ]
[ 0. 0.28953198 -0. ]
[ 0. 0. 0.31056766]])
c = np.array(
[[ 6.12323400e-17 0.00000000e+00 -1.00000000e+00]
[ 0.00000000e+00 1.00000000e+00 0.00000000e+00]
[ 1.00000000e+00 0.00000000e+00 6.12323400e-17]])
Upvotes: 0
Views: 8052
Reputation: 27615
You can try using dot
like this:
final= numpy.dot(tilt_matrix, (numpy.dot(rotation_matrix, original))
Things to consider:
numpy.dot
is a function, not a method (not possible to call A.dot(B)
, call np.dot(A, B)
instead);Upvotes: 2