RosettaCodeData/Task/Matrix-transposition/SPAD/matrix-transposition.spad

25 lines
838 B
Plaintext

(1) -> originalMatrix := matrix [[1, 1, 1, 1],[2, 4, 8, 16], _
[3, 9, 27, 81],[4, 16, 64, 256], _
[5, 25, 125, 625]]
+1 1 1 1 +
| |
|2 4 8 16 |
| |
(1) |3 9 27 81 |
| |
|4 16 64 256|
| |
+5 25 125 625+
Type: Matrix(Integer)
(2) -> transposedMatrix := transpose(originalMatrix)
+1 2 3 4 5 +
| |
|1 4 9 16 25 |
(2) | |
|1 8 27 64 125|
| |
+1 16 81 256 625+
Type: Matrix(Integer)