07_MatrixChainOptimisation

07_MatrixChainOptimisation - Wednesday 06/10/10 Dr. Daniel...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC 30155 Wednesday 06/10/10 Dr. Daniel Hughes daniel.hughes@xjtlu.edu.cn
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Today ` s Tutorial l Review of Matrix Chain Multiplication (10 mins) l Recursive Matrix Chain Optimization (20 mins) l Question: a dynamic version (10 mins) l A Dynamic Programming Algorithm (10 mins) l Exam Questions (20 mins) l Time to work on Tutorial Assignment (40 mins)
Background image of page 2
Supporting Reading l Optional reading: l Cormen et al., Introduction to Algorithms , MIT Press, 2001, Chapter 15: Dynamic Programming (15.2)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSC 30155 Matrix Multiplication Dr. Daniel Hughes daniel.hughes@xjtlu.edu.cn
Background image of page 4
Matrix Multiplication (1/2) l Compatibility: l You can only multiply two matrices if the number of columns in the first matrix equals the number of rows in the second matrix. l Otherwise, the product of two matrices is undefined .
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Matrix Multiplication (2/2) l Dimensions of the product matrix: l The number of rows of the product matrix will equal the number of rows in the first matrix. l The number of columns of the product matrix will equal the number of columns in the second matrix. l Lets walk through a matrix multiplication: l http://www.mai.liu.se/~halun/matrix/
Background image of page 6
Matrix Multiplication Algorithm
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Matrix Chain Optimization l Any parenthesization gives the same answer – matrix multiplication is associative . l A different parenthization will result in a different number of scalar multiplications. l We thus have an optimization problem: find the parenthization that results in the minimum number of scalar multiplications .
Background image of page 8
Problem Definition
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Cost of Matrix Multiplication
Background image of page 10
Optimal Recursive Substructure l Proof by contradiction: l If an optimal parenthization y of the input (A 1 N ) contains parenthization y1 (A 1 k ) , then parenthization y1 must itself be optimal. l Otherwise, if a more optimal solution y2 existed for (A 1 k ) , we could replace y1 with y2 and achieve a more optimal solution for (A 1 N ) than the supposedly optimal y . Giving rise to a contradiction .
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Interdependent Subproblems l There are many examples that could be used to show the interdependence of sub-problems. l Here is one example: l A and B are multiplied together in y2 as well as y1 . Our sub- problems are not independent. A B C D A B C D y1 y2
Background image of page 12
Optimization Problem l We have analyzed the process of matrix chain multiplication and identified an optimization problem . l Our analysis of the problem shows it has optimal recursive substructure and that the subproblems are interdependent . l
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 49

07_MatrixChainOptimisation - Wednesday 06/10/10 Dr. Daniel...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online