Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/invers.alg
There are 2 other files named invers.alg in the archive. Click here to see a list.
100'  NAME--INVERS
110'
120'  DESCRIPTION--INVERTS A MATRIX USING THE EXCHANGE METHOD.
130'
140'  SOURCE--UNKNOWN
150'
160'  INSTRUCTIONS--THE SIZE OF THE MATRIX IS LIMITED FROM 1
170'  TO 10 THOUGH THE PROGRAM CAN BE MODIFIED BY DELETING LINES
180'  270-310 AND BY ADDING A DIM STATEMENT FOR MATRIX A IN LINE
190'  270 IN ORDER TO INCREASE THE SIZE. THE MATRIX IS INPUT AS DATA
200'  STARTING IN LINE 710 WITH THE FIRST NUMBER THE
210'  DIMENSION OF THE MATRIX AND THE MATRIX VALUES ENTERED BY ROWS.
220'
230'
240'  *  *  *  *  *  *  *  *  *  MAIN PROGRAM  *  *  *  *  *  *  *  *  *
250'
260   READ N
270   IF N < 1 THEN 290
280   IF N < 11 THEN 320
290   PRINT "ONLY WORKS FOR MATRICES OF SIZE 1 THROUGH 10"
300   PRINT "YOU HAVE A SIZE OF " N
310   STOP
320   FOR I = 1 TO N
330   FOR J = 1 TO N
340   READ A(I,J)
350   NEXT J
360   NEXT I
370  FOR K = 1 TO N
380  LET D = -1/A(K,K)
390  FOR J = 1 TO N
400  IF J = K THEN 420
410  LET A(K,J) = A(K,J) * D
420  NEXT J
430  LET D = -D
440  FOR I = 1 TO N
450  IF I = K THEN 530
460  LET E = A(I,K)
470  FOR J = 1 TO N
480  IF J = K THEN 510
490  LET A(I,J) = A(I,J) + A(K,J)*E
500  GO TO 520
510  LET A(I,K) = A(I,K) * D
520  NEXT J
530  NEXT I
540  LET A(K,K) = D
550  NEXT K
560  PRINT
570  FOR I = 1 TO N
580  FOR J = 1 TO N
590  IF J = 6 THEN 690
600  IF J = 10 THEN 690
610  PRINT A(I,J),
620  NEXT J
630  IF N = 5 THEN 660
640  IF N = 9 THEN 660
650  PRINT
660  PRINT
670  NEXT I
680  STOP
690  PRINT "  ",
700  GO TO 610
710  DATA  3
720 DATA 1,  .5,  .33333333
730 DATA .5,  .33333333, .25
740 DATA .33333333,  .25,  .2
750END