Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
McMule
handyG
Commits
e360aa6a
Commit
e360aa6a
authored
Jul 08, 2019
by
ulrich_y
Browse files
Made code pedantic
parent
b170cc30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
16 deletions
+15
-16
makefile
makefile
+2
-1
src/gpl_module.f90
src/gpl_module.f90
+6
-6
src/maths_functions.f90
src/maths_functions.f90
+1
-2
src/test.f90
src/test.f90
+6
-7
No files found.
makefile
View file @
e360aa6a
...
...
@@ -5,7 +5,8 @@ UNAME_S := $(shell uname -s)
SHA1
=
sha1sum
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
...
...
src/gpl_module.f90
View file @
e360aa6a
...
...
@@ -22,9 +22,9 @@ CONTAINS
zeta
=
values
(
n
-1
)
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
integer
::
m
(:)
,
k
integer
::
m
(:)
complex
(
kind
=
prec
)
::
z
(:),
y
logical
::
GPL_has_convergent_series
...
...
@@ -43,7 +43,7 @@ CONTAINS
! used to compute the value of GPL when all zi are zero
integer
::
l
complex
(
kind
=
prec
)
::
y
,
GPL_zero_zi
GPL_zero_zi
=
1.0
d0
/
factorial
(
l
)
*
log
(
y
)
**
l
GPL_zero_zi
=
1.0
_prec
/
factorial
(
l
)
*
log
(
y
)
**
l
END
FUNCTION
GPL_zero_zi
FUNCTION
is_convergent
(
z
,
y
)
...
...
@@ -69,8 +69,8 @@ CONTAINS
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
complex
(
kind
=
prec
)
::
a
(:),
y2
,
s
(
m
),
p
(:),
res
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
))/))/
&
(
product
((/(
i
,
i
=
1
,
size
(
a
))/))
*
product
((/(
i
,
i
=
1
,
size
(
s
))/))),
&
size
(
a
)
+
size
(
s
))
...
...
@@ -399,7 +399,7 @@ CONTAINS
! assumes zero arguments expressed through the m's
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*, 'm = ', m
...
...
@@ -421,7 +421,7 @@ CONTAINS
end
if
! 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
)
res
=
G_flat
(
z_flat
,
y
)
return
...
...
src/maths_functions.f90
View file @
e360aa6a
...
...
@@ -6,10 +6,9 @@ MODULE maths_functions
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
integer
::
m
integer
,
optional
::
n_passed
complex
(
kind
=
prec
)
::
x
,
res
integer
::
i
,
n
integer
,
allocatable
::
j
(:)
...
...
src/test.f90
View file @
e360aa6a
...
...
@@ -13,13 +13,12 @@ PROGRAM TEST
complex
(
kind
=
prec
)
::
res
real
,
parameter
::
tol
=
1.0e-12
logical
::
tests_successful
=
.true.
integer
::
i
call
parse_cmd_args
()
call
do_MPL_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
...
...
@@ -58,13 +57,13 @@ CONTAINS
complex
(
kind
=
prec
)
::
ref
print
*
,
'doing MPL tests...'
ref
=
d
cmplx
(
0.022696600480693277651633
)
ref
=
cmplx
(
0.022696600480693277651633
)
call
test_one_MPL
((/
1
,
1
/),
cmplx
((/
0.3156498673740053
,
0.3431255827785649
/)),
ref
,
'1.1'
)
ref
=
d
cmplx
(
0.00023134615630308335448329926098409
)
ref
=
cmplx
(
0.00023134615630308335448329926098409
)
call
test_one_MPL
((/
1
,
1
/),
cmplx
((/
0.03
,
0.5012562893380046
/)),
ref
,
'1.2'
)
ref
=
d
cmplx
(
0.000023446106415452030937059124671151
)
ref
=
cmplx
(
0.000023446106415452030937059124671151
)
call
test_one_MPL
((/
2
,
1
,
2
/),
cmplx
((/
0.03
,
0.5012562893380046
,
55.3832
/)),
ref
,
'1.3'
)
end
subroutine
do_MPL_tests
...
...
@@ -94,10 +93,10 @@ CONTAINS
print
*
,
'doing GPL tests...'
ref
=
cmplx
(
0.0819393734128676
)
call
test_one_condensed
((/
1
,
1
/),
cmplx
((/
1.3
d0
,
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
)
call
test_one_condensed
((/
3
,
2
/),
cmplx
((/
1.3
d0
,
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
)
call
test_one_condensed
((/
4
/),
cmplx
((/
0
/)),
cmplx
(
1.6
),
1
,
ref
,
'2.3'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment