From 412ce6998cf6e8a3ad5c78096c8cf5f4c6fb512d Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 6 May 2019 16:33:43 +0200 Subject: [PATCH] test convergence in flat notation --- gpl_module.f90 | 15 ++++++++++++++- test.f90 | 15 ++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gpl_module.f90 b/gpl_module.f90 index efecef2..32ec040 100644 --- a/gpl_module.f90 +++ b/gpl_module.f90 @@ -46,6 +46,20 @@ CONTAINS GPL_zero_zi = 1.0d0/factorial(l) * log(y) ** l END FUNCTION GPL_zero_zi + FUNCTION is_convergent(z,y) + ! returns true if G(z,y) convergent, otherwise false + complex(kind=prec) :: z(:), y + logical :: is_convergent + integer :: i + + is_convergent = .true. + do i = 1,size(z) + if(abs(z(i)) < zero) cycle ! skip zero values + if(abs(y) > abs(z(i))) is_convergent = .false. + end do + + END FUNCTION is_convergent + RECURSIVE FUNCTION G_flat(z_flat,y) result(res) ! Calls G function with flat arguments, that is, zeroes not passed through the m's. complex(kind=prec) :: z_flat(:), y, res @@ -87,7 +101,6 @@ CONTAINS allocate(z(condensed_size)) m = m_prime(1:condensed_size) z = get_condensed_z(m,z_flat) - res = G_condensed(m,z,y,size(m)) deallocate(m) deallocate(z) diff --git a/test.f90 b/test.f90 index a1f9eb4..ec73321 100644 --- a/test.f90 +++ b/test.f90 @@ -76,19 +76,16 @@ CONTAINS complex(kind=prec), parameter :: epsilon = 1E-14 print*, 'doing GPL tests...' - ! ref = dcmplx(0.0819393734128676) - ! call test_one_GPL((/ 1,1 /),cmplx((/ 1.3d0, 1.1d0 /)),cmplx(0.4),2,ref,'2.1') + ref = dcmplx(0.0819393734128676) + call test_one_GPL((/ 1,1 /),cmplx((/ 1.3d0, 1.1d0 /)),cmplx(0.4),2,ref,'2.1') - ! ref = dcmplx(0.01592795952537145) - ! call test_one_GPL((/ 3,2 /),cmplx((/ 1.3d0, 1.1d0 /)),cmplx(0.4),2,ref,'2.2') - - ! ref = dcmplx(0.0020332632172573974) - ! call test_one_GPL((/ 4 /),cmplx((/ 0 /)),cmplx(1.6),1,ref,'2.3') + ref = dcmplx(0.01592795952537145) + call test_one_GPL((/ 3,2 /),cmplx((/ 1.3d0, 1.1d0 /)),cmplx(0.4),2,ref,'2.2') ref = dcmplx(0.0020332632172573974) - ref = G_flat(cmplx((/1.7,0.0,0.0/)),cmplx(1.1)) - ! call test_one_GPL((/1,1,1/),cmplx((/ 0.0,1.7,0.0 /)),cmplx(1.1),3,ref,'2.4') + call test_one_GPL((/ 4 /),cmplx((/ 0 /)),cmplx(1.6),1,ref,'2.3') + ! call test_one_GPL((/1,1,1/),cmplx((/ 0.0,1.7,0.0 /)),cmplx(1.1),3,ref,'2.4') end subroutine do_GPL_tests END PROGRAM TEST -- GitLab