Bug 24: Suboptimal Matrix Multiplication Tree
- This code determines how to multiply n matrices such that the number of multiply-adds is minimized.
- It takes as input the row/column counts of the n matrices, expressed as a slice of n+1 integers (rows).
- Matrix i (for 0 <= i < n) has rows[i] rows and rows[i+1] columns, as required by matrix multiplication.
- The output is a binary tree. Each leaf node of the tree is an integer i representing matrix i.
- Each non-leaf node of the tree represents the multiplication of two matrices to yield a single matrix.
- The minimum cost to multiply k consecutive matrices is found by evaluating all k-1 two-way splits.
- The minimum cost is recorded in a table for every instance of k consecutive matrices (2 <= k <= n).
- Each non-leaf node of the output tree corresponds to a two-way split of minimum cost.
Fix The Tiny Bug In This Go Code: