techno
techno

Reputation: 6500

Chain Matrix Multiplication

Im trying to learn chain matrix multiplication.

Suppose A is a 10 × 30 matrix, B is a 30 × 5 matrix, and C is a 5 × 60 matrix. Then,

How do we get the following number of operations? (Is it number of rows into columns ???)

(AB)C = (10×30×5) + (10×5×60) = 1500 + 3000 = 4500 operations
A(BC) = (30×5×60) + (10×30×60) = 9000 + 18000 = 27000 operations.

http://www.geeksforgeeks.org/dynamic-programming-set-8-matrix-chain-multiplication/

Upvotes: 0

Views: 123

Answers (1)

user4668606
user4668606

Reputation:

The number of operations is the number of multiplications required to calculate the result. A * B will result in a 10 x 5 matrix. Each entry in this matrix is the dotproduct of the respective row of A with the column of B with the same index. Thus: A * B requires calculation of 10 x 5 cells, where each cell is the sum of 30 multiplication, so 10 x 5 x 30. Though this is a rather strange representation.

Upvotes: 1

Related Questions