Rev 19762 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
C Modified 2002-05-20 for R to add a tolerance of positive definiteness.Ccc dpofa factors a double precision symmetric positive definitec matrix.cc dpofa is usually called by dpoco, but it can be calledc directly with a saving in time if rcond is not needed.c (time for dpoco) = (1 + 18/n)*(time for dpofa) .cc on entrycc a double precision(lda, n)c the symmetric matrix to be factored. only thec diagonal and upper triangle are used.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 r so that a = trans(r)*rc where trans(r) is the transpose.c the strict lower triangle is unaltered.c if info .ne. 0 , the factorization is not complete.cc info integerc = 0 for normal return.c = k signals an error condition. the leading minorc of order k is not positive definite.cc linpack. this version dated 08/14/78 .c cleve moler, university of new mexico, argonne national lab.cc subroutines and functionscc blas ddotc fortran dsqrtcsubroutine dpofa(a,lda,n,info)integer lda,n,infodouble precision a(lda,*)cc internal variablescdouble precision ddot,t,epsdouble precision sinteger j,jm1,kdata eps/1.d-14/c begin block with ...exits to 40ccdo 30 j = 1, ninfo = js = 0.0d0jm1 = j - 1if (jm1 .lt. 1) go to 20do 10 k = 1, jm1t = a(k,j) - ddot(k-1,a(1,k),1,a(1,j),1)t = t/a(k,k)a(k,j) = ts = s + t*t10 continue20 continues = a(j,j) - sc ......exitc if (s .le. 0.0d0) go to 40if (s .le. eps * abs(a(j,j))) go to 40a(j,j) = dsqrt(s)30 continueinfo = 040 continuereturnend