Matrix transposition: Difference between revisions
Content added Content deleted
m (→[[Matrix transposition#ALGOL 68]]: fix rev tag) |
|||
Line 991: | Line 991: | ||
1.00000 8.00000 27.00000 64.00000 125.00000 |
1.00000 8.00000 27.00000 64.00000 125.00000 |
||
1.00000 16.00000 81.00000 256.00000 625.00000 |
1.00000 16.00000 81.00000 256.00000 625.00000 |
||
Manually: |
|||
<lang perl>my @m = ( |
|||
[1, 1, 1, 1], |
|||
[2, 4, 8, 16], |
|||
[3, 9, 27, 81], |
|||
[4, 16, 64, 256], |
|||
[5, 25, 125, 625], |
|||
); |
|||
my @transposed; |
|||
foreach my $j (0..$#{$m[0]}) { |
|||
push(@transposed, [map $_->[$j], @m]); |
|||
}</lang> |
|||
=={{header|PHP}}== |
=={{header|PHP}}== |