1
subroutine dgefa(a,lda,n,ipvt,info)
2
integer lda,n,ipvt(1),info
3
double precision a(lda,1)
5
c dgefa factors a double precision matrix by gaussian elimination.
7
c dgefa is usually called by dgeco, but it can be called
8
c directly with a saving in time if rcond is not needed.
9
c (time for dgeco) = (1 + 9/n)*(time for dgefa) .
13
c a double precision(lda, n)
14
c the matrix to be factored.
17
c the leading dimension of the array a .
20
c the order of the matrix a .
24
c a an upper triangular matrix and the multipliers
25
c which were used to obtain it.
26
c the factorization can be written a = l*u where
27
c l is a product of permutation and unit lower
28
c triangular matrices and u is upper triangular.
31
c an integer vector of pivot indices.
35
c = k if u(k,k) .eq. 0.0 . this is not an error
36
c condition for this subroutine, but it does
37
c indicate that dgesl or dgedi will divide by zero
38
c if called. use rcond in dgeco for a reliable
39
c indication of singularity.
41
c linpack. this version dated 08/14/78 .
42
c cleve moler, university of new mexico, argonne national lab.
44
c subroutines and functions
46
c blas daxpy,dscal,idamax
51
integer idamax,j,k,kp1,l,nm1
54
c gaussian elimination with partial pivoting
58
if (nm1 .lt. 1) go to 70
62
c find l = pivot index
64
l = idamax(n-k+1,a(k,k),1) + k - 1
67
c zero pivot implies this column already triangularized
69
if (a(l,k) .eq. 0.0d0) go to 40
71
c interchange if necessary
73
if (l .eq. k) go to 10
82
call dscal(n-k,t,a(k+1,k),1)
84
c row elimination with column indexing
88
if (l .eq. k) go to 20
92
call daxpy(n-k,t,a(k+1,k),1,a(k+1,j),1)
101
if (a(n,n) .eq. 0.0d0) info = n