Matrix chain multiplication: Difference between revisions
Content added Content deleted
No edit summary |
Thundergnat (talk | contribs) m (Regularize non-standard header markup) |
||
Line 747: | Line 747: | ||
</pre> |
</pre> |
||
== |
=={{header|MATLAB}}== |
||
{{trans|Fortran}} |
{{trans|Fortran}} |
||
Line 804: | Line 804: | ||
"(1*((((((2*3)*4)*(((5*6)*7)*8))*9)*10)*11))"</lang> |
"(1*((((((2*3)*4)*(((5*6)*7)*8))*9)*10)*11))"</lang> |
||
== |
=={{header|Lua}}== |
||
<lang lua>-- Matrix A[i] has dimension dims[i-1] x dims[i] for i = 1..n |
<lang lua>-- Matrix A[i] has dimension dims[i-1] x dims[i] for i = 1..n |
||
local function MatrixChainOrder(dims) |
local function MatrixChainOrder(dims) |
||
Line 982: | Line 982: | ||
</pre> |
</pre> |
||
== |
=={{header|Python}}== |
||
We will solve the task in three steps: |
We will solve the task in three steps: |
||
Line 1,187: | Line 1,187: | ||
</pre> |
</pre> |
||
== |
=={{header|Racket}}== |
||
'''Memoization''' |
'''Memoization''' |
||
Line 1,373: | Line 1,373: | ||
</pre> |
</pre> |
||
== |
=={{header|Stata}}== |
||
=== Recursive solution === |
=== Recursive solution === |
||
{{trans|Python}} |
{{trans|Python}} |