Commit d97f8400 authored by Andreas Marek's avatar Andreas Marek

Adapt test cases for zero eigenvectors

parent f2157961
......@@ -182,13 +182,15 @@ function elpa_solve_evp_&
if(my_prow==0 .and. my_pcol==0 .and. elpa_print_times) write(error_unit,*) 'Time solve_tridi :',time_evp_solve
time_evp_back = e%get_time("elpa_solve_evp_&
&MATH_DATATYPE&
&_1stage_&
&PRECISION&
&","back")
if(my_prow==0 .and. my_pcol==0 .and. elpa_print_times) write(error_unit,*) 'Time trans_ev_real:',time_evp_back
if (nev .ge. 1) then
time_evp_back = e%get_time("elpa_solve_evp_&
&MATH_DATATYPE&
&_1stage_&
&PRECISION&
&","back")
if(my_prow==0 .and. my_pcol==0 .and. elpa_print_times) write(error_unit,*) 'Time trans_ev_real:',time_evp_back
endif
if (successInternal .ne. ELPA_OK) then
print *, "Cannot solve with ELPA 1stage"
......
......@@ -136,7 +136,7 @@ program test
MATRIX_TYPE, allocatable :: z(:,:)
! eigenvalues
EV_TYPE, allocatable :: ev(:)
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL)
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL) || defined(TEST_EIGENVECTORS)
EV_TYPE, allocatable :: d(:), sd(:), ev_analytic(:), ds(:), sds(:)
EV_TYPE :: diagonalELement, subdiagonalElement
#endif
......@@ -215,7 +215,7 @@ program test
allocate(z (na_rows,na_cols))
allocate(ev(na))
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL)
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL) || defined(TEST_EIGENVECTORS)
allocate(d (na), ds(na))
allocate(sd (na), sds(na))
allocate(ev_analytic(na))
......@@ -228,9 +228,23 @@ program test
#ifdef TEST_EIGENVECTORS
#ifdef TEST_MATRIX_ANALYTIC
call prepare_matrix_analytic(na, a, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
as(:,:) = a
as(:,:) = a
#else
if (nev .ge. 1) then
call prepare_matrix(na, myid, sc_desc, a, z, as)
else
! zero eigenvectors and not analytic test => toeplitz matrix
#ifdef TEST_SINGLE
diagonalElement = 0.45_c_float
subdiagonalElement = 0.78_c_float
#else
call prepare_matrix(na, myid, sc_desc, a, z, as)
diagonalElement = 0.45_c_double
subdiagonalElement = 0.78_c_double
#endif
call prepare_toeplitz_matrix(na, diagonalElement, subdiagonalElement, &
d, sd, ds, sds, a, as, nblk, np_rows, &
np_cols, my_prow, my_pcol)
endif
#endif
#endif
......@@ -246,7 +260,7 @@ program test
call prepare_toeplitz_matrix(na, diagonalElement, subdiagonalElement, &
d, sd, ds, sds, a, as, nblk, np_rows, &
np_cols, my_prow, my_pcol)
#endif
#endif /* EIGENVALUES OR TRIDIAGONAL */
e => elpa_allocate()
......@@ -360,7 +374,13 @@ program test
#ifdef TEST_MATRIX_ANALYTIC
status = check_correctness_analytic(na, nev, ev, z, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
#else
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows,np_cols, my_prow, my_pcol)
if (nev .ge. 1) then
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows,np_cols, my_prow, my_pcol)
else
! zero eigenvectors and no analytic test => toeplitz
status = check_correctness_eigenvalues_toeplitz(na, diagonalElement, &
subdiagonalElement, ev, z, myid)
endif
#endif
call check_status(status, myid)
#endif
......@@ -383,7 +403,7 @@ program test
#ifdef TEST_ALL_KERNELS
a(:,:) = as(:,:)
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL)
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL) || defined(TEST_EIGENVECTORS)
d = ds
sd = sds
#endif
......@@ -397,7 +417,7 @@ program test
deallocate(z)
deallocate(ev)
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL)
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL) || defined(TEST_EIGENVECTORS)
deallocate(d, ds)
deallocate(sd, sds)
deallocate(ev_analytic)
......
......@@ -145,8 +145,13 @@ module test_analytic
if(myid == 0) print *, 'Maximum error in eigenvalues :', max_ev_diff
if(myid == 0) print *, 'Maximum error in eigenvectors :', glob_max_z_diff
status = 0
if (max_ev_diff .gt. 5e-14_rk8 .or. max_ev_diff .eq. ZERO) status = 1
if (glob_max_z_diff .gt. 6e-11_rk8 .or. glob_max_z_diff .eq. ZERO) status = 1
if (nev .gt. 2) then
if (max_ev_diff .gt. 5e-14_rk8 .or. max_ev_diff .eq. ZERO) status = 1
if (glob_max_z_diff .gt. 6e-11_rk8 .or. glob_max_z_diff .eq. ZERO) status = 1
else
if (max_ev_diff .gt. 5e-14_rk8) status = 1
if (glob_max_z_diff .gt. 6e-11_rk8) status = 1
endif
end function
function decompose(num, decomposition) result(possible)
......
......@@ -197,22 +197,43 @@
if (myid==0) print *,'Error Residual :',errmax
#if REALCASE == 1
if (nev .ge. 2) then
#ifdef DOUBLE_PRECISION_REAL
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
#else
if (errmax .gt. 3e-3_rk4 .or. errmax .eq. 0.0_rk4) then
if (errmax .gt. 3e-3_rk4 .or. errmax .eq. 0.0_rk4) then
#endif
status = 1
endif
else
#ifdef DOUBLE_PRECISION_REAL
if (errmax .gt. 5e-12_rk8) then
#else
if (errmax .gt. 3e-3_rk4) then
#endif
status = 1
endif
endif
#endif
#if COMPLEXCASE == 1
if (nev .gt. 2) then
#ifdef DOUBLE_PRECISION_COMPLEX
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
#else
if (errmax .gt. 3e-3_rk4 .or. errmax .eq. 0.0_rk4) then
if (errmax .gt. 3e-3_rk4 .or. errmax .eq. 0.0_rk4) then
#endif
status =1
endif
else
#ifdef DOUBLE_PRECISION_COMPLEX
if (errmax .gt. 5e-12_rk8) then
#else
if (errmax .gt. 3e-3_rk4) then
#endif
status = 1
status = 1
endif
endif
#endif
! 2. Eigenvector orthogonality
......@@ -224,7 +245,6 @@
#else /* WITH_MPI */
call PRECISION_GEMM(BLAS_TRANS_OR_CONJ,'N',nev,nev,na,ONE,z,na,z,na,ZERO,tmp1,na)
#endif /* WITH_MPI */
!TODO for the C interface, not all information is passed (zeros instead)
!TODO than this part of the test cannot be done
!TODO either we will not have this part of test at all, or it will be improved
......@@ -266,22 +286,44 @@
if (myid==0) print *,'Error Orthogonality:',errmax
#if REALCASE == 1
if (nev .ge. 2) then
#ifdef DOUBLE_PRECISION_REAL
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
#else
if (errmax .gt. 9e-4_rk4 .or. errmax .eq. 0.0_rk4) then
if (errmax .gt. 9e-4_rk4 .or. errmax .eq. 0.0_rk4) then
#endif
status = 1
endif
else
#ifdef DOUBLE_PRECISION_REAL
if (errmax .gt. 5e-12_rk8) then
#else
if (errmax .gt. 9e-4_rk4) then
#endif
status = 1
endif
endif
#endif
#if COMPLEXCASE == 1
if (nev .ge. 2) then
#ifdef DOUBLE_PRECISION_COMPLEX
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
#else
if (errmax .gt. 9e-4_rk4 .or. errmax .eq. 0.0_rk4) then
#endif
status = 1
endif
else
#ifdef DOUBLE_PRECISION_COMPLEX
if (errmax .gt. 5e-12_rk8 .or. errmax .eq. 0.0_rk8) then
if (errmax .gt. 5e-12_rk8) then
#else
if (errmax .gt. 9e-4_rk4 .or. errmax .eq. 0.0_rk4) then
if (errmax .gt. 9e-4_rk4) then
#endif
status = 1
endif
endif
#endif
status = 1
endif
end function
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment