Commit 6930359b authored by Luca Naterop's avatar Luca Naterop

add tests

parent 489e9594
......@@ -11,7 +11,7 @@ PROGRAM eval
call parse_cmd_args()
res = GPL([1.1,3.0,1.0])
res = GPL([2,1,3,4])
print*, res
! res = pending_integral(cmplx([1,3]),2,cmplx([2,4]))
......
......@@ -172,14 +172,15 @@ CONTAINS
! case higher depth, s_r at the end, use (62)
if(i == size(g)) then
if(verb >= 30) print*, 's_r at the end, need to shuffle'
if(verb >= 30) print*, 's_r at the end under PI, need to shuffle'
m = find_amount_trailing_zeros(a) + 1
res = remove_sr_from_last_place_in_PI(a(1:size(a)-(m-1)), y2, m, p)
return
end if
! case higher depth, s_r in middle, use my (67)
if(verb >= 30) print*, 's_r in the middle'
if(verb >= 30) print*, 's_r in the middle under PI'
res = -pending_integral(p,1,zeroes(0)) * G_flat([a(1:i-1),cmplx(0.0),a(i+1:size(a))],y2) &
+ pending_integral([p,a(i-1)],i-1,[a(1:i-2),a(i:size(a)),y2]) &
+ pending_integral([p,a(i-1)],1,zeroes(0)) * G_flat(a,y2) &
......
......@@ -35,9 +35,9 @@ CONTAINS
complex(kind=prec) :: res, ref
real(kind=prec) :: delta
delta = abs((res-ref)/ref)
delta = abs(res-ref)
if(delta < tol) then
print*, ' ',' passed with delta = ', delta
print*, ' ',' passed with delta = ', delta
else
print*, ' ',' FAILED with delta = ', delta
tests_successful = .false.
......@@ -90,6 +90,7 @@ CONTAINS
subroutine do_GPL_tests()
complex(kind=prec) :: ref
complex(kind=prec), parameter :: epsilon = 1E-14
real(kind=prec) :: z, xchen
print*, 'doing GPL tests...'
ref = cmplx(0.0819393734128676)
......@@ -110,7 +111,33 @@ CONTAINS
! requires hoelder convolution
ref = cmplx((-0.012709942828250949,0.0))
call test_one_flat(cmplx([0.0, 3.3333333333333335, 1.0, 3.3333333333333335, 1.0]),ref,'2.5')
call test_one_flat(cmplx([0.0, 3.3333333333333335, 1.0, 3.3333333333333335, 1.0]),ref,'2.6')
! here the tests from the mathematica nb start
z = 1./200; xchen = 0.3;
ref = cmplx((-0.0050125418235441935,0.0))
call test_one_flat(cmplx([1./z,1.0]),ref,'3.1')
ref = cmplx((-0.0015011261262671913,0.0))
call test_one_flat(cmplx([1./(xchen*z),1.0]),ref,'3.2')
ref = cmplx((-0.0007502860817810596,0.0))
call test_one_flat(cmplx([(1+sqrt(1-z**2))/(xchen*z),1.0]),ref,'3.3')
ref = cmplx((0.0074335969894765335,0.0))
call test_one_flat(cmplx([-1./xchen,-1./xchen,1.,1.,1.0]),ref,'3.4')
ref = cmplx((-8.403785974849544e-6,0.0))
call test_one_flat(cmplx([-1./xchen,0.,-1./xchen,1./(xchen*z),1.0]),ref,'3.5')
! ref = cmplx((0.4925755847450199,2.6389214054743295))
! call test_one_flat(cmplx([-1.,-1.,z,z,1.]),ref,'3.6')
ref = cmplx((-0.0015317713178859967,-0.00045003911367000565))
call test_one_flat(cmplx([0.,0.,(1-sqrt(1-z**2))/(xchen*z), 1./(xchen*z),1.]),ref,'3.7')
! (1+sqrt(1-z**2))/(xchen*z) -1./xchen
end subroutine do_GPL_tests
......
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