Skip to content

Commit

Permalink
Merge pull request #3 from JacekHoleczek/master
Browse files Browse the repository at this point in the history
add the libqcdloop 2.x option plus some configure improvements
  • Loading branch information
Vayu authored Jul 28, 2020
2 parents 0784865 + 7f87bd2 commit 849e00b
Show file tree
Hide file tree
Showing 2 changed files with 232 additions and 34 deletions.
87 changes: 62 additions & 25 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ AC_CONFIG_SRCDIR([src/common.h])

AC_CONFIG_AUX_DIR([auxfiles])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror silent-rules foreign])
# Note: "$(shell ...)" is a GNU make extension so it needs "-Wno-portability".
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability silent-rules foreign])

AC_CONFIG_HEADERS([config.h])

Expand All @@ -52,6 +53,7 @@ AC_PROG_FC
AC_F77_LIBRARY_LDFLAGS
AC_F77_WRAPPERS

m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# AC_PROG_RANLIB
AC_PROG_LIBTOOL

Expand Down Expand Up @@ -103,52 +105,87 @@ AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
AC_ARG_WITH([integrals],
[AS_HELP_STRING([--with-integrals],
[library for scalar loop integrals @<:@default=auto@:>@.
@<:@qcdloop1@:>@ tries to use -lqcdloop1.
@<:@oneloop@:>@ tries to use -lavh_olo.
@<:@qcdloop@:>@ use libqcdloop.a and libff.a, CXXFLAGS and LDFLAGS need to be set manually.
@<:@qcdloop2@:>@ tries to use libqcdloop 2.x.
@<:@qcdloop1@:>@ tries to use libqcdloop1.
@<:@oneloop@:>@ tries to use libavh_olo.
@<:@qcdloop@:>@ tries to use libqcdloop 1.x (and libff), CXXFLAGS and LDFLAGS need to be set manually.
])],
[test "x$with_integrals" == "xyes" && with_integrals=auto],
[with_integrals=auto])

