Skip to content

Commit

Permalink
mark threshold functions and dilog as pure
Browse files Browse the repository at this point in the history
to allow for improved optimization in HSSUSY
  • Loading branch information
Alexander Voigt authored and Alexander Voigt committed Jul 4, 2018
1 parent 7a14c7b commit 527d54f
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 174 deletions.
12 changes: 6 additions & 6 deletions src/dilog.cpp
Expand Up @@ -25,7 +25,7 @@ namespace gm2calc {

namespace {
template <typename T>
T sqr(T x) { return x*x; }
T sqr(T x) noexcept { return x*x; }
} // namespace

/**
Expand All @@ -34,7 +34,7 @@ namespace {
* @note Implementation translated by R.Brun from CERNLIB DILOG function C332
* @return \f$\mathrm{Li}_2(z)\f$
*/
double dilog(double x) {
double dilog(double x) noexcept {
const double PI = M_PI;
const double HF = 0.5;
const double PI2 = PI*PI;
Expand Down Expand Up @@ -110,7 +110,7 @@ double dilog(double x) {
*
* @note not full long double precision yet!
*/
long double dilog(long double x) {
long double dilog(long double x) noexcept {
return dilog(static_cast<double>(x));
}

Expand All @@ -120,7 +120,7 @@ long double dilog(long double x) {
* @note Implementation translated from SPheno to C++
* @return \f$\mathrm{Li}_2(z)\f$
*/
std::complex<long double> dilog(const std::complex<long double>& z) {
std::complex<long double> dilog(const std::complex<long double>& z) noexcept {
using flexiblesusy::fast_log;
const long double PI = 3.1415926535897932384626433832795l;
std::complex<long double> cy, cz;
Expand Down Expand Up @@ -215,7 +215,7 @@ std::complex<long double> dilog(const std::complex<long double>& z) {
* @note Implementation translated from SPheno to C++
* @return \f$\mathrm{Li}_2(z)\f$
*/
std::complex<double> dilog(const std::complex<double>& z) {
std::complex<double> dilog(const std::complex<double>& z) noexcept {
const auto rz = static_cast<long double>(std::real(z));
const auto iz = static_cast<long double>(std::imag(z));
const auto re = dilog(std::complex<long double>(rz, iz));
Expand All @@ -227,7 +227,7 @@ std::complex<double> dilog(const std::complex<double>& z) {
* @param x real angle
* @return \f$\mathrm{Cl}_2(\theta)\f$
*/
double clausen_2(double x)
double clausen_2(double x) noexcept
{
using std::exp;
using gm2calc::dilog;
Expand Down
11 changes: 6 additions & 5 deletions src/dilog.hpp
Expand Up @@ -20,23 +20,24 @@
#define DILOG_H

#include <complex>
#include "cextensions.hpp"

namespace gm2calc {

/// real dilogarithm
double dilog(double);
double dilog(double) noexcept ATTR(const);

/// real dilogarithm
long double dilog(long double);
long double dilog(long double) noexcept ATTR(const);

/// complex dilogarithm
std::complex<double> dilog(const std::complex<double>&);
std::complex<double> dilog(const std::complex<double>&) noexcept ATTR(const);

/// complex dilogarithm
std::complex<long double> dilog(const std::complex<long double>&);
std::complex<long double> dilog(const std::complex<long double>&) noexcept ATTR(const);

/// Clausen function Cl_2(x)
double clausen_2(double);
double clausen_2(double) noexcept ATTR(const);

} // namespace gm2calc

Expand Down

0 comments on commit 527d54f

Please sign in to comment.