07_MatrixChainOptimisation

# 07_MatrixChainOptimisation - Wednesday Dr Daniel Hughes...

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

CSC 30155 Wednesday 06/10/10 Dr. Daniel Hughes [email protected]

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

View Full Document
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)
Supporting Reading l Optional reading: l Cormen et al., Introduction to Algorithms , MIT Press, 2001, Chapter 15: Dynamic Programming (15.2)

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

View Full Document
CSC 30155 Matrix Multiplication Dr. Daniel Hughes [email protected]
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 .

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

View Full Document
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/
Matrix Multiplication Algorithm

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

View Full Document
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 .
Problem Definition

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

View Full Document
Cost of Matrix Multiplication
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 .

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

View Full Document
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
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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/22/2011 for the course CSC 30155 taught by Professor Garyli during the Spring '11 term at University of Liverpool.

### Page1 / 49

07_MatrixChainOptimisation - Wednesday Dr Daniel Hughes...

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

View Full Document
Ask a homework question - tutors are online