Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Matrix-transposition/XPL0/matrix-transposition.xpl0
Normal file
28
Task/Matrix-transposition/XPL0/matrix-transposition.xpl0
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
proc Transpose(M, R, C, N); \Transpose matrix M to N
|
||||
int M, R, C, N; \rows and columns
|
||||
int I, J;
|
||||
[for I:= 0 to R-1 do
|
||||
for J:= 0 to C-1 do
|
||||
N(J,I):= M(I,J);
|
||||
];
|
||||
|
||||
proc ShowMat(M, R, C); \Display matrix M
|
||||
int M, R, C; \rows and columns
|
||||
int I, J;
|
||||
[for I:= 0 to R-1 do
|
||||
[for J:= 0 to C-1 do
|
||||
RlOut(0, float(M(I,J)));
|
||||
CrLf(0);
|
||||
];
|
||||
];
|
||||
|
||||
int M, N(4,3);
|
||||
[M:= [[1, 2, 3, 4], \3 rows by 4 columns
|
||||
[5, 6, 7, 8],
|
||||
[9,10,11,12]];
|
||||
Format(4, 0);
|
||||
ShowMat(M, 3, 4);
|
||||
CrLf(0);
|
||||
Transpose(M, 3, 4, N);
|
||||
ShowMat(N, 4, 3);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue