mat_wpofa Subroutine

public subroutine mat_wpofa(ar, ai, lda, n, info)

Arguments

Type IntentOptional Attributes Name
double precision :: ar(lda,*)
double precision :: ai(lda,*)
integer :: lda
integer :: n
integer :: info

Source Code

subroutine mat_wpofa(ar,ai,lda,n,info)
implicit none
integer          :: lda
double precision :: ar(lda,*)
double precision :: ai(lda,*)
integer          :: n
integer          :: info

double precision :: s
double precision :: tr
double precision :: ti
integer          :: j
integer          :: jm1
integer          :: k

   do j = 1 , n
      info = j
      s = 0.0d0
      jm1 = j - 1
      if ( jm1>=1 ) then
         do k = 1 , jm1
            tr = ar(k,j) - mat_wdotcr(k-1,ar(1,k),ai(1,k),1,ar(1,j),ai(1,j),1)
            ti = ai(k,j) - mat_wdotci(k-1,ar(1,k),ai(1,k),1,ar(1,j),ai(1,j),1)
            call mat_wdiv(tr,ti,ar(k,k),ai(k,k),tr,ti)
            ar(k,j) = tr
            ai(k,j) = ti
            s = s + tr*tr + ti*ti
         enddo
      endif
      s = ar(j,j) - s
      if ( s<=0.0d0 .or. ai(j,j)/=0.0d0 ) return
      ar(j,j) = dsqrt(s)
   enddo
   info = 0
end subroutine mat_wpofa