case $with_integrals in
auto)
AC_CHECK_LIB([qcdloop1], [qlinit_],[LIBS="$LIBS -lqcdloop1" use_qcdloop1=yes])
AC_CHECK_HEADERS([qcdloop1.h])
if test "x$use_qcdloop1" == "xyes" ; then
AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop for scalar integrals])
else
library_auto_found="no"
if test "x$library_found" != "xyes" ; then
# QCDLoop 2.x
AC_CHECK_PROG([use_qcdloop2], [qcdloop-config], [yes], [no])
if test "x$use_qcdloop2" == "xyes" ; then
library_auto_found="yes"
AC_DEFINE(USE_QCDLOOP2,"1",[use libqcdloop 2.x for scalar integrals])
CPPFLAGS="-std=c++11 `qcdloop-config --cppflags` $CPPFLAGS" # "qcdloop/qcdloop.h" needs "-std=c++11" or newer
# LDLIBS="$LDLIBS `qcdloop-config --ldflags`"
LIBS="$LIBS `qcdloop-config --ldflags`"
fi
fi
if test "x$library_auto_found" != "xyes" ; then
# QCDLoop1 / FF
AC_CHECK_LIB([qcdloop1], [qlinit_],[LIBS="$LIBS -lqcdloop1" use_qcdloop1=yes])
AC_CHECK_HEADERS([qcdloop1.h])
if test "x$use_qcdloop1" == "xyes" ; then
library_auto_found="yes"
AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop1 for scalar integrals])
fi
fi
if test "x$library_auto_found" != "xyes" ; then
# OneLOop
AC_F77_FUNC(avh_olo_mu_set)
AC_CHECK_LIB([avh_olo], [$avh_olo_mu_set],[LIBS="$LIBS -lavh_olo" use_oneloop=yes],[],[$FLIBS])
if test "x$use_oneloop" == "xyes" ; then
library_auto_found="yes"
AC_DEFINE(USE_ONELOOP,"1",[use libavh_olo for scalar integrals])
fi
fi
if test "x$library_auto_found" != "xyes" ; then
# QCDLoop 1.x / FF
AC_F77_FUNC(qlinit)
AC_CHECK_LIB([qcdloop], [$qlinit],[LIBS="$LIBS -lff -lqcdloop" use_qcdloop=yes],[],[-lff $FLIBS])
AC_CHECK_LIB([qcdloop], [$qlinit],[LIBS="$LIBS -lqcdloop -lff" use_qcdloop=yes],[],[-lff $FLIBS])
if test "x$use_qcdloop" == "xyes" ; then
AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop for scalar integrals])
else
AC_F77_FUNC(avh_olo_mu_set)
AC_CHECK_LIB([avh_olo], [$avh_olo_mu_set],[LIBS="$LIBS -lavh_olo" use_oneloop=yes],[],[$FLIBS])
if test "x$use_oneloop" == "xyes" ; then
AC_DEFINE(USE_ONELOOP,"1",[use libavh_olo for scalar integrals])
else
AC_MSG_ERROR([can't find usable scalar integrals library])
fi
library_auto_found="yes"
AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop 1.x for scalar integrals])
fi
fi
if test "x$library_auto_found" != "xyes" ; then
AC_MSG_ERROR([can't automatically find usable scalar integrals library])
fi
;;
qcdloop2) # QCDLoop 2.x
AC_CHECK_PROG([use_qcdloop2], [qcdloop-config], [yes], [no])
if test "x$use_qcdloop2" == "xyes" ; then
AC_DEFINE(USE_QCDLOOP2,"1",[use libqcdloop 2.x for scalar integrals])
CPPFLAGS="-std=c++11 `qcdloop-config --cppflags` $CPPFLAGS" # "qcdloop/qcdloop.h" needs "-std=c++11" or newer
# LDLIBS="$LDLIBS `qcdloop-config --ldflags`"
LIBS="$LIBS `qcdloop-config --ldflags`"
else
AC_MSG_ERROR([qcdloop-config is missing])
fi
;;
qcdloop1)
qcdloop1) # QCDLoop1 / FF
AC_CHECK_LIB([qcdloop1], [qlinit_],
[LIBS="$LIBS -lqcdloop1" use_qcdloop1=yes AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop for scalar integrals])],
[LIBS="$LIBS -lqcdloop1" use_qcdloop1=yes AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop1 for scalar integrals])],
[AC_MSG_ERROR([libqcdloop1 library is missing])])
AC_CHECK_HEADERS([qcdloop1.h])
;;
oneloop)
oneloop) # OneLOop
AC_F77_FUNC(avh_olo_mu_set)
AC_CHECK_LIB([avh_olo], [$avh_olo_mu_set],
[LIBS="$LIBS -lavh_olo" use_oneloop=yes AC_DEFINE(USE_ONELOOP,"1",[use libavh_olo for scalar integrals])],
[AC_MSG_ERROR([libavh_olo library is missing])],[$FLIBS])
;;
qcdloop)
qcdloop) # QCDLoop 1.x / FF
AC_F77_FUNC(qlinit)
AC_CHECK_LIB([qcdloop], [$qlinit],
[LIBS="$LIBS -lff -lqcdloop" use_qcdloop=yes AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop for scalar integrals])],
[AC_MSG_ERROR([libqcdloop library is missing])],[-lff $FLIBS])
[LIBS="$LIBS -lqcdloop -lff" use_qcdloop=yes AC_DEFINE(USE_QCDLOOP,"1",[use libqcdloop 1.x for scalar integrals])],
[AC_MSG_ERROR([libqcdloop 1.x library is missing])],[-lff $FLIBS])
;;
*)
AC_MSG_ERROR([Bad value for --with-integrals: $with_integrals])
Expand Down
179 changes: 170 additions & 9 deletions src/integral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,172 @@
*
* this file is part of PJFry library
* Copyright 2011 Valery Yundin
*
* QCDLoop 2.x interface by Jacek M. Holeczek 2020.01.31
*/

#include "integral.h"
#include "minor.h"
#include "cache.h"

static Initialize pjinit=Initialize();
static Initialize pjinit;

//
// QCDLoop 2.x
//
#ifdef USE_QCDLOOP2
// the same identifier is defined in "PJFry/config.h" and "qcdloop/config.h"
// #if defined(VERSION)
// #undef VERSION
// #endif /* defined(VERSION) */

#include "qcdloop/qcdloop.h" // needs "-std=c++11" or newer
#include <stdexcept>
#include <iostream>

Initialize::Initialize() {
#ifndef NDEBUG
std::cout << std::endl << "PJFRY init" << std::endl;
#endif
}

Initialize::~Initialize() {}

ICache::Ival qlI1(const Kinem1 &k) {
static ql::TadPole<ql::complex, double, double> td;
static std::vector<double> mI1(1);
static std::vector<ql::complex> r(3);
ICache::Ival ivalue;

try {
mI1[0] = k.m1();
td.integral(r, ICache::getMu2(), mI1);
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
exit(-1);
}

ivalue.val[0] = r[0];
ivalue.val[1] = r[1];
ivalue.val[2] = r[2];
return ivalue;
}

