44static constexpr double Pi = 3.141592653589793;
47static constexpr double oneLoop = 6.332573977646110963e-03;
48static constexpr double twoLoop = 4.010149318236068752e-05;
49static constexpr double threeLoop = 2.539456721913701978e-07;
50static constexpr double fourLoop = 1.608129755454920543e-09;
51static constexpr double fiveLoop = 1.018360064207223307e-11;
52static constexpr bool True =
true;
53static constexpr double zeta2 = 1.6449340668482264;
54static constexpr double zeta3 = 1.2020569031595943;
55static constexpr double zeta4 = 1.0823232337111382;
56static constexpr double zeta5 = 1.0369277551433699;
57static constexpr double ln2 = 0.69314718055994531;
62inline int Abs(
int x)
noexcept {
return std::abs(x); }
63inline long Abs(
long x)
noexcept {
return std::abs(x); }
64inline long long Abs(
long long x)
noexcept {
return std::abs(x); }
65inline float Abs(
float x)
noexcept {
return std::abs(x); }
66inline double Abs(
double x)
noexcept {
return std::abs(x); }
67inline long double Abs(
long double x)
noexcept {
return std::abs(x); }
68inline float Abs(
const std::complex<float>& x)
noexcept {
return std::abs(x); }
69inline double Abs(
const std::complex<double>& x)
noexcept {
return std::abs(x); }
70inline long double Abs(
const std::complex<long double>& x)
noexcept {
return std::abs(x); }
72template <
typename Derived>
73auto Abs(
const Eigen::ArrayBase<Derived>& x) ->
decltype(x.cwiseAbs().eval())
78template <
typename Derived>
79auto Abs(
const Eigen::MatrixBase<Derived>& x) ->
decltype(x.cwiseAbs().eval())
86inline int AbsSqr(
int x)
noexcept {
return x*x; }
87inline long AbsSqr(
long x)
noexcept {
return x*x; }
88inline long long AbsSqr(
long long x)
noexcept {
return x*x; }
89inline float AbsSqr(
float x)
noexcept {
return x*x; }
90inline double AbsSqr(
double x)
noexcept {
return x*x; }
91inline long double AbsSqr(
long double x)
noexcept {
return x*x; }
92inline float AbsSqr(
const std::complex<float>& x)
noexcept {
return std::norm(x); }
93inline double AbsSqr(
const std::complex<double>& x)
noexcept {
return std::norm(x); }
94inline long double AbsSqr(
const std::complex<long double>& x)
noexcept {
return std::norm(x); }
96template <
typename Derived>
97auto AbsSqr(
const Eigen::ArrayBase<Derived>& x) ->
decltype(x.cwiseAbs().eval().square().eval())
99 return x.eval().cwiseAbs().square();
102template <
typename Derived>
103auto AbsSqr(
const Eigen::MatrixBase<Derived>& x) ->
decltype(
AbsSqr(x.array()).matrix().eval())
105 return AbsSqr(x.array()).matrix().eval();
110inline double AbsSqrt(
double x)
noexcept {
return std::sqrt(std::abs(x)); }
112inline double AbsSqrt(
const std::complex<double>& x)
noexcept {
return std::sqrt(std::abs(x)); }
114template <
typename Derived>
115auto AbsSqrt(
const Eigen::ArrayBase<Derived>& x) ->
decltype(x.cwiseAbs().cwiseSqrt())
117 return x.cwiseAbs().cwiseSqrt();
120template <
typename Derived>
121auto AbsSqrt(
const Eigen::MatrixBase<Derived>& x) ->
decltype(x.cwiseAbs().cwiseSqrt())
123 return x.cwiseAbs().cwiseSqrt();
128inline double ArcCos(
double x)
noexcept {
return std::acos(x); }
129inline std::complex<double>
ArcCos(
const std::complex<double>& x)
noexcept {
return std::acos(x); }
133inline double ArcSin(
double x)
noexcept {
return std::asin(x); }
134inline std::complex<double>
ArcSin(
const std::complex<double>& x)
noexcept {
return std::asin(x); }
138inline double ArcTan(
double x)
noexcept {
return std::atan(x); }
139inline std::complex<double>
ArcTan(
const std::complex<double>& x)
noexcept {
return std::atan(x); }
144inline double Arg(
const std::complex<double>& x)
noexcept {
return std::arg(x); }
148inline double Cbrt(
double x)
noexcept {
return std::cbrt(x); }
152inline int Conj(
int x)
noexcept {
return x; }
153inline long Conj(
long x)
noexcept {
return x; }
154inline long long Conj(
long long x)
noexcept {
return x; }
155inline float Conj(
float x)
noexcept {
return x; }
156inline double Conj(
double x)
noexcept {
return x; }
157inline long double Conj(
long double x)
noexcept {
return x; }
158inline std::complex<float>
Conj(
const std::complex<float>& x)
noexcept {
return std::conj(x); }
159inline std::complex<double>
Conj(
const std::complex<double>& x)
noexcept {
return std::conj(x); }
160inline std::complex<long double>
Conj(
const std::complex<long double>& x)
noexcept {
return std::conj(x); }
162template <
typename Derived>
163auto Conj(
const Eigen::ArrayBase<Derived>& x) ->
decltype(x.conjugate())
165 return x.conjugate();
168template <
typename Derived>
169auto Conj(
const Eigen::MatrixBase<Derived>& x) ->
decltype(x.conjugate())
171 return x.conjugate();
174#define Conjugate(x) Conj(x)
194double Tan(
double a)
noexcept;
195double Cot(
double a)
noexcept;
196double Cos(
double x)
noexcept;
197double Sin(
double x)
noexcept;
198double Sec(
double x)
noexcept;
199double Csc(
double x)
noexcept;
203int Delta(
int i,
int j)
noexcept;
207#define FSFlagProblem(p) [&](){ (p); return 0.; }()
211#define FSFlagWarning(p) [&](){ (p); return 0.; }()
224bool IsFinite(const
std::complex<
double>&) noexcept;
226template <class Derived>
231 const auto nr = m.rows();
232 const auto nc = m.cols();
234 for (
int r = 0; r < nr; r++) {
235 for (
int c = 0; c < nc; c++) {
236 if (!std::isfinite(m(r,c))) {
251template <
class Derived>
252typename Eigen::MatrixBase<Derived>::PlainObject
Diag(
const Eigen::MatrixBase<Derived>& m)
254 if (m.rows() != m.cols()) {
255 throw SetupError(
"Diag is only defined for squared matrices");
258 typename Eigen::MatrixBase<Derived>::PlainObject diag(m);
260 for (Eigen::Index i = 0; i < m.rows(); ++i) {
261 for (Eigen::Index k = i + 1; k < m.cols(); ++k) {
266 for (Eigen::Index i = 0; i < m.rows(); ++i) {
267 for (Eigen::Index k = 0; k < i; ++k) {
277std::complex<double>
ComplexLog(
double a)
noexcept;
278std::complex<double>
ComplexLog(
const std::complex<double>& z)
noexcept;
292template <
typename Derived>
295 if (m.rows() != m.cols()) {
296 throw SetupError(
"Hermitianize is only defined for squared matrices");
299 for (Eigen::Index i = 0; i < m.rows(); ++i) {
300 for (Eigen::Index k = 0; k < i; ++k) {
301 m(i,k) =
Conj(m(k,i));
310template <
typename Pr
inter>
311void PrintTo(std::stringstream& ostr, Printer&& printer)
316template <
typename Printer,
typename T0,
typename... Ts>
317void PrintTo(std::stringstream& ostr, Printer&& printer, T0&& v, Ts&&... vs)
320 PrintTo(ostr, printer, std::forward<Ts>(vs)...);
326template<
typename... Ts>
329 std::stringstream ss;
330 PrintTo(ss, [] (
const std::string& s) {
DEBUG_MSG(s); }, std::forward<Ts>(vs)...);
335template<
typename... Ts>
338 std::stringstream ss;
339 PrintTo(ss, [] (
const std::string& s) {
ERROR(s); }, std::forward<Ts>(vs)...);
344template<
typename... Ts>
347 std::stringstream ss;
348 PrintTo(ss, [] (
const std::string& s) {
FATAL(s); }, std::forward<Ts>(vs)...);
353template<
typename... Ts>
356 std::stringstream ss;
357 PrintTo(ss, [] (
const std::string& s) {
INFO(s); }, std::forward<Ts>(vs)...);
362template<
typename... Ts>
365 std::stringstream ss;
371template<
typename... Ts>
374 std::stringstream ss;
375 PrintTo(ss, [] (
const std::string& s) {
WARNING(s); }, std::forward<Ts>(vs)...);
381double Log(
double a)
noexcept;
387double MaxRelDiff(
const std::complex<double>&,
const std::complex<double>&)
noexcept;
389template <
class Derived>
391 const Eigen::PlainObjectBase<Derived>& b)
392 ->
decltype(
MaxRelDiff(a.data()[0], b.data()[0]))
394 if (a.rows() != b.rows() || a.cols() != b.cols()) {
395 throw SetupError(
"MaxRelDiff: Matrices/Vectors have different size!");
398 using Scalar_t =
decltype(
MaxRelDiff(a.data()[0], b.data()[0]));
402 for (Eigen::Index i = 0; i < a.size(); i++) {
403 max = std::max(max,
MaxRelDiff(a.data()[i], b.data()[i]));
413double MaxAbsValue(
const std::complex<double>& x)
noexcept;
415template <
class Derived>
416auto MaxAbsValue(
const Eigen::MatrixBase<Derived>& x)
noexcept ->
decltype(x.cwiseAbs().maxCoeff())
418 return x.cwiseAbs().maxCoeff();
421template <
class Derived>
422auto MaxAbsValue(
const Eigen::ArrayBase<Derived>& x)
noexcept ->
decltype(x.cwiseAbs().maxCoeff())
424 return x.cwiseAbs().maxCoeff();
432 return std::forward<T>(t);
435template<
typename T0,
typename T1,
typename... Ts>
436typename std::common_type<T0, T1, Ts...>::type
Max(T0&& val1, T1&& val2, Ts&&... vs)
noexcept
439 return Max(val1, std::forward<Ts>(vs)...);
441 return Max(val2, std::forward<Ts>(vs)...);
447 return std::forward<T>(t);
450template<
typename T0,
typename T1,
typename... Ts>
451typename std::common_type<T0, T1, Ts...>::type
Min(T0&& val1, T1&& val2, Ts&&... vs)
noexcept
454 return Min(val2, std::forward<Ts>(vs)...);
456 return Min(val1, std::forward<Ts>(vs)...);
461int Sign(
double x)
noexcept;
462int Sign(
int x)
noexcept;
467double PolyLog(
int,
double)
noexcept;
470std::complex<double>
PolyLog(
int,
const std::complex<double>&)
noexcept;
474template <
typename Base,
typename Exponent>
475Base
Power(Base base, Exponent exp)
noexcept
477 return std::pow(base, exp);
480template <
typename Base>
486template <
typename Base>
492template <
typename Base>
498template <
typename Base>
504template <
typename Base>
510template <
typename Base>
516template <
typename Base>
522template <
typename Base>
528template <
typename Base>
534template <
typename Base>
540template <
typename Base>
554double Re(
double)
noexcept;
556double Re(
const std::complex<double>&)
noexcept;
558template<
class Derived>
559auto Re(
const Eigen::MatrixBase<Derived>& x)
noexcept ->
decltype(x.real().eval())
561 return x.real().eval();
566double Im(
double)
noexcept;
568double Im(
const std::complex<double>&)
noexcept;
570template<
class Derived>
571auto Im(
const Eigen::MatrixBase<Derived>& x)
noexcept ->
decltype(x.imag().eval())
573 return x.imag().eval();
581 const T max = std::max(a, b);
583 if (std::abs(max) < eps)
586 return (a - b) / max;
591int Round(
double a)
noexcept;
599template <
typename Derived>
600auto SignedAbsSqrt(
const Eigen::ArrayBase<Derived>& a)
noexcept ->
typename Derived::PlainObject
602 using Scalar =
typename Derived::PlainObject::Scalar;
603 return a.unaryExpr([](Scalar a) -> Scalar {
return SignedAbsSqrt(a); });
608template <class T, typename = std::enable_if_t<std::is_floating_point<T>::value,T>>
614template <class T, typename = std::enable_if_t<std::is_integral<T>::value,T>>
617 return std::sqrt(
static_cast<double>(a));
621template <
typename Derived>
622auto Sqrt(
const Eigen::ArrayBase<Derived>& a)
noexcept ->
typename Derived::PlainObject
624 using Scalar =
typename Derived::PlainObject::Scalar;
625 return a.unaryExpr([](Scalar a) -> Scalar {
return Sqrt(a); });
631constexpr std::complex<T>
Sqr(
const std::complex<T>& a)
noexcept
636template <typename T, class = std::enable_if_t<std::is_arithmetic<T>::value,T>>
637constexpr T
Sqr(T a)
noexcept
643template <
typename Derived>
644auto Sqr(
const Eigen::ArrayBase<Derived>& a)
noexcept ->
typename Derived::PlainObject
646 using Scalar =
typename Derived::PlainObject::Scalar;
647 return a.unaryExpr([](Scalar a) -> Scalar {
return Sqr(a); });
651template <
typename Derived>
652auto Sqr(
const Eigen::MatrixBase<Derived>& a)
noexcept ->
typename Derived::PlainObject
659#define DEFINE_COMMUTATIVE_OPERATOR_COMPLEX_INT(op) \
660 template <typename T> \
661 std::complex<T> operator op(const std::complex<T>& lhs, int rhs) \
663 return lhs op static_cast<T>(rhs); \
666 template <typename T> \
667 std::complex<T> operator op(int lhs, const std::complex<T>& rhs) \
669 return static_cast<T>(lhs) op rhs; \
683template <typename Derived>
686 if (m.rows() != m.cols()) {
687 throw SetupError(
"Symmetrize is only defined for squared matrices");
690 for (Eigen::Index i = 0; i < m.rows(); ++i) {
691 for (Eigen::Index k = 0; k < i; ++k) {
697#define UNITMATRIX(rows) Eigen::Matrix<double,rows,rows>::Identity()
698#define ZEROMATRIX(rows,cols) Eigen::Matrix<double,rows,cols>::Zero()
699#define ZEROTENSOR3(d1,d2,d3) ZeroTensor3<double,d1,d2,d3>()
700#define ZEROTENSOR4(d1,d2,d3,d4) ZeroTensor4<double,d1,d2,d3,d4>()
701#define ZEROVECTOR(rows) Eigen::Matrix<double,rows,1>::Zero()
702#define ZEROARRAY(rows) Eigen::Array<double,rows,1>::Zero()
703#define UNITMATRIXCOMPLEX(rows) Eigen::Matrix<std::complex<double>,rows,rows>::Identity()
704#define ZEROMATRIXCOMPLEX(rows,cols) Eigen::Matrix<std::complex<double>,rows,cols>::Zero()
705#define ZEROVECTORCOMPLEX(rows) Eigen::Matrix<std::complex<double>,rows,1>::Zero()
706#define ZEROTENSOR3COMPLEX(d1,d2,d3) ZeroTensor3<std::complex<double>,d1,d2,d3>()
707#define ZEROTENSOR4COMPLEX(d1,d2,d3,d4) ZeroTensor4<std::complex<double>,d1,d2,d3,d4>()
708#define ZEROARRAYCOMPLEX(rows) Eigen::Array<std::complex<double>,rows,1>::Zero()
712#define PROJECTOR Proj
713#define DEFINE_PROJECTOR(M,N,X,Y) \
714 Eigen::Matrix<double,M,N> Proj(Eigen::Matrix<double,M,N>::Zero()); \
715 Proj((X)-1,(Y)-1) = 1;
723template<
class Scalar,
int M>
724Eigen::Matrix<Scalar,M,M>
ToMatrix(
const Eigen::Array<Scalar,M,1>& a)
noexcept
726 return Eigen::Matrix<Scalar,M,M>(a.matrix().asDiagonal());
729template<
class Scalar,
int M,
int N>
730Eigen::Matrix<Scalar,M,N>
ToMatrix(
const Eigen::Matrix<Scalar,M,N>& a)
noexcept
740std::string
ToString(
unsigned short);
743std::string
ToString(
unsigned long long);
749std::string
ToString(
signed long long);
752std::string
ToString(
const std::complex<double>&);
757double Total(
double)
noexcept;
760std::complex<double>
Total(
const std::complex<double>&)
noexcept;
763template <
typename Derived>
764auto Total(
const Eigen::DenseBase<Derived>& a)
noexcept ->
typename Derived::Scalar
772template <
int N,
int i,
typename Scalar =
double>
773constexpr auto UnitVector() noexcept -> Eigen::Matrix<Scalar,N,1>
775 return Eigen::Matrix<Scalar,N,1>::Unit(i);
779template <
int N,
typename Scalar =
double>
780constexpr auto UnitVector(
int i)
noexcept -> Eigen::Matrix<Scalar,N,1>
782 return Eigen::Matrix<Scalar,N,1>::Unit(i);
786Eigen::VectorXd
UnitVector(
int N,
int i)
noexcept;
791template <
int M,
int N,
int i,
int j,
typename Scalar =
double>
794 Eigen::Matrix<Scalar,M,N> proj(Eigen::Matrix<Scalar,M,N>::Zero());
801template <
int M,
int N,
typename Scalar =
double>
804 Eigen::Matrix<Scalar,M,N> proj(Eigen::Matrix<Scalar,M,N>::Zero());
819 return x < T() ? 0 : 1;
828template <
typename Derived>
829Derived
ZeroSqrt(
const Eigen::ArrayBase<Derived>& m)
noexcept
831 return m.unaryExpr([](
double a){
return ZeroSqrt(a); });
836 return Sqr(x-y-z) - 4*y*z;
Exception class to be used in the FlexibleSUSY model file.
Spectrum generator was not setup correctly.
void PrintTo(std::stringstream &ostr, Printer &&printer, T0 &&v, Ts &&... vs)
constexpr T norm(const Complex< T > &z) noexcept
double Re(double x) noexcept
constexpr Base Power10(Base b) noexcept
constexpr Base Power3(Base b) noexcept
static constexpr bool True
double PrintINFO(Ts &&... vs)
print an information message
double ArcCos(double x) noexcept
double Cos(double x) noexcept
constexpr Base Power6(Base b) noexcept
static constexpr double oneOver16Pi
static constexpr double zeta2
static constexpr double ln2
T RelDiff(T a, T b, T eps=std::numeric_limits< T >::epsilon()) noexcept
static constexpr double oneOverSqrt2
double Arg(double x) noexcept
Eigen::Matrix< Scalar, M, M > ToMatrix(const Eigen::Array< Scalar, M, 1 > &a) noexcept
int Sign(double x) noexcept
double ArcSin(double x) noexcept
constexpr T arg(const Complex< T > &z) noexcept
static constexpr double oneLoop
double FSThrow(const std::string &s)
double FiniteLog(double a) noexcept
constexpr Base Power7(Base b) noexcept
double PrintWARNING(Ts &&... vs)
print warning to cerr
double AbsSqrt(double x) noexcept
bool IsCloseRel(double a, double b, double eps) noexcept
double ZeroSqrt(double x) noexcept
sqrt(x) for x >= 0; 0 for x < 0
bool IsClose(double a, double b, double eps) noexcept
double PolyLog(int n, double z) noexcept
real polylogarithm
static constexpr double fiveLoop
constexpr std::complex< T > Sqr(const std::complex< T > &a) noexcept
constexpr int UnitStep(T x) noexcept
step function (0 for x < 0, 1 otherwise)
int Delta(int i, int j) noexcept
double Cbrt(double x) noexcept
double Cot(double a) noexcept
void Hermitianize(Eigen::PlainObjectBase< Derived > &m)
double Sin(double x) noexcept
double PrintDEBUG(Ts &&... vs)
print debug information to cerr
Eigen::MatrixBase< Derived >::PlainObject Diag(const Eigen::MatrixBase< Derived > &m)
static constexpr double zeta4
double Log(double a) noexcept
std::complex< double > ComplexLog(double a) noexcept
constexpr Base Power9(Base b) noexcept
double MaxRelDiff(double a, double b) noexcept
double SignedAbsSqrt(double a) noexcept
signed square root of absolute
double Total(double a) noexcept
sum of all arguments
T KallenLambda(T x, T y, T z) noexcept
double Im(double) noexcept
void Symmetrize(Eigen::PlainObjectBase< Derived > &m)
double ArcTan(double x) noexcept
int AbsSqr(int x) noexcept
int KroneckerDelta(int i, int j) noexcept
double Csc(double x) noexcept
constexpr Base Power12(Base b) noexcept
static constexpr double threeLoop
constexpr T Quad(T a) noexcept
Base Power(Base base, Exponent exp) noexcept
static constexpr double fourLoop
static constexpr double zeta5
constexpr Base Power5(Base b) noexcept
double Sec(double x) noexcept
int Round(double a) noexcept
std::string ToString(char a)
constexpr Base Power11(Base b) noexcept
constexpr Base Power4(Base b) noexcept
double PrintFATAL(Ts &&... vs)
print error to cerr and stop program
Eigen::MatrixXd MatrixProjector(int M, int N, int i, int j) noexcept
unit matrix projector of size MxN into direction i, j
constexpr Base Power8(Base b) noexcept
static constexpr double twoLoop
bool IsFinite(double x) noexcept
static constexpr double Pi
double Tan(double a) noexcept
double PrintERROR(Ts &&... vs)
print error to cerr
Eigen::VectorXd UnitVector(int N, int i) noexcept
unit vector of length N into direction i
constexpr Base Power2(Base b) noexcept
constexpr T Cube(T a) noexcept
static constexpr double oneOver16PiSqr
static constexpr double zeta3
double PrintVERBOSE(Ts &&... vs)
print verbose information to cerr
double MaxAbsValue(double x) noexcept
constexpr Complex< T > conj(const Complex< T > &z) noexcept
#define DEFINE_COMMUTATIVE_OPERATOR_COMPLEX_INT(op)