
TYPE 1
1;FORMAT(/,"SOLUTION OF LINEAR EQUATIONS IN MATRIX FORM AX=B
WILL HANDLE UP TO SIZE 8X8...LOAD DATA TAPE - HIT CONTINUE")
PAUSE
TYPE 2
2;FORMAT(/,/,"SIZE OF MATRIX    ")
ACCEPT 3,N
3;FORMAT(I)
LAST = N*N
DIMENSION A(72)
TYPE 4
4;FORMAT(/,/,"INPUT MATRIX VALUES, A11, A12, A13, ETC.",/)
C;READ IN DATA
I1 = 1
I2S = LAST-N+1
I2 = I2S
DO 100 J = 1,N
DO 101 I = I1,I2,N
ACCEPT 5,A(I)
5;FORMAT(E)
101;CONTINUE
I1 = I1 + 1
I2 = I2 + 1
100;CONTINUE
TYPE 9
9;FORMAT(/,/,"ORIGINAL MATRIX VALUES",/)
JOG = 1
GO TO 200
C;BEGIN INVERSION
C;J IS INDEX OF STAGE OF INVERSION
149;DO 150 J = 1,N
C;SET UP UNIT VECTOR
DO 105 I = 1,N
A(LAST+I) = 0.0
105;CONTINUE
A(LAST+J) = 1.0
C;SET UP TO CLEAR PIVOT ROW
PVT = A(J)
J3 = LAST + J
DO 106 KP = J,J3,N
A(KP) = A(KP)/PVT
106;CONTINUE
C;CALCULATE REMAINING ROWS
DO 110 KRT = 1,N
IF(KRT-J) 107,110,107
107;KR1 = KRT
KR2 = KR1 + LAST
KPR = J
RWC = A(KR1)
DO 109 KR = KR1,KR2,N
A(KR) = A(KR) - RWC * A(KPR)
KPR = KPR + N
109;CONTINUE
110;CONTINUE
C;SHIFT ARRAY TO ELIMINATE LEADING UNIT VECTOR
DO 111 I = 1,LAST
A(I) = A(I+N)
111;CONTINUE
150;CONTINUE
TYPE 160
160;FORMAT(/,/,"THE INVERSE MATRIX IS"/)
JOG  = 2
GO TO 200
C;PRINT OUT SUBROUTINE
200;ILNE = 4
NR=NRC=1
TYPE 201,NR
201;FORMAT(/,"ROW ",I,/)
I1 = 1
I2=I2S
KONT = 1
DO 210 JP = 1,N
DO 213 I = I1,I2,N
TYPE 5,A(I)
IF(N-NRC) 216,216,215
216;IF(N-NR) 213,213,217
217;NR=NR+1
NRC=KONT=1
ILNE = 4
TYPE 201,NR
GO TO 213
215;IF(KONT-ILNE) 214,220,214
220;ILNE = ILNE + 4
TYPE 221
221;FORMAT(/,/)
214;KONT = KONT + 1
NRC = NRC+1 
213;CONTINUE
I1 = I1 + 1
I2 = I2 + 1
210;CONTINUE
GO TO (149,299),JOG
C;FORM PRODUCT A-INVERSE TIMES B-VECTOR
DIMENSION X(8)
299;TYPE 300
300;FORMAT(/,/,"B-VECTOR ENTRIES",/)
DO 301 I = 1,N
IN = LAST + I
ACCEPT 302,A(IN)
302;FORMAT(E,/)
TYPE 302,A(IN)
301;CONTINUE
I1 = 1
I2 = I2S
DO 303 IP = 1,N
X(IP) = 0.0
J = LAST + 1
DO 304 I = I1,I2,N
X(IP) = X(IP) + A(I)*A(J)
J = J + 1
304;CONTINUE
I1 = I1 + 1
I2 = I2 + 1
303;CONTINUE
TYPE 310
310;FORMAT(/,/,"VECTOR OF RESULTS",/)
DO 305 I = 1,N
TYPE 302, X(I)
305;CONTINUE
TYPE 306
306;FORMAT(/,/,"TO INPUT ANOTHER B-VECTOR, TYPE 1    ")
ACCEPT 307, M
307;FORMAT(I)
IF(M) 400,400,299
400;STOP
END
