Matrix multiplication: Difference between revisions

Added Easylang
(→‎{{header|Raku}}: last version is not really more concise, rather more functional. + style code tweak)
(Added Easylang)
(One intermediate revision by one other user not shown)
Line 2,016:
[75,00, 75,00, 75,00]
[117,00, 117,00, 117,00]]</pre>
=={{header|EasyLang}}==
}</syntaxhighlight>
proc matmul . m1[][] m2[][] r[][] .
r[][] = [ ]
for i to len m1[][]
r[][] &= [ ]
for j = 1 to len m2[1][]
r[i][] &= 0
for k to len m2[][]
r[i][j] += m1[i][k] * m2[k][j]
.
.
.
.
mat1[][] = [ [ 1 2 3 ] [ 4 5 6 ] ]
mat2[][] = [ [ 1 2 ] [ 3 4 ] [ 5 6 ] ]
matmul mat1[][] mat2[][] erg[][]
print erg[][]
</syntaxhighlight>
 
{{out}}
<pre>
[
[ 22 28 ]
[ 49 64 ]
]
</pre>
 
=={{header|EGL}}==
<syntaxhighlight lang="egl">
Line 5,587 ⟶ 5,615:
 
<syntaxhighlight lang="raku" line>sub infix:<·> { [+] @^a Z* @^b }
sub infix:<×>(@A, @B) { (@A X· [Z] @B).rotor(@B) }
</syntaxhighlight>
cross(@A, ([Z] @B), with => &[·])
.rotor(@B);
}</syntaxhighlight>
 
=={{header|Rascal}}==
2,041

edits