123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- SUBROUTINE CGEFA(A,LDA,N,IPVT,INFO)
- INTEGER LDA,N,IPVT(*),INFO
- COMPLEX A(LDA,*)
- C
- C CGEFA FACTORS A COMPLEX MATRIX BY GAUSSIAN ELIMINATION.
- C
- C CGEFA IS USUALLY CALLED BY CGECO, BUT IT CAN BE CALLED
- C DIRECTLY WITH A SAVING IN TIME IF RCOND IS NOT NEEDED.
- C (TIME FOR CGECO) = (1 + 9/N)*(TIME FOR CGEFA) .
- C
- C ON ENTRY
- C
- C A COMPLEX(LDA, N)
- C THE MATRIX TO BE FACTORED.
- C
- C LDA INTEGER
- C THE LEADING DIMENSION OF THE ARRAY A .
- C
- C N INTEGER
- C THE ORDER OF THE MATRIX A .
- C
- C ON RETURN
- C
- C A AN UPPER TRIANGULAR MATRIX AND THE MULTIPLIERS
- C WHICH WERE USED TO OBTAIN IT.
- C THE FACTORIZATION CAN BE WRITTEN A = L*U WHERE
- C L IS A PRODUCT OF PERMUTATION AND UNIT LOWER
- C TRIANGULAR MATRICES AND U IS UPPER TRIANGULAR.
- C
- C IPVT INTEGER(N)
- C AN INTEGER VECTOR OF PIVOT INDICES.
- C
- C INFO INTEGER
- C = 0 NORMAL VALUE.
- C = K IF U(K,K) .EQ. 0.0 . THIS IS NOT AN ERROR
- C CONDITION FOR THIS SUBROUTINE, BUT IT DOES
- C INDICATE THAT CGESL OR CGEDI WILL DIVIDE BY ZERO
- C IF CALLED. USE RCOND IN CGECO FOR A RELIABLE
- C INDICATION OF SINGULARITY.
- C
- C LINPACK. THIS VERSION DATED 08/14/78 .
- C CLEVE MOLER, UNIVERSITY OF NEW MEXICO, ARGONNE NATIONAL LAB.
- C
- C SUBROUTINES AND FUNCTIONS
- C
- C BLAS CAXPY,CSCAL,ICAMAX
- C FORTRAN ABS,AIMAG,REAL
- C
- C INTERNAL VARIABLES
- C
- COMPLEX T
- INTEGER ICAMAX,J,K,KP1,L,NM1
- C
- COMPLEX ZDUM
- REAL CABS1
- CABS1(ZDUM) = ABS(REAL(ZDUM)) + ABS(AIMAG(ZDUM))
- C
- C GAUSSIAN ELIMINATION WITH PARTIAL PIVOTING
- C
- INFO = 0
- NM1 = N - 1
- IF (NM1 .LT. 1) GO TO 70
- DO 60 K = 1, NM1
- KP1 = K + 1
- C
- C FIND L = PIVOT INDEX
- C
- L = ICAMAX(N-K+1,A(K,K),1) + K - 1
- IPVT(K) = L
- C
- C ZERO PIVOT IMPLIES THIS COLUMN ALREADY TRIANGULARIZED
- C
- IF (CABS1(A(L,K)) .EQ. 0.0E0) GO TO 40
- C
- C INTERCHANGE IF NECESSARY
- C
- IF (L .EQ. K) GO TO 10
- T = A(L,K)
- A(L,K) = A(K,K)
- A(K,K) = T
- 10 CONTINUE
- C
- C COMPUTE MULTIPLIERS
- C
- T = -(1.0E0,0.0E0)/A(K,K)
- CALL CSCAL(N-K,T,A(K+1,K),1)
- C
- C ROW ELIMINATION WITH COLUMN INDEXING
- C
- DO 30 J = KP1, N
- T = A(L,J)
- IF (L .EQ. K) GO TO 20
- A(L,J) = A(K,J)
- A(K,J) = T
- 20 CONTINUE
- CALL CAXPY(N-K,T,A(K+1,K),1,A(K+1,J),1)
- 30 CONTINUE
- GO TO 50
- 40 CONTINUE
- INFO = K
- 50 CONTINUE
- 60 CONTINUE
- 70 CONTINUE
- IPVT(N) = N
- IF (CABS1(A(N,N)) .EQ. 0.0E0) INFO = N
- RETURN
- END
|