Created
February 18, 2015 15:21
-
-
Save KelSolaar/186d191b3afd976e2421 to your computer and use it in GitHub Desktop.
M_i . M = M_o
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
np.random.seed(64) | |
M_i = np.random.random((3, 3)) | |
M_o = np.random.random((3, 3)) | |
# M . M_i = M_o | |
# M . M_i . M_i^{-1} = M_o . M_i^{-1} | |
# M = M_o . M_i^{-1} | |
M = np.dot(M_o, np.linalg.inv(M_i)) | |
XYZ = np.random.random((3, 1)) | |
print(XYZ) | |
print(np.dot(M, np.dot(M_i, XYZ))) | |
print(np.dot(M_o, XYZ)) | |
# M_i . M = M_o | |
# M_i^{-1} . M_i . M = M_i^{-1} . M_o | |
# M = M_i^{-1} . M_o | |
M = np.dot(np.linalg.inv(M_i), M_o) | |
print(np.dot(M_i, np.dot(M, XYZ))) | |
print(np.dot(M_o, XYZ)) | |
# [[ 0.22444174] | |
# [ 0.39830987] | |
# [ 0.6195008 ]] | |
# [[ 0.71475756] | |
# [ 0.21555621] | |
# [ 0.44902374]] | |
# [[ 0.71475756] | |
# [ 0.21555621] | |
# [ 0.44902374]] | |
# [[ 0.71475756] | |
# [ 0.21555621] | |
# [ 0.44902374]] | |
# [[ 0.71475756] | |
# [ 0.21555621] | |
# [ 0.44902374]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment