Matrix chain multiplication

Creator
Creator
Seonglae Cho
Created
Created
2023 Oct 17 6:29
Editor
Edited
Edited
2023 Oct 19 6:16

Given a chain of matrices <A1A2An><A_1\cdot A_2 \dots A_n>

where AiA_i has dimensions pi1×pip_{i-1} \times p_i for multiplication
 
 
 

Depends on size of matrix

Parenthesize if important
notion image
 
 
 
Suppose that an optimal parenthesiation of AijA_{i\dots j} splits the product beween AkA_k and Ak+1A_{k+1}
Aij=AiAj,ijA_{i\dots j} = A_i\cdots A_j, i\le j
Let m[i,j]m[i, j] is the minimum number of multiplications needed to compute AijA_{i\cdots j}
  • m[i,i]=0m[i, i] = 0 - diagonal terms are zero
m[i,j]=m[i,k]+m[k+1,j]+pi1pkpjm[i,j] = m[i,k] + m[k+1, j] + p_{i-1}p_{k}p_{j}
notion image
fill out direction
for calculate minimum, we need for loop so O(n3)O(n^3) So we don’t use DP solution
notion image
In reality we use
Heuristic
and approximate algorithm
 
 
 
 
 
 
 
 
 

Recommendations