dos_compilers/Digital Research PLI-86 v1/MAININVT.PLI
2024-06-30 12:01:25 -07:00

65 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******************************************************/
/* This program is the main module in a program that */
/* performs matrix inversion. It calls the entry */
/* constant INVERT which does the actual inversion. */
/******************************************************/
maininvt:
procedure options(main);
%replace
true by '1'b,
false by '0'b;
%include 'matsize.lib';
declare
mat(maxrow,maxcol) float binary(24),
(i,j,n,m) fixed(6),
var character (26) static initial
('abcdefghijklmnopqrstuvwxyz'),
invert entry
((maxrow,maxcol) float(24), fixed(6), fixed(6));
put list('Solution of Simultaneous Equations');
do while(true);
put skip(2) list('Type rows, columns: ');
get list(n);
if n = 0 then
stop;
get list(m);
if n > maxrow ! m > maxcol then
put skip list('Matrix is Too Large');
else
do;
put skip list('Type Matrix of Coefficients');
put skip;
do i = 1 to n;
put list('Row',i,':');
get list((mat(i,j) do j = 1 to n));
end;
put skip list('Type Solution Vectors');
put skip;
do j = n + 1 to m;
put list('Variable',substr(var,j-n,1),':');
get list((mat(i,j) do i = 1 to n));
end;
call invert(mat,n,m);
put skip(2) list('Solutions:');
do i = 1 to n;
put skip list(substr(var,i,1),'=');
put edit((mat(i,j) do j = 1 to m-n))
(f(8,2));
end;
put skip(2) list('Inverse Matrix is');
do i = 1 to n;
put skip edit((mat(i,j) do j = m-n+1 to m))
(x(3),6f(8,2),skip);
end;
end;
end;
end maininvt;