
Optimal parenthesisation of a matrix chain (matrix-chain DP)
Source:R/geron_w4d_native.R
morie_geron_matmul_order.RdOptimal parenthesisation of a matrix chain (matrix-chain DP)
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_matmul_order(V)
#> $cost
#> [1] 166
#>
#> $split
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 0 1 2 3 4 5 6
#> [2,] 0 0 2 3 4 5 6
#> [3,] 0 0 0 3 4 5 6
#> [4,] 0 0 0 0 4 5 6
#> [5,] 0 0 0 0 0 5 6
#> [6,] 0 0 0 0 0 0 6
#> [7,] 0 0 0 0 0 0 0
#>