Jump to content

Matrix chain multiplication: Difference between revisions

m
→‎{{header|Perl 6}}: Formatting, marked incomplete
(Added Perl example)
m (→‎{{header|Perl 6}}: Formatting, marked incomplete)
Line 591:
(A1((((((A2A3)A4)(((A5A6)A7)A8))A9)A10)A11))</pre>
 
== {{header|Perl 6}} ==
 
{{incomplete|Perl 6|Does not show computed cost}}
<lang perl6># Reference:
# "Find the optimal way to multiply a chain of matrices. " was the first tasks at
Line 678 ⟶ 680:
}</lang>
 
{{Out}}
Output:
<pre>
<lang perl6>
./mcm3.p6
1, 5, 25, 30, 100, 70, 2, 1, 100, 250, 1, 1000, 2
((((((((A1A2)A3)A4)A5)A6)A7)(A8(A9A10)))(A11A12))
</langpre>
<pre>
<lang perl6>
./mcm3.p6
1000, 1, 500, 12, 1, 700, 2500, 3, 2, 5, 14, 10
(A1((((((A2A3)A4)(((A5A6)A7)A8))A9)A10)A11))
</langpre>
 
== {{header|Python}} ==
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.