RosettaCodeData/Task/Matrix-transposition/PL-I/matrix-transposition-2.pli

16 lines
304 B
Plaintext

/* Transpose matrix A, result at B. */
transpose: procedure (a, b);
declare (a, b) (*,*) float controlled;
declare (m, n) fixed binary;
if allocation(b) > 0 then free b;
m = hbound(a,1); n = hbound(a,2);
allocate b(n,m);
do i = 1 to m;
b(*,i) = a(i,*);
end;
end transpose;