Another Example:
Matrix-Chain Multiplication
• Given a sequence of
matrices to be multiplied,
find the best order to do the
multiplications
• Example:
(4X2)(2X3)(3X1)
• Matrix properties
– Matrix multiply is
associative: (AB)C = A(BC)
– But it’s not commutative:
AB is not necessarily equal
to BA (usually just one of
these orders even makes
sense)
– It takes mnp multiplies to
multiply an (mXn) matrix
times an (nXp) matrix
CS409 - Spring 2000
4