Matrix Chain Multiplier

Dynamically finds the optimal parenthetical ordering of matrices to minimize number of operations. Uses a finite state machine for input validation. Takes an input consisting a series of matrices (up to 26), and outputs the optimal parenthetical ordering. Click to view file

Input

[8,3], [3,4], [4,10], [10, 12]

Output

|----------------------------------------------|
|0  |96    |360   |768   |
|----------------------------------------------|
|X  |0   |120   |480   |
|----------------------------------------------|
|X  |X   |0    |480   |
|----------------------------------------------|
|X  |X   |X    |0    |
|----------------------------------------------|
Minimum work value: 768
A((BC)D)