RosettaCodeData/Task/Matrix-transposition/PL-I/matrix-transposition-2.pli
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

15 lines
304 B
Text

/* 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;