Page 1 of 1

dsyevr bug

PostPosted: Tue Aug 04, 2015 6:48 pm
by osirpt
Call dsyevr to diagonalize the matrix
[[4.0233725957917259288124166e-07, 1.1475559753759016807209544e-22, 3.1797364433177036979501603e-68],
[1.1475559753759016807209544e-22, 4.0233725957917259288124166e-07, -7.5079600860804907344589960e-56],
[3.1797364433177036979501603e-68, -7.5079600860804907344589960e-56, 4.3213250161962713132013381e-05]])
with
JOBZ = 'V'
RANGE ='A'
UPLO = 'L'
LDA = 3
VL = 0.0
VU = 1.0
IL = 0
IU = 0
ABSTOL = 0.0
LDZ = 3
LWORK = 1000
LIWORK = 1000
INFO = 0

returns INFO = 1

There's no problem to call dsyev to diagonalize this matrix. The eigenvalues are the same to the dsyevr.

Re: dsyevr bug

PostPosted: Thu Aug 13, 2015 9:13 am
by admin
Out team looked at your issue
We cannot reproduce the bug with the attached files (driver and data), using gfortran and ifort. The eigenvalues computed by dsyev, dsyevx and dsyevr match (the same in octave). Are we missing something?

dsyev, w =
4.023372595791725E-07
4.023372595791727E-07
4.321325016196271E-05
dsyevx, w =
4.023372595791725E-07
4.023372595791727E-07
4.321325016196271E-05
dsyevr, w =
4.023372595791725E-07
4.023372595791727E-07
4.321325016196271E-05

Code: Select all
!***********************************************************************!
! The program can be compiled as follows:                               !
!    gfortran -o test.x test.f90 $lapack_gfortran $blas_gfortran        !
! or                                                                    !
!    ifort -o test.x test.f90 $lapack_ifort $blas_ifort                 !
! or                                                                    !
!    sunf90 -ftrap=%none -o test.x test.f90 $lapack_sunf90 $blas_sunf90 !
!***********************************************************************!
program test

    implicit none
    integer, parameter :: n = 3
    double precision :: a(N,N), tmpa(N,N)
    integer :: i, j, m
    integer :: info
    integer, parameter :: lwork = 26*n, liwork = 10*n
    integer :: iwork(liwork)
    double precision :: work(lwork), w(N), z(N,N)
    integer :: isuppz(2*N)
    double precision :: tmp(N), tmp2(N), tmp3(N), err
    double precision :: abstol = 0d0

    do i=1,N
        read(*,*) a(i,:)
    end do

    w = 0
    tmpa = a
    call dsyev('V', 'L', N, tmpa, N, w, work, lwork, info)
    if (info .ne. 0) then
       write(*,'(a,i3)') 'dsyev: info = ', info
    end if
    write(*,'(a)') 'dsyev,  w ='
    write(*,'(1p,e24.15)') w(:)

    w = 0
    z = 0
    tmpa = a
    call dsyevx('V', 'A', 'L', N, tmpa, N, 0d0, 0d0, 0, 0, &
               abstol, m, w, z, N, work, lwork, &
               iwork(1), iwork(1+5*N), info)
    if (info .ne. 0) then
       write(*,'(a,i3)') 'dsyevx: info = ', info
    end if
    write(*,'(a)') 'dsyevx, w ='
    write(*,'(1p,e24.15)') w(:)

    w = 0
    z = 0
    tmpa = a
    call dsyevr('V', 'A', 'L', N, tmpa, N, 0d0, 0d0, 0, 0, &
                abstol, m, w, z, N, isuppz, work, lwork, &
                iwork, liwork, info)
    if (info .ne. 0) then
       write(*,'(a,i3)') 'dsyevr: info = ', info
    end if
    write(*,'(a)') 'dsyevr, w ='
    write(*,'(1p,e24.15)') w(:)

end program test


Code: Select all
  4.0233725957917259288124166e-07  1.1475559753759016807209544e-22  3.1797364433177036979501603e-68
  1.1475559753759016807209544e-22  4.0233725957917259288124166e-07 -7.5079600860804907344589960e-56
  3.1797364433177036979501603e-68 -7.5079600860804907344589960e-56  4.3213250161962713132013381e-05

Re: dsyevr bug

PostPosted: Fri Sep 25, 2015 11:03 am
by osni
The test code does get info=1 from dsyevr when linked to LAPACK 3.2.1. The problem goes away with LAPACK 3.5.0. The user has upgraded his installation of LAPACK and reports that the problem has been solved.