Matrix-chain multiplication problem
There are 2 matrix, A[m* n] and B[n* l], then we do multiplication A* B = C[m* l]
there are m* l * n scalar multiplications existing.
Let assume: A * B *C * D * E...... find a multiplying order so that the number of scalar multiplications is smallest.
For this problem, we use s[i,j] as the a record of execution, and use the recursion to calculate from small to large.
网友评论