Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0020/cdeter.alg
There are 2 other files named cdeter.alg in the archive. Click here to see a list.
```100'  NAME--CDETER
110'
120'  DESCRIPTION--COMPLEX DETERMINANT EVALUATOR
130'
140'  SOURCE--FORTRAN SUBROUTINE BY L. C. KELLY BBC LIBRARY
150'  ROUTINE NO. 7.03.02, 10/31/61.
160'  THE CROUT METHOD USED IS EXPLAINED IN "INTRODUCTION TO NUMERICAL
170'  ANALYSIS", F.B. HILDEBRAND, MCGRAW-HILL, 1956,PP.429-39.
180'  THE BASIC COMPLEX DETERMINANT EVALUATOR WAS WRITTEN BY
190'  MRS. CARLA MESSINA OF THE EQUATION OF STATE SECTION, N.B.S.,
200'  6/15/65.
210'
220'  INSTRUCTIONS--ENTER THE SIZE OF THE DETERMINANT AS DATA IN
230'  LINE 300.
240'  THE COMPLEX MATRIX IS TO BE GIVEN AS DATA IN LINE 310 .
250'  THE REAL PART OF THE NUMBER IS TO PRECEED THE IMAGINARY PART.
260'
270'
280'  *  *  *  *  *  *  *  *  MAIN PROGRAM  *  *  *  *  *  *  *  *  *
290'
300 DATA 2
310 DATA .567854,-.12564532,0,0
320 DATA 0,0,.4563245,.45367899
330 PRINT "COMPLEX DETERMINANT EVALUATOR"
340 PRINT
350 READ N
360 FOR I=1 TO N
370 FOR J = 1 TO N
380 READ A(I,J),B(I,J)
390 PRINT A(I,J);B(I,J);
400 NEXT J
410 PRINT
420 PRINT
430 NEXT I
440 DIM A(23,23),B(23,23)
450 LET D1=1.
460 LET D2=0.
470 LET I1=1.
480 LET I3=I1
490 LET S = ABS(A(I1,I1)) + ABS(B(I1,I1))
500 FOR I = I1 TO N
510 LET T = ABS(A(I,I1)) + ABS(B(I,I1))
520 IF S >= T THEN 550
530 LET I3 = I
540 LET S = T
550 NEXT I
560 IF I3=I1 THEN 650
570 FOR J = 1 TO N
580 LET S = -A(I1,J)
590 LET A(I1,J)=A(I3,J)
600 LET A(I3,J)=S
610 LET S1= -B(I1,J)
620 LET B(I1,J)=B(I3,J)
630 LET B(I3,J)=S1
640 NEXT J
650 LET I3 = I1 +1
660 FOR I = I3 TO N
670 LET S1 = A(I1,I1)*A(I1,I1)+ B(I1,I1)*B(I1,I1)
680 LET S = (A(I,I1)*A(I1,I1) + B(I,I1)*B(I1,I1))/S1
690 LET B(I,I1)=(A(I1,I1)*B(I,I1) - A(I,I1)*B(I1,I1))/S1
700 LET A(I,I1)=S
710 NEXT I
720 LET J2=I1-1
730 IF J2=0 THEN 800
740 FOR J = I3 TO N
750 FOR I = 1 TO J2
760 LET A(I1,J)=A(I1,J) - A(I1,I)*A(I,J) + B(I1,I)*B(I,J)
770 LET B(I1,J)=  B(I1,J) - B(I1,I)*A(I,J) - A(I1,I)*B(I,J)
780 NEXT I
790 NEXT J
800 LET J2 = I1
810 LET I1 = I1+1
820 FOR I = I1 TO N
830 FOR J = 1 TO J2
840 LET A(I,I1) = A(I,I1) - A(I,J)*A(J,I1) + B(I,J)*B(J,I1)
850 LET B(I,I1) = B(I,I1) - B(I,J)*A(J,I1) - A(I,J)*B(J,I1)
860 NEXT J
870 NEXT I
880 IF I1<>N THEN 480
890 LET I3 = 1
900 LET J2 = INT(N/2)
910 IF N = 2*J2 THEN 950
920 LET I3 = 0
930 LET D1 = A(N,N)
940 LET D2 = B(N,N)
950 FOR I = 1 TO J2
960 LET J = N - I + I3
970 LET S = A(I,I)*A(J ,J) - B(I,I)*B(J,J)
980 LET S1 = A(I,I)*B(J,J) + A(J,J)*B(I,I)
990 LET T = D1*S - D2*S1
1000 LET D2 = D2*S + D1*S1
1010 LET D1 = T
1020 NEXT I
1030 PRINT
1040 PRINT "REAL C","IMAGINARY C"
1050 PRINT
1060 PRINT D1,D2
1070 STOP
1080 END

```