@brief Find eigenvalues and eigenvectors of symmetric matrix in full format @param[in] mode algorithm of diagonalization (not used now) @param[in] n matrix dimension @param[in,out] a matrix to be diagonalized, overwritten by the eigenvectors on the exit @param[in] lda leading dimension of the matrix @param[out] eig eigenvalues @param[out] ierr status
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | mode | |||
integer, | intent(in) | :: | n | |||
real(kind=dp), | intent(inout) | :: | a(*) | |||
integer, | intent(in) | :: | lda | |||
real(kind=dp), | intent(out) | :: | eival(*) | |||
integer, | intent(out), | optional | :: | ierr |
subroutine diag_symm_full(mode, n, a, lda, eival, ierr) use messages, only: show_message, WITH_ABORT, WITHOUT_ABORT ! integer, intent(in) :: mode integer, intent(in) :: n, lda real(dp), intent(inout) :: a(*) real(kind=dp), intent(out) :: eival(*) integer, optional, intent(out) :: ierr integer(blas_int) :: lda_, n_, info, ione, lwork integer :: iok real(dp), dimension(:), allocatable :: work real(dp) :: rwork(1) logical :: fatal character(16) :: driver lda_ = int(lda, kind=blas_int) n_ = int(n, kind=blas_int) ione = 1 fatal = WITH_ABORT if (present(ierr)) fatal = WITHOUT_ABORT driver = 'DSYEV' call dsyev('V', 'U', n_, a, lda_, eival, rwork, -1_blas_int, info) lwork = int(nint(rwork(1)), blas_int) allocate (work(lwork), stat=iok) if (iok /= 0) then if (present(ierr)) ierr = iok call show_message('Cannot allocate memory', fatal) return end if call dsyev('V', 'U', n_, a, lda_, eival, work, lwork, info) if (present(ierr)) ierr = info if (info /= 0) then call show_message('(A,I0)', & trim(driver)//' FAILED! INFO: ', int(info), fatal) end if end subroutine diag_symm_full