From f91f198f57ec5d20387e3ef7c75e41b530e8f0d3 Mon Sep 17 00:00:00 2001 From: Luca Naterop Date: Thu, 4 Apr 2019 23:40:28 +0200 Subject: [PATCH] relate GPL to MPL --- gpl_module.f90 | 38 ++++++++++++++++++++++++++++++++------ test.f90 | 14 ++++++-------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/gpl_module.f90 b/gpl_module.f90 index d979e53..8eca5bb 100644 --- a/gpl_module.f90 +++ b/gpl_module.f90 @@ -1,4 +1,4 @@ - + MODULE gpl_module use mpl_module @@ -6,12 +6,38 @@ MODULE gpl_module CONTAINS - FUNCTION GPL() - ! integer :: m(:) - ! complex(kind=prec) :: y(:) - complex(kind=prec) GPL + FUNCTION GPL(m,z,y,k) + ! computes the generalized polylogarithm G_{m1,..mk} (z1,...zk; y) + + integer :: m(:), k, i + complex(kind=prec) :: z(:), x(k), y, GPL + + ! print*, 'GPL called with arguments:' + ! print*, 'm=',m + ! print*, 'z=',z + ! print*, 'y=',y + + do i = 1,k + x(i) = merge(y/z(1), z(i-1)/z(i),i == 1) + end do + + GPL = (-1)**k * MPL(m,x) - print*, 'hello, GPL' END FUNCTION GPL END MODULE gpl_module + +! PROGRAM test +! ! used to test this module +! use gpl_module + +! integer :: m(2) = (/ 1,1 /) +! complex(kind=prec) :: z(2) = dcmplx((/ 1.3d0, 1.1d0 /)) +! complex(kind=prec) :: y = 0.4 +! complex(kind=prec) :: res + +! res = GPL(m,z,y,2) +! print*, 'res=',res + +! END PROGRAM test + diff --git a/test.f90 b/test.f90 index 6efe95e..860ac3d 100644 --- a/test.f90 +++ b/test.f90 @@ -12,8 +12,6 @@ PROGRAM TEST call do_MPL_tests() - res = GPL() - CONTAINS subroutine do_MPL_tests() @@ -25,18 +23,18 @@ CONTAINS print*, 'doing multiple polylog tests...' m2 = (/ 1,1 /) - x2 = cmplx((/ 0.3156498673740053, 0.3431255827785649 /)) - ref = cmplx(0.022696600480693277651633) + x2 = dcmplx((/ 0.3156498673740053, 0.3431255827785649 /)) + ref = dcmplx(0.022696600480693277651633) call check_MPL(m2,x2,ref) m2 = (/ 1,1 /) - x2 = cmplx((/ 0.03, 0.5012562893380046 /)) - ref = cmplx(0.00023134615630308335448329926098409) + x2 = dcmplx((/ 0.03, 0.5012562893380046 /)) + ref = dcmplx(0.00023134615630308335448329926098409) call check_MPL(m2,x2,ref) m3 = (/ 2,1,2 /) - x3 = cmplx((/ 0.03, 0.5012562893380046, 55.3832 /)) - ref = cmplx(0.000023446106415452030937059124671151) + x3 = dcmplx((/ 0.03, 0.5012562893380046, 55.3832 /)) + ref = dcmplx(0.000023446106415452030937059124671151) call check_MPL(m3,x3,ref) end subroutine do_MPL_tests -- GitLab