Matrix Multiplication
Matrix Multiplication
MULTIPLICATION
Given a sequence of matrices, find the most efficient way to multiply these
matrices together. The problem is not actually to perform the
multiplications, but merely to decide in which order to perform the
multiplications.
We have many options to multiply a chain of matrices because matrix
multiplication is associative. In other words, no matter how we parenthesize
the product, the result will be the same. For example, if we had four matrices
A, B, C, and D, we would have:
(ABC)D = (AB)(CD) = A(BCD) = ....
However, the order in which we parenthesize the product affects the
number of simple arithmetic operations needed to compute the product, or
the efficiency. For example, suppose A is a 10 30 matrix, B is a 30 5
matrix, and C is a 5 60 matrix. Then,
(AB)C = (10305) + (10560) = 1500 + 3000 = 4500 operations
A(BC) = (30560) + (103060) = 9000 + 18000 = 27000 operations.
Matrix-Chain multiplication problem:
Given <A1, A2, A3, ...,An> (Ai is pi-1 x pi) fully parenthesize A1, A2, A3, ...,An
in a way that minimizes the number of scalar multiplications.