Matrixmultiply on multidimensional arrays
Chris Fonnesbeck
spam at fisher.forestry.uga.edu
Thu May 23 11:13:54 EDT 2002
I'm hoping someone can help me with this matrix multiplication
problem: I am trying to multiply a 2x2x3 matrix (A below) with a
2x2x3x3 matrix (B below), such that each of the inner rows in A are
multiplied by the 3x3 inner matrices in B, to result in a 2x2x3
matrix. In other words, a regular matrix operation is embedded within
a 2x2 matrix. Can I do this without flattening these out?
Matrix A:
[[[ 40725. 81450. 40725. ]
[ 28846.54696133 57693.09392265 28846.54696133]]
[[ 32623.33392432 59176.7772203 32623.33392432]
[ 32623.33392432 59176.7772203 32623.33392432]]]
Matrix B:
[[[[ 0.984 0.016 0. ]
[ 0.079 0.906 0.015]
[ 0. 0.026 0.974]]
[[ 0.974 0.026 0. ]
[ 0.05 0.932 0.018]
[ 0. 0.014 0.986]]]
[[[ 0.984 0.016 0. ]
[ 0.079 0.906 0.015]
[ 0. 0.026 0.974]]
[[ 0.974 0.026 0. ]
[ 0.05 0.932 0.018]
[ 0. 0.014 0.986]]]]
More information about the Python-list
mailing list