Anonymous user
Matrix multiplication: Difference between revisions
→{{header|Tailspin}}: syntax update and clearer algorithm
(Revise to be more idiomatic and not use local) |
(→{{header|Tailspin}}: syntax update and clearer algorithm) |
||
Line 4,446:
=={{header|Tailspin}}==
<lang tailspin>
templates matmul
$A -> \[i](
1..$B::length -> @:
$@ !\) !
\) !
end matmul
templates printMatrix
templates formatN
@: [];
$ -> #
'$@ -> $::length~..$w -> ' ';$@(last..1:-1)...;' !
when <1..> do ..|@: $ mod 10; $ ~/ 10 -> #
when <=0?($@ <[](0)>)> do ..|@: 0;
end formatN
$... -> '|$(1) -> formatN;$(2..last)... -> ', $ -> formatN;';|
Line 4,469 ⟶ 4,470:
'a:
' -> !OUT::write
$a -> printMatrix
def b: [[0, 1], [2, 3], [4, 5]];
Line 4,475 ⟶ 4,476:
b:
' -> !OUT::write
$b -> printMatrix
'
axb:
' -> !OUT::write
$a -> matmul
</lang>
{{out}}
|