Rev 8399 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
c A LINPACK routine updated for Fortran 90.subroutine dgesl(a,lda,n,ipvt,b,job)integer lda,n,ipvt(*),jobdouble precision a(lda,*),b(*)cc dgesl solves the double precision systemc a * x = b or trans(a) * x = bc using the factors computed by dgeco or dgefa.cc on entrycc a double precision(lda, n)c the output from dgeco or dgefa.cc lda integerc the leading dimension of the array a .cc n integerc the order of the matrix a .cc ipvt integer(n)c the pivot vector from dgeco or dgefa.cc b double precision(n)c the right hand side vector.cc job integerc = 0 to solve a*x = b ,c = nonzero to solve trans(a)*x = b wherec trans(a) is the transpose.cc on returncc b the solution vector x .cc error conditioncc a division by zero will occur if the input factor contains ac zero on the diagonal. technically this indicates singularityc but it is often caused by improper arguments or improperc setting of lda . it will not occur if the subroutines arec called correctly and if dgeco has set rcond .gt. 0.0c or dgefa has set info .eq. 0 .cc to compute inverse(a) * c where c is a matrixc with p columnsc call dgeco(a,lda,n,ipvt,rcond,z)c if (rcond is too small) go to ...c j = 1, pc call dgesl(a,lda,n,ipvt,c(1,j),0)c end docc linpack. this version dated 08/14/78 .c cleve moler, university of new mexico, argonne national lab.cc subroutines and functionscc blas daxpy,ddotcc internal variablescdouble precision ddot,tinteger k,kb,l,nm1cnm1 = n - 1if (job .ne. 0) thencc job = 0 , solve a * x = bc first solve l*y = bcif (nm1 .ge. 1) thendo k = 1, nm1l = ipvt(k)t = b(l)if (l .ne. k) thenb(l) = b(k)b(k) = tend ifcall daxpy(n-k,t,a(k+1,k),1,b(k+1),1)end doend ifcc now solve u*x = ycdo kb = 1, nk = n + 1 - kbb(k) = b(k)/a(k,k)t = -b(k)call daxpy(k-1,t,a(1,k),1,b(1),1)end doreturnend ifcc job = nonzero, solve trans(a) * x = bc first solve trans(u)*y = bcdo k = 1, nt = ddot(k-1,a(1,k),1,b(1),1)b(k) = (b(k) - t)/a(k,k)end docc now solve trans(l)*x = ycif (nm1 .lt. 1) returndo kb = 1, nm1k = n - kbb(k) = b(k) + ddot(n-k,a(k+1,k),1,b(k+1),1)l = ipvt(k)if (l .ne. k) thent = b(l)b(l) = b(k)b(k) = tend ifend doreturnend