multiply martices
@@ -1121,3 +1121,27 @@ def cross3(v,w):
res[2] = v[0]*w[1] - v[1]*w[0]
return res
+
+
+def multiply_matrices(*argv):
+ """
+ multiply_matrices
+
+ Multiply a series of matrices from left to right
+
+ Args:
+ *argv: series of numpy arrays
+ Returns:
+ sol(numpy array): product of all the given matrices
+
+ Examples:
+ solution = multiply_matrices(A, B, C)
+ """
+
+ size = np.shape(argv[0])
+ nrow = size[0]
+
+ sol = np.eye(nrow)
+ for M in argv:
+ sol = np.dot(sol, M)
+ return sol
