By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 759 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Multiplication of matrices consisting of arrays

P: 1
Hello,

I am wondering if there is an efficient way (other than for cycle) of solving following task:

I need to multiply e.g. two matrices and at every point in the matrix there is an array. The two matrices shall be multiplied using matrix multiplication and when the elements of these matrices are multiplied, this shall be done elementwise. So lets say such multiplication:

[[[1,1,1],[2,2,2]],
[[3,3,3],[4,4,4]]]
x
[[[1,1,1],[2,2,2]],
[[3,3,3],[4,4,4]]]
=
[[[1,1,1]*[1,1,1]+[2,2,2]*[3,3,3],[1,1,1]*[2,2,2]+[2,2,2]*[4,4,4]],
[[3,3,3]*[1,1,1]+[4,4,4]*[3,3,3]],[[3,3,3]*[2,2,2]+[4,4,4]*[4,4,4]]]

The multiplication * denotes elementwise multiplication and x denotes matrix multiplication

Thank anybody for an idea, how to do it.
Jun 25 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.