ICache::Ival qlI2(const Kinem2 &k) {
static ql::Bubble<ql::complex, double, double> bb;
static std::vector<double> mI2(2);
static std::vector<double> pI2(1);
static std::vector<ql::complex> r(3);
ICache::Ival ivalue;

try {
mI2[0] = k.m1();
mI2[1] = k.m2();
pI2[0] = k.p1();
bb.integral(r, ICache::getMu2(), mI2, pI2);
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
exit(-1);
}

ivalue.val[0] = r[0];
ivalue.val[1] = r[1];
ivalue.val[2] = r[2];
return ivalue;
}

ICache::Ival qlI3(const Kinem3 &k) {
static ql::Triangle<ql::complex, double, double> tr;
static std::vector<double> mI3(3);
static std::vector<double> pI3(3);
static std::vector<ql::complex> r(3);
ICache::Ival ivalue;

try {
mI3[0] = k.m1();
mI3[1] = k.m2();
mI3[2] = k.m3();
pI3[0] = k.p1();
pI3[1] = k.p2();
pI3[2] = k.p3();
tr.integral(r, ICache::getMu2(), mI3, pI3);
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
exit(-1);
}

ivalue.val[0] = r[0];
ivalue.val[1] = r[1];
ivalue.val[2] = r[2];
return ivalue;
}

ICache::Ival qlI4(const Kinem4 &k) {
static ql::Box<ql::complex, double, double> bo;
static std::vector<double> mI4(4);
static std::vector<double> pI4(6);
static std::vector<ql::complex> r(3);
ICache::Ival ivalue;

try {
if (k.s12() == 0. || k.s23() == 0.) {
if (k.p1() != 0. && k.p3() != 0.) {
mI4[0] = k.m1();
mI4[1] = k.m3();
mI4[2] = k.m2();
mI4[3] = k.m4();
pI4[0] = k.s12();
pI4[1] = k.p2();
pI4[2] = k.s23();
pI4[3] = k.p4();
pI4[4] = k.p1();
pI4[5] = k.p3();
} else if (k.p2() != 0. && k.p4() != 0.) {
mI4[0] = k.m2();
mI4[1] = k.m4();
mI4[2] = k.m3();
mI4[3] = k.m1();
pI4[0] = k.s23();
pI4[1] = k.p3();
pI4[2] = k.s12();
pI4[3] = k.p1();
pI4[4] = k.p2();
pI4[5] = k.p4();
} else { assert(0); }
} else {
mI4[0] = k.m1();
mI4[1] = k.m2();
mI4[2] = k.m3();
mI4[3] = k.m4();
pI4[0] = k.p1();
pI4[1] = k.p2();
pI4[2] = k.p3();
pI4[3] = k.p4();
pI4[4] = k.s12();
pI4[5] = k.s23();
}
bo.integral(r, ICache::getMu2(), mI4, pI4);
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
exit(-1);
}

ivalue.val[0] = r[0];
ivalue.val[1] = r[1];
ivalue.val[2] = r[2];
return ivalue;
}
#endif /* USE_QCDLOOP2 */

//
// QCDLoop1 and QCDLoop 1.x / FF
//
#ifdef USE_QCDLOOP
Initialize::Initialize()
{
#ifndef NDEBUG
printf("PJFRY init\n");
#endif
const double dbl_min=std::numeric_limits<double>::min();

F77_FUNC(qlinit,QLINIT)();
Expand Down Expand Up @@ -228,21 +382,34 @@ ICache::Ival qlI4(const Kinem4& k)
ivalue.val[2]=F77_FUNC(qli4,QLI4)(&p1, &p2, &p3, &p4, &s12, &s23, &m1, &m2, &m3, &m4, &mu2, &ep);
# endif
}

return ivalue;
}

#endif /* USE_QCDLOOP */

//
// OneLOop
//
#ifdef USE_ONELOOP
Initialize::Initialize()
{
#ifndef NDEBUG
printf("PJFRY init\n");
#endif

double mu=sqrt(ICache::getMu2());
F77_FUNC_(avh_olo_mu_set,AVH_OLO_MU_SET)(&mu);

double thrs=Minor5::getmeps();
F77_FUNC_(avh_olo_onshell,AVH_OLO_ONSHELL)(&thrs);
#ifndef NDEBUG
printf("Set avh_olo_onshell threshold value to %e\n", thrs);
#endif
}

Initialize::~Initialize()
{
/* NOOP */
}

ICache::Ival qlI1(const Kinem1& k)
Expand Down Expand Up @@ -324,10 +491,4 @@ ICache::Ival qlI4(const Kinem4& k)
ivalue.val[2]=rslt[2];
return ivalue;
}

Initialize::~Initialize()
{
/* NOOP */
}

#endif /* USE_QCDLOOP1 */
#endif /* USE_ONELOOP */

0 comments on commit 849e00b

Please sign in to comment.