******** fig10.46 ********** /* Compute optimal ordering of matrix multiplication */ /* c contains number of columns for each of the n matrices */ /* c[0] is the number of rows in matrix 1 */ /* Minimum number of multiplications is left in M[1][n] */ /* Actual ordering can be computed via another procedure using last_change */ /* M and last_change are indexed starting at 1, instead of zero */ void opt_matrix( int c[], unsigned int n, two_d_array M, two_d_array last_change ) { int i, k, Left, Right, this_M; for( Left=1; Left <= n; Left++ ) M[Left][Left] = 0; for(k=1; k