compute_real_eigenvalues_and_normalized_eigenvectors Subroutine

public subroutine compute_real_eigenvalues_and_normalized_eigenvectors(n, a, e, v, n_results, ierr)

Uses

  • proc~~compute_real_eigenvalues_and_normalized_eigenvectors~~UsesGraph proc~compute_real_eigenvalues_and_normalized_eigenvectors eispack_module::compute_real_eigenvalues_and_normalized_eigenvectors module~numbers_module numbers_module proc~compute_real_eigenvalues_and_normalized_eigenvectors->module~numbers_module module~kind_module kind_module module~numbers_module->module~kind_module iso_fortran_env iso_fortran_env module~kind_module->iso_fortran_env

Returns only the real eigenvalues and the associated eigenvectors. Wrapper for compute_eigenvalues_and_eigenvectors.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n

the order of the matrix a

real(kind=wp), intent(in), dimension(n,n) :: a

contains the real general matrix

real(kind=wp), intent(out), dimension(:), allocatable :: e

eigenvalues (size n_results)

real(kind=wp), intent(out), dimension(:,:), allocatable :: v

eigenvectors (size n,n_results)

integer, intent(out) :: n_results

number of real eigenvalues

integer, intent(out) :: ierr

output flag from rg


Calls

proc~~compute_real_eigenvalues_and_normalized_eigenvectors~~CallsGraph proc~compute_real_eigenvalues_and_normalized_eigenvectors eispack_module::compute_real_eigenvalues_and_normalized_eigenvectors proc~compute_eigenvalues_and_eigenvectors eispack_module::compute_eigenvalues_and_eigenvectors proc~compute_real_eigenvalues_and_normalized_eigenvectors->proc~compute_eigenvalues_and_eigenvectors proc~rg eispack_module::rg proc~compute_eigenvalues_and_eigenvectors->proc~rg proc~balanc eispack_module::balanc proc~rg->proc~balanc proc~balbak eispack_module::balbak proc~rg->proc~balbak proc~elmhes eispack_module::elmhes proc~rg->proc~elmhes proc~eltran eispack_module::eltran proc~rg->proc~eltran proc~hqr eispack_module::hqr proc~rg->proc~hqr proc~hqr2 eispack_module::hqr2 proc~rg->proc~hqr2 proc~cdiv eispack_module::cdiv proc~hqr2->proc~cdiv

Source Code

    subroutine compute_real_eigenvalues_and_normalized_eigenvectors(n, a, e, v, n_results, ierr)

    use numbers_module

    implicit none

    integer,intent(in)                              :: n         !! the order of the matrix `a`
    real(wp),dimension(n,n),intent(in)              :: a         !! contains the real general matrix
    real(wp),dimension(:),allocatable,intent(out)   :: e         !! eigenvalues (size `n_results`)
    real(wp),dimension(:,:),allocatable,intent(out) :: v         !! eigenvectors (size `n,n_results`)
    integer,intent(out)                             :: n_results !! number of real eigenvalues
    integer,intent(out)                             :: ierr      !! output flag from [[rg]]

    real(wp),dimension(n,2) :: w  !! real and imaginary parts of the eigenvalues
    real(wp),dimension(n,n) :: z  !! real and imaginary parts of the eigenvectors
    integer :: i !! counter
    integer :: j !! counter

    call compute_eigenvalues_and_eigenvectors(n, a, w, z, ierr)

    if (ierr==0) then

        n_results = count(w(:,2)==0.0_wp)
        if (n_results>0) then
            allocate(e(n_results))
            allocate(v(n,n_results))
            j = 0
            do i = 1, n
                if (w(i,2)==0.0_wp) then ! real eigenvalue
                    j = j + 1
                    e(j) = w(i,1)
                    v(:,j) = z(:,i) / norm2(z(:,i))  ! normalized eigenvector
                end if
            end do
        end if

    else
        n_results = 0
    end if

    end subroutine compute_real_eigenvalues_and_normalized_eigenvectors