1 / 8

Matrix Chain Multiplication

Matrix Chain Multiplication. Input: Output: Objective:. a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication. Matrix Chain Multiplication. Input: Output: Objective:. a chain of matrices to be multiplied

yjorgensen
Download Presentation

Matrix Chain Multiplication

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matrix Chain Multiplication Input: Output: Objective: a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication

  2. Matrix Chain Multiplication Input: Output: Objective: a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication

  3. Matrix Chain Multiplication Input: Output: Objective: a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication Matrix multiplication: A of size m x n, B of size n x p How many steps to compute A.B ?

  4. Matrix Chain Multiplication Input: Output: Objective: a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication Example: 4 2 5 1 2 3

  5. Matrix Chain Multiplication Input: Output: Objective: a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication Heart of the solution:

  6. Matrix Chain Multiplication Input: Output: Objective: a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication Heart of the solution: S[L,R] = the minimum number of steps required to multiply matrices from the L-th to the R-th

  7. Matrix Chain Multiplication Input: Output: Objective: a chain of matrices to be multiplied a parenthesizing of the chain minimize number of steps needed for the multiplication Heart of the solution: S[L,R] = the minimum number of steps required to multiply matrices from the L-th to the R-th

  8. Matrix Chain Multiplication • MATRIX-CHAIN-MULTIPLICATION (a0,…,an) • for L=1 to n do S[L,L] = 0 • for d=1 to n do • for L=1 to n-d do • R = L+d • S[L,R] = 1 • for k=L to R-1 • tmp = S[L,k]+S[k+1,R]+aL-1.ak.aR • if S[L,R] > tmp then S[L,R] = tmp • return S[1,n]

More Related