Commit dbef90e4 authored by Pavel Kus's avatar Pavel Kus

extending check_correctness

Previously we checked ortonormality of eigenvectors by comparing
the matrix S^T * S to identity matrix. The new feature is also
checking just the diagonal of the matrix S^T * S. By that we get
the information, how far are the eigenvectors from having length 1.
If it turns out to be important, we could try to normalize them
at the end of elpa, which is simple (in contrast with enforcing
better orthogonality).
parent 07169f0e
......@@ -46,6 +46,7 @@
#undef CONST_REAL_0_0
#undef CONST_0_5
#undef CONST_1_0
#undef CONST_REAL_1_0
#undef CONST_2_0
#undef CONST_8_0
#undef MPI_REAL_PRECISION
......@@ -102,6 +103,7 @@
#define CONST_REAL_0_0 0.0_rk8
#define CONST_0_5 0.5_rk8
#define CONST_1_0 1.0_rk8
#define CONST_REAL_1_0 1.0_rk8
#define CONST_2_0 2.0_rk8
#define CONST_8_0 8.0_rk8
#define MPI_REAL_PRECISION MPI_REAL8
......@@ -157,6 +159,7 @@
#define CONST_REAL_0_0 0.0_rk4
#define CONST_0_5 0.5_rk4
#define CONST_1_0 1.0_rk4
#define CONST_REAL_1_0 1.0_rk4
#define CONST_2_0 2.0_rk4
#define CONST_8_0 8.0_rk4
#define MPI_REAL_PRECISION MPI_REAL4
......
......@@ -323,7 +323,7 @@ program test_complex2
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -315,7 +315,7 @@ program test_real2
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -323,7 +323,7 @@ program test_complex2
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -314,7 +314,7 @@ program test_real2
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -271,7 +271,7 @@ program test_complex_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_cholesky
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -270,7 +270,7 @@ program test_complex_gpu_version_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_invert_trm
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -264,7 +264,7 @@ program test_real_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_cholesky
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -264,7 +264,7 @@ program test_real_gpu_version_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_invert_trm
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -270,7 +270,7 @@ program test_complex_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_cholesky
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -270,7 +270,7 @@ program test_complex_gpu_version_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_invert_trm
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -263,7 +263,7 @@ program test_real_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_cholesky
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -264,7 +264,7 @@ program test_real_gpu_version_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -46,7 +46,7 @@
program test_invert_trm
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......
......@@ -55,7 +55,7 @@ program test_solve_tridi_single
!
!-------------------------------------------------------------------------------
use elpa1
use elpa_utilities
use elpa_utilities, only : error_unit
use test_util
use test_read_input_parameters
......@@ -326,7 +326,7 @@ program test_solve_tridi_single
endif
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, a, ev, sc_desc, myid)
status = check_correctness(na, nev, as, a, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -55,7 +55,6 @@ program test_solve_tridi
!
!-------------------------------------------------------------------------------
use elpa1
use elpa_utilities
use test_util
use test_read_input_parameters
......@@ -328,7 +327,7 @@ program test_solve_tridi
endif
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, a, ev, sc_desc, myid)
status = check_correctness(na, nev, as, a, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
......
......@@ -253,7 +253,7 @@ program test_complex2_double_banded
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -193,14 +193,14 @@ program test_interface
call elpa_deallocate(e2)
call elpa_uninit()
status = check_correctness(na, nev, as1, z1, ev1, sc_desc, myid)
status = check_correctness(na, nev, as1, z1, ev1, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a1)
deallocate(as1)
deallocate(z1)
deallocate(ev1)
status = check_correctness(na, nev, as2, z2, ev2, sc_desc, myid)
status = check_correctness(na, nev, as2, z2, ev2, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a2)
deallocate(as2)
......
......@@ -265,7 +265,7 @@ program test_complex2_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -397,7 +397,7 @@ program test_complex2_choose_kernel_with_api_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -293,7 +293,7 @@ program test_complex2_default_kernel_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -292,7 +292,7 @@ program test_complex2_gpu_version_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -270,7 +270,7 @@ program test_real2_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -432,7 +432,7 @@ program test_real2_choose_kernel_with_api_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -290,7 +290,7 @@ program test_real2_default_kernel_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -291,7 +291,7 @@ program test_real2_gpu_version_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -334,7 +334,7 @@ program test_real2_default_kernel_qr_decomposition_double_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
ret = check_correctness(na, nev, as, z, ev, sc_desc, myid)
ret = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -264,7 +264,7 @@ program test_complex2_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -397,7 +397,7 @@ program test_complex2_choose_kernel_with_api_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -290,7 +290,7 @@ program test_complex2_default_kernel_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -289,7 +289,7 @@ program test_complex2_gpu_version_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -269,7 +269,7 @@ program test_real2_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -428,7 +428,7 @@ program test_real2_choose_kernel_with_api_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -289,7 +289,7 @@ program test_real2_default_kernel_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -292,7 +292,7 @@ program test_real2_gpu_version_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -338,7 +338,7 @@ program test_real2_default_kernel_qr_decomposition_single_precision
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
ret = check_correctness(na, nev, as, z, ev, sc_desc, myid)
ret = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -249,7 +249,9 @@ program test_real2_double_banded
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -252,7 +252,7 @@ program test_complex2_single_banded
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -248,8 +248,7 @@ program test_real2_single_banded
!-------------------------------------------------------------------------------
! Test correctness of result (using plain scalapack routines)
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
deallocate(a)
deallocate(as)
......
......@@ -350,7 +350,7 @@ 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, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows,np_cols, my_prow, my_pcol)
#endif
if (status /= 0) then
if (myid == 0) print *, "Result incorrect!"
......@@ -368,7 +368,7 @@ program test
endif
#ifdef __SOLVE_TRIDIAGONAL
! check eigenvectors
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol)
if (status /= 0) then
if (myid == 0) print *, "Result incorrect!"
call exit(status)
......
......@@ -104,5 +104,7 @@ module test_check_correctness
#endif /* WANT_SINGLE_PRECISION_REAL */
#include "../../src/general/prow_pcol.X90"
#include "../../src/general/map_global_to_local.X90"
end module
......@@ -45,10 +45,10 @@
&MATH_DATATYPE&
&_&
&PRECISION&
& (na, nev, as, z, ev, sc_desc, myid) result(status)
& (na, nev, as, z, ev, sc_desc, nblk, myid, np_rows, np_cols, my_prow, my_pcol) result(status)
implicit none
integer(kind=ik) :: status