Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Matrix-multiplication/PL-I/matrix-multiplication.pli
Normal file
23
Task/Matrix-multiplication/PL-I/matrix-multiplication.pli
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/* Matrix multiplication of A by B, yielding C */
|
||||
MMULT: procedure (a, b, c);
|
||||
declare (a, b, c)(*,*) float controlled;
|
||||
declare (i, j, m, n, p) fixed binary;
|
||||
|
||||
if hbound(a,2) ^= hbound(b,1) then
|
||||
do;
|
||||
put skip list
|
||||
('Matrices are incompatible for matrix multiplication');
|
||||
signal error;
|
||||
end;
|
||||
|
||||
m = hbound(a, 1); p = hbound(b, 2);
|
||||
if allocation(c) > 0 then free c;
|
||||
|
||||
allocate c(m,p);
|
||||
|
||||
do i = 1 to m;
|
||||
do j = 1 to p;
|
||||
c(i,j) = sum(a(i,*) * b(*,j) );
|
||||
end;
|
||||
end;
|
||||
end MMULT;
|
||||
Loading…
Add table
Add a link
Reference in a new issue