Commit 78131cc6 authored by ulrich_y's avatar ulrich_y

Merge branch 'dev-fix-quad' into dev-improve-polylog

parents c443d6ff e4c7ef66
......@@ -14,6 +14,11 @@ cache:
paths:
- makefile
- build/
- checks/test-chen.f90
- checks/test-chenff.f90
- checks/test-muone.f90
- checks/test-muoneNP.f90
key: ${CI_COMMIT_REF_SLUG}
stages:
- configure
......
......@@ -2,11 +2,13 @@ module chenreftest
contains
function test(z,ref,test_id)
use globals, only: prec
use maths_functions, only: clearcache
use ttools
implicit none
complex(kind=prec) :: z(:), ref
character(len=*) :: test_id
logical test
call clearcache
call test_one_flat(z,ref,test_id, test)
end function
......
......@@ -39,6 +39,7 @@ PROGRAM TEST
call do_GPL_tests
case('-chen-test')
tol = 8.0e-7
call set_options(mpldel=1e-10_prec, lidel=1e-10_prec)
tests_successful = tests_successful .and. do_chen_test()
#if defined(HAVE_GINAC) && defined(HAVE_MM)
......@@ -538,12 +539,13 @@ CONTAINS
ref = (0.0135493735561310633082925053080300174678_prec,+0.01851696361979639851211857931403696163_prec)
call test_one_flat( (/ (0._prec,0.), (0._prec,0.), (1.0_prec,0._prec), (0.1_prec,-0.1_prec), (0.15_prec,0._prec) /) , ref, 'F.17')
ref = (-2.41176903997917647290181947143140323970805e-4_prec,0.00129690184788114442363777169655122)
ref = (-2.41176903997917647290181947143140323970805e-4_prec,0.00129690184788114442363777169655122_prec)
call test_one_flat( (/ (0._prec,0.), (1._prec,0.), (0.5_prec,-0.1_prec), (-1.3_prec,10.2_prec), (0.4_prec,0._prec) /) , ref, 'F.18')
ref = (-0.003113755848404291707649322614093090379815_prec,-4.6914973893242872720303973859400498154E-4_prec)
call test_one_flat( (/ (0._prec,0.), (1._prec,0.), (0.1_prec,-0.1_prec), (-1.3_prec,10.2_prec), (0.4_prec,0._prec) /) , ref, 'F.19')
call clearcache
ref = (0.6492441149301267712849185177612894261440132_prec,2.76692869057070821067245201199781913943_prec)
call iprint(' testing GPL G.1 ...',-1)
......@@ -835,11 +837,11 @@ CONTAINS
#endif
implicit none
integer,parameter :: nzero = 10
integer,parameter :: nieps = 30
integer,parameter :: ncmpl = 30
integer,parameter :: nieps = 50
integer,parameter :: ncmpl = 50
integer,parameter :: perweight(4) = (/ 100, 500, 30000, 50000 /)
real(kind=prec), parameter :: rrange = 1.5
integer,parameter :: perweight(4) = (/ 1000, 5000, 100000, 500000 /)
real(kind=prec), parameter :: rrange = 3
type(inum), dimension(nzero+nieps+ncmpl) :: basis
type(inum), dimension(size(perweight)) :: args
type(inum), parameter :: ione = inum((1._prec,0._prec), di0)
......@@ -914,7 +916,7 @@ CONTAINS
close(9)
tests_successful = tests_successful .and. .false.
900 FORMAT('Testing ',i5,'/',i5,' GPLs with w=',i1)
900 FORMAT('Testing ',i7,'/',i7,' GPLs with w=',i1)
901 FORMAT(' done. Largest delta = ',ES10.3)
902 FORMAT(' failed with delta = ',ES10.3, ' (seed=',I10,')')
903 FORMAT(' GiNaC problems with seed=',I10)
......
#! /bin/bash
# configure script
# note: has nothing to do with GNU autoconf
exec 2> ${LOGFILE:-/dev/null} 3>&1
eval ${LOGFILE:+set -x}
if [[ -z $LOGFILE ]]; then
exec 2> /dev/null 3>&1
else
exec 3> >(while read TEXT ; do echo $TEXT ; echo $(date +"%d.%m.%Y %H:%M:%S") $TEXT >> $LOGFILE; done)
exec 2>> $LOGFILE
fi
shopt -s nullglob
......@@ -89,7 +92,7 @@ CONF_LD=$LD
CONF_MODDIR=$FPATH
if [ "$CONF_OS" -eq "Darwin" ]; then
if [ "$CONF_OS" == "Darwin" ]; then
CONF_PREFIX=/usr/local/
else
CONF_PREFIX=/usr/
......@@ -125,7 +128,7 @@ for arg in "$@" ; do
--coverage)
COVERAGE=true ;;
--ci)
echo "Running in CI configuration. Will not perform speed tests!"
echo "Running in CI configuration. Will not perform speed tests!" 1>&3
HAVE_MCC=true
HAVE_GINAC=true
DEBUG=true
......@@ -185,6 +188,7 @@ findprog() {
var="$2"
set -- ${!var:+"${!var}"} "${@:3}"
for prog in "$@" ; do
echo "Checking option $prog in path" 1>&2
full="`type -P "$prog"`" && {
echo "$full" 1>&3
printf -v "CONF_$var" "%q" "$full"
......@@ -201,14 +205,17 @@ findlib() {
case "$flag" in
-L* )
libfolder=${flag/-L/}
echo "Checking folder $libfolder" 1>&2
if [ -f "$libfolder/lib$1.so" ] ; then
path=`readlink -f -- "$libfolder/lib$1.so"`
echo "Found SO in folder $libfolder" 1>&2
echo $path 1>&3
printf -v "CONF_$2" "%q" "$path"
return 0
fi
if [ -f "$libfolder/lib$1.a" ] ; then
path=`readlinf -f -- "$libfolder/lib$1.a"`
echo "Found A in folder $libfolder" 1>&2
echo $path 1>&3
printf -v "CONF_$2" "%q" "$path"
return 0
......@@ -220,7 +227,7 @@ findlib() {
return 1
}
addflag() {
eval "CONF_$1=\"\${CONF_$1} ${@:2}\""
eval "CONF_$1=\"${@:2} \${CONF_$1}\""
}
gnuflags() {
......@@ -259,7 +266,7 @@ case "$1,$2,$3" in
$NATIVE && eval addflag FFLAGS -march=native -mtune=native
fi
if $COVERAGE ; then
echo "Coverage analytics is currently only supported for gcc"
echo "Coverage analytics is currently only supported for gcc" 1>&3
exit 1
fi
;;
......@@ -303,7 +310,7 @@ case "$1,$2,$3" in
HAVE_MCC=false
fi
if $COVERAGE ; then
echo "Coverage analytics is currently only supported for gcc"
echo "Coverage analytics is currently only supported for gcc" 1>&3
exit 1
fi
;;
......@@ -317,6 +324,7 @@ echo -n "extracting the Fortran libraries... " 1>&3
rm -fr $test*
echo "Trying the following program as $test.f90" 1>&2
tee $test.f90 << _EOF_ 1>&2
program test
integer i
......@@ -325,7 +333,10 @@ tee $test.f90 << _EOF_ 1>&2
end
_EOF_
echo "Executing $CONF_FC -v -o $test $test.f90" 1>&2
while read line ; do
echo "Parsing line $line" 1>&2
set -- ${line//[:,()]/ }
[[ "$1" =~ (/collect2|/ld|^ld)$ ]] && while test $# -gt 1 ; do
shift
......@@ -333,12 +344,16 @@ while read line ; do
*.o | -lc*)
;;
-l* | -L* | *.a)
echo "Found linker flag $1" 1>&2
FLDFLAGS+=" $1" ;;
-Bstatic | -Bdynamic | *.ld)
echo "Found linker flag $1" 1>&2
FLDFLAGS+=" -Wl,$1" ;;
/*)
echo "Found linker flag $1" 1>&2
FLDFLAGS+=" -L$1" ;;
-rpath*)
echo "Found linker flag $1" 1>&2
FLDFLAGS+=" -Wl,$1,$2"
shift ;;
-dynamic-linker)
......@@ -352,6 +367,7 @@ while read line ; do
shift
case "$1" in
-fintrinsic-modules-path )
echo "Found module path $1" 1>&2
CONF_MODPATH=$2
;;
esac
......@@ -400,16 +416,23 @@ if ( $HAVE_GINAC || $HAVE_MCC ); then
echo -n "does $CONF_FC append underscores... " 1>&3
echo "Trying the following program as $test-c.c" 1>&2
tee $test-c.c << _EOF_ 1>&2
int uscore_ = 95;
int uscore = 59;
_EOF_
for CONF_BITS in ${CONF_BITS:--m64 -m32} ; do
echo "Executing $CONF_CC $CONF_CFLAGS $CONF_BITS -c $test-c.c" 1>&2
eval $CONF_CC $CONF_CFLAGS $CONF_BITS -c $test-c.c 1>&2 || continue
echo "Executing $CONF_FC -o $test $test.f90 $test-c.o" 1>&2
eval $CONF_FC -o $test $test.f90 $test-c.o 1>&2 && break
done
if [[ ! -x "$test" ]]; then
echo "error: linking failed. Please check logfile $LOGFILE." 1>&3
fi
./$test
case $? in
95)
......@@ -424,10 +447,10 @@ _EOF_
esac
else
$CONF_CC=
$CONF_CXX=
$CONF_CFLAGS=
$CONF_NOUNDERSCORE=
CONF_CC=
CONF_CXX=
CONF_CFLAGS=
CONF_NOUNDERSCORE=
fi
......@@ -439,12 +462,15 @@ if $HAVE_MCC ; then
echo -n "what is $CONF_MATH SystemID... " 1>&3
echo "Trying the following program as $test.m" 1>&2
tee $test.m << _EOF_ 1>&2
Print["SYSID "<>ToString[\$SystemID]];
Print["INSTDIR "<>ToString[\$InstallationDirectory]];
Print["USERDIR "<>ToString[\$UserBaseDirectory]];
_EOF_
$CONF_MATH < $test.m > $test.log
echo "Mathematica returned" 1>&2
cat $test.log 1>&2
CONF_MATH_SYS=`cat $test.log | grep "SYSID" | sed 's/.*SYSID //'`
CONF_MATH_DIR=`cat $test.log | grep "INSTDIR" | sed 's/.*INSTDIR //'`
CONF_MATH_USR=`cat $test.log | grep "USERDIR" | sed 's/.*USERDIR //'`
......@@ -458,7 +484,9 @@ _EOF_
PATH=$CONF_COMPAD:$PATH findprog mcc MCC mcc
echo -n "looking for MLDK directory... " 1>&3
echo "Running $CONF_MCC --internals" 1>&2
$CONF_MCC --internals > $test.int
cat $test.int 1>&2
CONF_MLDK=`cat $test.int | grep "MLDK Directory" | cut -f2 -d":"`
echo $CONF_MLDK 1>&3
......@@ -466,7 +494,6 @@ _EOF_
CONF_MCC_CFLAGS=`cat $test.int | grep "Compile Flags$arch:" | cut -f2 -d":"`
CONF_MCC_LFLAGS=`cat $test.int | grep "Linker Libraries" | cut -f2 -d":"`
CONF_MCC_LFLAGS="$CONF_LFLAGS $CONF_MCC_LFLAGS"
cat $test.int | grep "Linker Libraries" | cut -f2 -d":"
if [ ! -z $CONF_BITS ]; then
if [ "$CONF_BITS" -ne "$MCC_BITS" ]; then
echo "mcc wants $MCC_BITS ($arch), $CONF_BITS selected." 1>&3
......@@ -493,6 +520,7 @@ _EOF_
## can we do MathLink compilations
echo -n "do we have working MathLink... " 1>&3
echo "Trying the following program as $test.tm" 1>&2
tee $test.tm << _EOF_ 1>&2
:Begin:
:Function: test
......@@ -512,17 +540,20 @@ int main(int argc, char **argv) {
return MLMain(argc, argv);
}
_EOF_
echo "Executing $CONF_MPREP $test.tm" 1>&2
$CONF_MPREP $test.tm > $test.tm.c
echo "Executing $CONF_CC $CONF_MCC_CFLAGS $CONF_CFLAGS -c $test.tm.c" 1>&2
$CONF_CC $CONF_MCC_CFLAGS $CONF_CFLAGS -c $test.tm.c
echo "Executing $CONF_CC -o $test.math $test.tm.o $CONF_MCC_LFLAGS" 1>&2
$CONF_CC -o $test.math $test.tm.o $CONF_MCC_LFLAGS
test -x $test.math && {
if [[ -x "$test.math" ]] ; then
echo "yes" 1>&3
CONF_ML=1
} || {
else
echo "no" 1>&3
CONF_ML=0
exit 1;
}
fi
fi
......@@ -535,6 +566,7 @@ CONF_LD=${LD:-$CONF_FC}
if $CONF_QUAD ; then
echo -n "does $CONF_FC support quad-precision... " 1>&3
rm -fr $test*
echo "Trying the following program as $test.f90" 1>&2
tee $test.f90 << _EOF_ 1>&2
program test
real(selected_real_kind(30,32)) a, b
......@@ -543,12 +575,16 @@ if $CONF_QUAD ; then
if( a .eq. b ) stop 1
end
_EOF_
echo "Running $CONF_FC $CONF_FFLAGS -o $test $test.f90" 1>&2
$CONF_FC $CONF_FFLAGS -o $test $test.f90 1>&2
if [[ ! -x "$test" ]]; then
echo "no. Compilation failed."
fi
./$test 1>&2 && {
echo "yes" 1>&3
eval addflag FFLAGS -DKINDREAL=16 -DKINDINT=8
} || {
echo "no" 1>&3
echo "no. Running failed" 1>&3
exit 1
}
$HAVE_MCC && eval addflag CFLAGS -DHAVE_QUAD
......@@ -583,6 +619,7 @@ if $HAVE_GINAC ; then
if $FOUND_GINAC; then
CONF_LD=${LD:-$CONF_CXX}
echo -n "Checking if GiNaC works... " 1>&3
echo "Trying the following program as $test.ginac.cpp" 1>&2
tee $test.ginac.cpp << _EOF_ 1>&2
#include <ginac/ginac.h>
#include <iostream>
......@@ -630,14 +667,19 @@ int main() {
complex_t cans = geval_(&x[0],&n);
float del = (2.2982889094420660-cans.r)*(2.2982889094420660-cans.r) + (0.98869296399417417-cans.i)*(0.98869296399417417-cans.i);
if ( (ans<1e-15) && (del<1e-15) )
return 0;
else
return 1;
if (ans>1e-15) return 1;
if (del>1e-15) return 2;
return 0;
}
_EOF_
echo "Running $CONF_CXX $CONF_CXXFLAGS $CONF_BITS -c $test.ginac.cpp" 1>&2
$CONF_CXX $CONF_CXXFLAGS $CONF_BITS -c $test.ginac.cpp
echo "Running $CONF_LD -o $test.ginac $test.ginac.o $CONF_LFLAGS" 1>&2
$CONF_LD -o $test.ginac $test.ginac.o $CONF_LFLAGS
if [[ ! -x "$test.ginac" ]]; then
echo "error compiling GiNaC" 1>&3
exit 1
fi
./$test.ginac
case $? in
0)
......@@ -646,6 +688,9 @@ _EOF_
1)
echo "no" 1>&3
exit 1 ;;
2)
echo "no. Try updating your GiNaC version" 1>&3
exit 1 ;;
*)
echo "error running GiNaC" 1>&3
exit 1 ;;
......@@ -917,10 +962,10 @@ distclean:
@rm -f build/*.gcda build/*.gcno build/*.gcov
@rm -rf report/
@rm -f build/*.o build/*.mod build/*.c build/mcc.internals*
@rm -f test geval libhandyg.a handyg
@rm -f test geval libhandyg.a handyG handyg.mod
@rm -f checks/test-chen.f90 checks/test-muone.f90 checks/test-muoneNP.f90
@rm -f makefile handyg.pc
EOF
echo "Configuration of handyG $VERSION done. Now type \"make\"."
echo "Configuration of handyG $VERSION done. Now type \"make\"." 1>&3
......@@ -16,7 +16,7 @@ MODULE globals
! The following parameters control the accuracy of the evaluation
real(kind=prec), protected :: MPLdelta = zero ! if the MPL sum changes less then del it is truncated.
real(kind=prec), protected :: Lidelta = zero ! like MPLdelta but for polylogs
real(kind=prec), protected :: Lidelta = 0._prec ! like MPLdelta but for polylogs
real(kind=prec), protected :: HoelderCircle = 1.1_prec ! when to apply Hoelder convolution?
integer, parameter :: PolyLogCacheSize(2) = (/ 5, 100 /)
! = (/ mmax, n /). At most n polylogs with weight mmax will be cached
......
......@@ -41,6 +41,7 @@ CONTAINS
if(i**m.lt.0) return ! roll over
if(abs(x**i).lt.1.e-250_prec) return
del = x**i/i**m
if (abs(del) < LiDelta) return
res = res+del
i = i+1
end do
......
......@@ -4,8 +4,16 @@ MODULE mpl_module
use ieps
implicit none
#ifndef KINDREAL
#define KINDREAL 8
#endif
#if KINDREAL==16
real(kind=prec), parameter :: underflowalert = 1.e-600_prec
real(kind=prec), parameter :: overflowalert = 1.e+600_prec
#else
real(kind=prec), parameter :: underflowalert = 1.e-250_prec
real(kind=prec), parameter :: overflowalert = 1.e+250_prec
#endif
#ifdef MPL_CACHE
! Max weight, no. cache
......
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