Rev 2086 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
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 do 10 j = 1, pc call dgesl(a,lda,n,ipvt,c(1,j),0)c 10 continuecc 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) go to 50cc job = 0 , solve a * x = bc first solve l*y = bcif (nm1 .lt. 1) go to 30do 20 k = 1, nm1l = ipvt(k)t = b(l)if (l .eq. k) go to 10b(l) = b(k)b(k) = t10 continuecall daxpy(n-k,t,a(k+1,k),1,b(k+1),1)20 continue30 continuecc now solve u*x = ycdo 40 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)40 continuego to 10050 continuecc job = nonzero, solve trans(a) * x = bc first solve trans(u)*y = bcdo 60 k = 1, nt = ddot(k-1,a(1,k),1,b(1),1)b(k) = (b(k) - t)/a(k,k)60 continuecc now solve trans(l)*x = ycif (nm1 .lt. 1) go to 90do 80 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 .eq. k) go to 70t = b(l)b(l) = b(k)b(k) = t70 continue80 continue90 continue100 continuereturnend