PARAMETER (N=6) DIMENSION A(N,N),B(N*N) DATA A / 8, 5, 19, 17, 4, 11, & 19, 10, 12, 11, 4, 14, & 4, 5, 8, 6, 15, 18, & 19, 4, 13, 15, 9, 9, & 15, 12, 10, 4, 4, 17, & 8, 11, 14, 9, 18, 6/ DO I=1,N ! PRINT 11,I,(A(I,J),J=1,N) ENDDO DO I=1,N DO J=I+1,N TMP=A(I,J) A(I,J)=A(J,I) A(J,I)=TMP ENDDO ENDDO DO I=1,N PRINT 11,I,(A(I,J),J=1,N) ENDDO 11 FORMAT(I7,6F6.0) D=DET(A,6) PRINT*,D K=0 DO I=2,N DO J=2,N K=K+1 B(K)=A(J,I) ENDDO ENDDO D=DET(B,5) PRINT*,D PRINT*,PPDS(A,N,3,5) END !+++++++++++++++++++++++++++++++++ ! FUNCTION PPDS(A,N,IR,JC) ! ! HAM NAY TINH PHAN PHU DAI SO CUA PHAN TU B(IR,JC) ! (HANG IR, COT JC) CUA MA TRAN B(NxN) MA CAC PHAN TU ! CUA NO DUOC LUU TRONG MANG A(N*N) THEO QUI CACH COT ! TRUOC DONG SAU ! INPUT: + MANG A(N*N) CHUA MA TRAN DAU VAO CUA B ! + N KICH THUOC CUA B ! + IR CHI SO HANG ! + JC CHI SO COT ! OUTPUT: PHAN PHU DAI SO CUA PHAN TU HANG IR COT JC ! DIMENSION A(N*N), B(N,N) K=0 DO J=1,N DO I=1,N K=K+1 B(I,J)=A(K) ENDDO ENDDO K=0 DO J=1,N IF (J.NE.JC) THEN DO I=1,N IF (I.NE.IR) THEN K=K+1 A(K)=B(I,J) ENDIF ENDDO ENDIF ENDDO PPDS=DET(A,N-1)*(-1)**(IR+JC) RETURN END FUNCTION DET(X,N) ! HAM NAY TINH DINH THUC CUA MA TRAN A(N,N) ! INPUT: + MANG X DO DAI N*N CHUA CAC PHAN TU CUA MA TRAN A ! + N KICH THUOC MA TRAN A ! CHU Y: X(1)=A(1,1), X(2)=A(2,1),..., X(N)=A(N,1),X(N+1)=A(1,2), ! X(N+2)=A(2,2),... ! OUTPUT: DINH THUC CUA A ! PARAMETER (EP=1.0E-6) DIMENSION X(N*N),A(N,N) K=0 DO J=1,N DO I=1,N K=K+1 A(I,J)=X(K) ENDDO ENDDO D=1.0 N1=N-1 DO 10 K=1,N1 AM=0.0 DO 11 I=K,N T=A(I,K) IF (ABS(T).GE.ABS(AM)) THEN AM=T J=I ENDIF 11 CONTINUE IF (ABS(AM).LE.EP) THEN DT=0.0 DET=DT RETURN ELSE IF (J.NE.K) THEN D=-D DO I=K,N T=A(J,I) A(J,I)=A(K,I) A(K,I)=T ENDDO ENDIF ENDIF M=K+1 DO I=M,N T=A(I,K)/AM DO J=M,N A(I,J)=A(I,J)-T*A(K,J) ENDDO ENDDO D=D*A(K,K) 10 CONTINUE DT=D*A(N,N) DET=DT RETURN END