dgeev_rel Subroutine

private pure subroutine dgeev_rel(matrix, eig_vecr, eig_val, eig_vecl)

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in), dimension(:,:) :: matrix
real(kind=rk), intent(out), dimension(:,:), allocatable :: eig_vecr
real(kind=rk), intent(out), dimension(:), allocatable :: eig_val
real(kind=rk), intent(out), optional, dimension(:,:), allocatable :: eig_vecl

Called by

proc~~dgeev_rel~~CalledByGraph proc~dgeev_rel foreig::dgeev_rel proc~eig_rel foreig::eig_rel proc~eig_rel->proc~dgeev_rel interface~eig foreig::eig interface~eig->proc~eig_rel program~benchmark benchmark program~benchmark->interface~eig program~test1 test1 program~test1->interface~eig

Source Code

   pure subroutine dgeev_rel(matrix, eig_vecr, eig_val, eig_vecl)
      real(rk), dimension(:,:), intent(in)                         :: matrix
      real(rk), dimension(:),   allocatable, intent(out)           :: eig_val
      real(rk), dimension(:,:), allocatable, intent(out)           :: eig_vecr
      real(rk), dimension(:,:), allocatable, intent(out), optional :: eig_vecl
      real(rk), dimension(size(matrix,1))                          :: wr, wi
      real(rk), dimension(size(matrix,1),size(matrix,1))           :: vl, vr
      real(rk), dimension(size(matrix,1),size(matrix,1))           :: A
      real(rk), dimension(:), allocatable                          :: work
      integer                                                      :: m, lwork, info
      real(rk)                                                     :: work1(1)

      interface
         pure subroutine dgeev(fjobvl, fjobvr, fn, fA, flda, fwr, fwi, fvl, fldvl, fvr, fldvr, fwork, flwork, finfo)
            import :: rk
            character, intent(in)    :: fjobvl, fjobvr
            integer,   intent(in)    :: fn, flda, fldvl, fldvr, flwork, finfo
            real(rk),  intent(inout) :: fA(flda, *)
            real(rk),  intent(out)   :: fwr(fn), fwi(fn), fvl(fldvl, *), fvr(fldvr, *), fwork(flwork)
         end subroutine
      end interface

      m = size(matrix, 1)
      A = matrix

      if (present(eig_vecl)) then
         eig_vecl = matrix
         call dgeev('V', 'V', m, A, m, wr, wi, vl, m, vr, m, work1, -1, info)
      else
         call dgeev('N', 'V', m, A, m, wr, wi, vl, m, vr, m, work1, -1, info)
      end if

      lwork = nint(work1(1))
      allocate(work(lwork))

      if (present(eig_vecl)) then
         call dgeev('V', 'V', m, A, m, wr, wi, vl, m, vr, m, work, lwork, info)
         eig_vecl = vl
      else
         call dgeev('N', 'V', m, A, m, wr, wi, vl, m, vr, m, work, lwork, info)
      end if

      eig_val  = wr
      eig_vecr = vr

      deallocate(work)

   end subroutine dgeev_rel