Commit e360aa6a authored by ulrich_y's avatar ulrich_y
Browse files

Made code pedantic

parent b170cc30
...@@ -5,7 +5,8 @@ UNAME_S := $(shell uname -s) ...@@ -5,7 +5,8 @@ UNAME_S := $(shell uname -s)
SHA1=sha1sum SHA1=sha1sum
FC=gfortran FC=gfortran
FFLAGS=-fdefault-real-8 -cpp FFLAGS=-fdefault-real-8 -cpp -g -pedantic-errors -Werror -std=f2008 \
-Wall -Wno-maybe-uninitialized -Wno-uninitialized -O3 -fcheck=all
LD=gfortran LD=gfortran
......
...@@ -22,9 +22,9 @@ CONTAINS ...@@ -22,9 +22,9 @@ CONTAINS
zeta = values(n-1) zeta = values(n-1)
END FUNCTION zeta END FUNCTION zeta
FUNCTION GPL_has_convergent_series(m,z,y,k) FUNCTION GPL_has_convergent_series(m,z,y)
! tests if GPL has a convergent series representation ! tests if GPL has a convergent series representation
integer :: m(:), k integer :: m(:)
complex(kind=prec) :: z(:), y complex(kind=prec) :: z(:), y
logical :: GPL_has_convergent_series logical :: GPL_has_convergent_series
...@@ -43,7 +43,7 @@ CONTAINS ...@@ -43,7 +43,7 @@ CONTAINS
! used to compute the value of GPL when all zi are zero ! used to compute the value of GPL when all zi are zero
integer :: l integer :: l
complex(kind=prec) :: y, GPL_zero_zi complex(kind=prec) :: y, GPL_zero_zi
GPL_zero_zi = 1.0d0/factorial(l) * log(y) ** l GPL_zero_zi = 1.0_prec/factorial(l) * log(y) ** l
END FUNCTION GPL_zero_zi END FUNCTION GPL_zero_zi
FUNCTION is_convergent(z,y) FUNCTION is_convergent(z,y)
...@@ -69,8 +69,8 @@ CONTAINS ...@@ -69,8 +69,8 @@ CONTAINS
FUNCTION remove_sr_from_last_place_in_PI(a,y2,m,p) result(res) FUNCTION remove_sr_from_last_place_in_PI(a,y2,m,p) result(res)
! here what is passed is not the full a vector, only a1, ..., ak without the trailing zeroes ! here what is passed is not the full a vector, only a1, ..., ak without the trailing zeroes
complex(kind=prec) :: a(:), y2, s(m), p(:), res
integer :: m, i, j, n integer :: m, i, j, n
complex(kind=prec) :: a(:), y2, s(m), p(:), res
complex(kind=prec) :: alpha(product((/(i,i=1,size(a)+size(s))/))/ & complex(kind=prec) :: alpha(product((/(i,i=1,size(a)+size(s))/))/ &
(product((/(i,i=1,size(a))/))*product((/(i,i=1,size(s))/))), & (product((/(i,i=1,size(a))/))*product((/(i,i=1,size(s))/))), &
size(a) + size(s)) size(a) + size(s))
...@@ -399,7 +399,7 @@ CONTAINS ...@@ -399,7 +399,7 @@ CONTAINS
! assumes zero arguments expressed through the m's ! assumes zero arguments expressed through the m's
integer :: m(:), k, i integer :: m(:), k, i
complex(kind=prec) :: z(:), x(k), y, res, c(sum(m)+1,sum(m)+1), z_flat(sum(m)), a(sum(m)-1) complex(kind=prec) :: z(:), x(k), y, res, z_flat(sum(m))
! print*, 'called G_condensed with args' ! print*, 'called G_condensed with args'
! print*, 'm = ', m ! print*, 'm = ', m
...@@ -421,7 +421,7 @@ CONTAINS ...@@ -421,7 +421,7 @@ CONTAINS
end if end if
! need make convergent? ! need make convergent?
if(.not. GPL_has_convergent_series(m,z,y,k)) then if(.not. GPL_has_convergent_series(m,z,y)) then
z_flat = get_flattened_z(m,z) z_flat = get_flattened_z(m,z)
res = G_flat(z_flat,y) res = G_flat(z_flat,y)
return return
......
...@@ -6,10 +6,9 @@ MODULE maths_functions ...@@ -6,10 +6,9 @@ MODULE maths_functions
CONTAINS CONTAINS
FUNCTION naive_polylog(m,x,n_passed) result(res) FUNCTION naive_polylog(m,x) result(res)
! Computes the classical polylogarithm Li_m(x) using series representation up to order n ! Computes the classical polylogarithm Li_m(x) using series representation up to order n
integer :: m integer :: m
integer, optional :: n_passed
complex(kind=prec) :: x, res complex(kind=prec) :: x, res
integer :: i,n integer :: i,n
integer, allocatable :: j(:) integer, allocatable :: j(:)
......
...@@ -13,13 +13,12 @@ PROGRAM TEST ...@@ -13,13 +13,12 @@ PROGRAM TEST
complex(kind=prec) :: res complex(kind=prec) :: res
real, parameter :: tol = 1.0e-12 real, parameter :: tol = 1.0e-12
logical :: tests_successful = .true. logical :: tests_successful = .true.
integer :: i
call parse_cmd_args() call parse_cmd_args()
call do_MPL_tests() call do_MPL_tests()
call do_GPL_tests() call do_GPL_tests()
! call do_shuffle_tests() ! put this somewhere else call do_shuffle_tests() ! put this somewhere else
if(tests_successful) then if(tests_successful) then
...@@ -58,13 +57,13 @@ CONTAINS ...@@ -58,13 +57,13 @@ CONTAINS
complex(kind=prec) :: ref complex(kind=prec) :: ref
print*, 'doing MPL tests...' print*, 'doing MPL tests...'
ref = dcmplx(0.022696600480693277651633) ref = cmplx(0.022696600480693277651633)
call test_one_MPL((/ 1,1 /),cmplx((/ 0.3156498673740053, 0.3431255827785649 /)),ref, '1.1') call test_one_MPL((/ 1,1 /),cmplx((/ 0.3156498673740053, 0.3431255827785649 /)),ref, '1.1')
ref = dcmplx(0.00023134615630308335448329926098409) ref = cmplx(0.00023134615630308335448329926098409)
call test_one_MPL((/ 1,1 /),cmplx((/ 0.03, 0.5012562893380046 /)),ref, '1.2') call test_one_MPL((/ 1,1 /),cmplx((/ 0.03, 0.5012562893380046 /)),ref, '1.2')
ref = dcmplx(0.000023446106415452030937059124671151) ref = cmplx(0.000023446106415452030937059124671151)
call test_one_MPL((/ 2,1,2 /),cmplx((/ 0.03, 0.5012562893380046, 55.3832 /)),ref, '1.3') call test_one_MPL((/ 2,1,2 /),cmplx((/ 0.03, 0.5012562893380046, 55.3832 /)),ref, '1.3')
end subroutine do_MPL_tests end subroutine do_MPL_tests
...@@ -94,10 +93,10 @@ CONTAINS ...@@ -94,10 +93,10 @@ CONTAINS
print*, 'doing GPL tests...' print*, 'doing GPL tests...'
ref = cmplx(0.0819393734128676) ref = cmplx(0.0819393734128676)
call test_one_condensed((/ 1,1 /),cmplx((/ 1.3d0, 1.1d0 /)),cmplx(0.4),2,ref,'2.1') call test_one_condensed((/ 1,1 /),cmplx((/ 1.3_prec, 1.1_prec /)),cmplx(0.4),2,ref,'2.1')
ref = cmplx(0.01592795952537145) ref = cmplx(0.01592795952537145)
call test_one_condensed((/ 3,2 /),cmplx((/ 1.3d0, 1.1d0 /)),cmplx(0.4),2,ref,'2.2') call test_one_condensed((/ 3,2 /),cmplx((/ 1.3_prec, 1.1_prec /)),cmplx(0.4),2,ref,'2.2')
ref = cmplx(0.0020332632172573974) ref = cmplx(0.0020332632172573974)
call test_one_condensed((/ 4 /),cmplx((/ 0 /)),cmplx(1.6),1,ref,'2.3') call test_one_condensed((/ 4 /),cmplx((/ 0 /)),cmplx(1.6),1,ref,'2.3')
......
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