mirror of https://gitlab.com/QEF/q-e.git
Add a unit test for LAPACK zdotc.
This commit is contained in:
parent
38720dc682
commit
cae2e0fdca
|
@ -107,4 +107,6 @@ if(QE_ENABLE_TEST)
|
|||
add_unit_test(test_qe_lax-r1-t3 1 3 $<TARGET_FILE:qe_lax_test>)
|
||||
add_unit_test(test_qe_lax-r4-t1 4 1 $<TARGET_FILE:qe_lax_test>)
|
||||
add_unit_test(test_qe_lax-r9-t2 9 2 $<TARGET_FILE:qe_lax_test>)
|
||||
|
||||
add_subdirectory(tests)
|
||||
endif(QE_ENABLE_TEST)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
qe_add_executable(test_qe_lax_lapack_zdotc test_lapack_zdotc.f90)
|
||||
set_target_properties(test_qe_lax_lapack_zdotc
|
||||
PROPERTIES
|
||||
OUTPUT_NAME test_qe_lax_lapack_zdotc.x
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../bin)
|
||||
target_link_libraries(test_qe_lax_lapack_zdotc
|
||||
PRIVATE
|
||||
qe_openmp_fortran
|
||||
qe_mpi_fortran
|
||||
qe_lapack)
|
||||
|
||||
add_unit_test(test_qe_lapack_zdotc 1 1 $<TARGET_FILE:test_qe_lax_lapack_zdotc>)
|
|
@ -0,0 +1,18 @@
|
|||
program test
|
||||
implicit none
|
||||
complex*16 :: a(2), b(2)
|
||||
complex*16 res
|
||||
complex*16, external :: ZDOTC
|
||||
|
||||
a(1) = (-9.6224246089610388d-2, 3.2442340359108593d-3)
|
||||
a(2) = (-0.9037769140058165, 3.2441868631152768d-3)
|
||||
|
||||
b(1) = (-0.9999890875238262, -5.3357405582201908d-7)
|
||||
b(2) = (-0.9999998761616069, 4.3341267956954060d-8)
|
||||
|
||||
res = ZDOTC(2, a, 1, b, 1)
|
||||
if (ABS(res - (1.0000000308637980,6.48839729724212839E-003)) >= 1.d-6) then
|
||||
write(*,*) "zdotc check failed. Expected (1.0000000308637980,6.48839729724212839E-003) but got ", res
|
||||
stop 1
|
||||
endif
|
||||
end program
|
Loading…
Reference in New Issue