1! { dg-options "-floop-nest-optimize -O2" }
2
3MODULE dbcsr_geev
4  INTEGER, PARAMETER :: real_8=8
5CONTAINS
6  SUBROUTINE dbcsr_dgeev(jobvl,jobvr,matrix,ndim,evals,revec,levec)
7    CHARACTER(1)                             :: jobvl, jobvr
8    REAL(real_8), DIMENSION(:, :)            :: matrix
9    INTEGER                                  :: ndim
10    COMPLEX(real_8), DIMENSION(:)            :: evals
11    COMPLEX(real_8), DIMENSION(:, :)         :: revec, levec
12    INTEGER                                  :: i, info, lwork
13    REAL(real_8)                             :: norm, tmp_array(ndim,ndim), &
14                                                work(20*ndim)
15    REAL(real_8), DIMENSION(ndim)            :: eval1, eval2
16    REAL(real_8), DIMENSION(ndim, ndim)      :: evec_l, evec_r
17    DO WHILE (i.le.ndim)
18      IF(ABS(eval2(i)).LT.EPSILON(REAL(0.0,real_8)))THEN
19        norm=SQRT(SUM(evec_r(:,i)**2.0_real_8)+SUM(evec_r(:,i+1)**2.0_real_8))
20        revec(:,i)=CMPLX(evec_r(:,i),evec_r(:,i+1),real_8)/norm
21      END IF
22    END DO
23  END SUBROUTINE  dbcsr_dgeev
24END MODULE dbcsr_geev
25