Rev 2086 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
subroutine dgefa(a,lda,n,ipvt,info)integer lda,n,ipvt(*),infodouble precision a(lda,*)cc dgefa factors a double precision matrix by gaussian elimination.cc dgefa is usually called by dgeco, but it can be calledc directly with a saving in time if rcond is not needed.c (time for dgeco) = (1 + 9/n)*(time for dgefa) .cc on entrycc a double precision(lda, n)c the matrix to be factored.cc lda integerc the leading dimension of the array a .cc n integerc the order of the matrix a .cc on returncc a an upper triangular matrix and the multipliersc which were used to obtain it.c the factorization can be written a = l*u wherec l is a product of permutation and unit lowerc triangular matrices and u is upper triangular.cc ipvt integer(n)c an integer vector of pivot indices.cc info integerc = 0 normal value.c = k if u(k,k) .eq. 0.0 . this is not an errorc condition for this subroutine, but it doesc indicate that dgesl or dgedi will divide by zeroc if called. use rcond in dgeco for a reliablec indication of singularity.cc linpack. this version dated 08/14/78 .c cleve moler, university of new mexico, argonne national lab.cc subroutines and functionscc blas daxpy,dscal,idamaxcc internal variablescdouble precision tinteger idamax,j,k,kp1,l,nm1ccc gaussian elimination with partial pivotingcinfo = 0nm1 = n - 1if (nm1 .lt. 1) go to 70do 60 k = 1, nm1kp1 = k + 1cc find l = pivot indexcl = idamax(n-k+1,a(k,k),1) + k - 1ipvt(k) = lcc zero pivot implies this column already triangularizedcif (a(l,k) .eq. 0.0d0) go to 40cc interchange if necessarycif (l .eq. k) go to 10t = a(l,k)a(l,k) = a(k,k)a(k,k) = t10 continuecc compute multipliersct = -1.0d0/a(k,k)call dscal(n-k,t,a(k+1,k),1)cc row elimination with column indexingcdo 30 j = kp1, nt = a(l,j)if (l .eq. k) go to 20a(l,j) = a(k,j)a(k,j) = t20 continuecall daxpy(n-k,t,a(k+1,k),1,a(k+1,j),1)30 continuego to 5040 continueinfo = k50 continue60 continue70 continueipvt(n) = nif (a(n,n) .eq. 0.0d0) info = nreturnend