|
Go to the documentation of this file.
44static constexpr double Pi = 3.141592653589793;
47static constexpr double oneOver4Pi = 0.079577471545947668;
48static constexpr double oneLoop = 6.332573977646110963e-03;
49static constexpr double twoLoop = 4.010149318236068752e-05;
50static constexpr double threeLoop = 2.539456721913701978e-07;
51static constexpr double fourLoop = 1.608129755454920543e-09;
52static constexpr double fiveLoop = 1.018360064207223307e-11;
53static constexpr bool True = true;
54static constexpr double zeta2 = 1.6449340668482264;
55static constexpr double zeta3 = 1.2020569031595943;
56static constexpr double zeta4 = 1.0823232337111382;
57static constexpr double zeta5 = 1.0369277551433699;
58static constexpr double ln2 = 0.69314718055994531;
59static constexpr double sqrt2 = 1.4142135623730950;
64inline int Abs( int x) noexcept { return std::abs(x); }
65inline long Abs( long x) noexcept { return std::abs(x); }
66inline long long Abs( long long x) noexcept { return std::abs(x); }
67inline float Abs( float x) noexcept { return std::abs(x); }
68inline double Abs( double x) noexcept { return std::abs(x); }
69inline long double Abs( long double x) noexcept { return std::abs(x); }
70inline float Abs( const std::complex<float>& x) noexcept { return std::abs(x); }
71inline double Abs( const std::complex<double>& x) noexcept { return std::abs(x); }
72inline long double Abs( const std::complex<long double>& x) noexcept { return std::abs(x); }
74template < typename Derived>
75auto Abs( const Eigen::ArrayBase<Derived>& x) -> decltype(x.cwiseAbs().eval())
80template < typename Derived>
81auto Abs( const Eigen::MatrixBase<Derived>& x) -> decltype(x.cwiseAbs().eval())
88inline int AbsSqr( int x) noexcept { return x*x; }
89inline long AbsSqr( long x) noexcept { return x*x; }
90inline long long AbsSqr( long long x) noexcept { return x*x; }
91inline float AbsSqr( float x) noexcept { return x*x; }
92inline double AbsSqr( double x) noexcept { return x*x; }
93inline long double AbsSqr( long double x) noexcept { return x*x; }
94inline float AbsSqr( const std::complex<float>& x) noexcept { return std::norm(x); }
95inline double AbsSqr( const std::complex<double>& x) noexcept { return std::norm(x); }
96inline long double AbsSqr( const std::complex<long double>& x) noexcept { return std::norm(x); }
98template < typename Derived>
99auto AbsSqr( const Eigen::ArrayBase<Derived>& x) -> decltype(x.cwiseAbs().eval().square().eval())
101 return x.eval().cwiseAbs().square();
104template < typename Derived>
105auto AbsSqr( const Eigen::MatrixBase<Derived>& x) -> decltype( AbsSqr(x.array()).matrix().eval())
107 return AbsSqr(x.array()).matrix().eval();
112inline double AbsSqrt( double x) noexcept { return std::sqrt(std::abs(x)); }
114inline double AbsSqrt( const std::complex<double>& x) noexcept { return std::sqrt(std::abs(x)); }
116template < typename Derived>
117auto AbsSqrt( const Eigen::ArrayBase<Derived>& x) -> decltype(x.cwiseAbs().cwiseSqrt())
119 return x.cwiseAbs().cwiseSqrt();
122template < typename Derived>
123auto AbsSqrt( const Eigen::MatrixBase<Derived>& x) -> decltype(x.cwiseAbs().cwiseSqrt())
125 return x.cwiseAbs().cwiseSqrt();
130inline double ArcCos( double x) noexcept { return std::acos(x); }
131inline std::complex<double> ArcCos( const std::complex<double>& x) noexcept { return std::acos(x); }
135inline double ArcSin( double x) noexcept { return std::asin(x); }
136inline std::complex<double> ArcSin( const std::complex<double>& x) noexcept { return std::asin(x); }
140inline double ArcTan( double x) noexcept { return std::atan(x); }
141inline std::complex<double> ArcTan( const std::complex<double>& x) noexcept { return std::atan(x); }
145inline double Arg( double x) noexcept { return std::arg(x); }
146inline double Arg( const std::complex<double>& x) noexcept { return std::arg(x); }
150inline double Cbrt( double x) noexcept { return std::cbrt(x); }
154inline int Conj( int x) noexcept { return x; }
155inline long Conj( long x) noexcept { return x; }
156inline long long Conj( long long x) noexcept { return x; }
157inline float Conj( float x) noexcept { return x; }
158inline double Conj( double x) noexcept { return x; }
159inline long double Conj( long double x) noexcept { return x; }
160inline std::complex<float> Conj( const std::complex<float>& x) noexcept { return std::conj(x); }
161inline std::complex<double> Conj( const std::complex<double>& x) noexcept { return std::conj(x); }
162inline std::complex<long double> Conj( const std::complex<long double>& x) noexcept { return std::conj(x); }
164template < typename Derived>
165auto Conj( const Eigen::ArrayBase<Derived>& x) -> decltype(x.conjugate())
167 return x.conjugate();
170template < typename Derived>
171auto Conj( const Eigen::MatrixBase<Derived>& x) -> decltype(x.conjugate())
173 return x.conjugate();
176#define Conjugate(x) Conj(x)
196double Tan( double a) noexcept;
197double Cot( double a) noexcept;
198double Cos( double x) noexcept;
199double Sin( double x) noexcept;
200double Sec( double x) noexcept;
201double Csc( double x) noexcept;
205int Delta( int i, int j) noexcept;
209#define FSFlagProblem(p) [&](){ (p); return 0.; }()
213#define FSFlagWarning(p) [&](){ (p); return 0.; }()
217bool IsClose( double, double, double eps = std::numeric_limits<double>::epsilon()) noexcept;
226bool IsFinite(const std::complex< double>&) noexcept;
228template <class Derived>
233 const auto nr = m.rows();
234 const auto nc = m.cols();
236 for ( int r = 0; r < nr; r++) {
237 for ( int c = 0; c < nc; c++) {
238 if (!std::isfinite(m(r,c))) {
253template < class Derived>
254typename Eigen::MatrixBase<Derived>::PlainObject Diag( const Eigen::MatrixBase<Derived>& m)
256 if (m.rows() != m.cols()) {
257 throw SetupError( "Diag is only defined for squared matrices");
260 typename Eigen::MatrixBase<Derived>::PlainObject diag(m);
262 for (Eigen::Index i = 0; i < m.rows(); ++i) {
263 for (Eigen::Index k = i + 1; k < m.cols(); ++k) {
268 for (Eigen::Index i = 0; i < m.rows(); ++i) {
269 for (Eigen::Index k = 0; k < i; ++k) {
279std::complex<double> ComplexLog( double a) noexcept;
280std::complex<double> ComplexLog( const std::complex<double>& z) noexcept;
294template < typename Derived>
297 if (m.rows() != m.cols()) {
298 throw SetupError( "Hermitianize is only defined for squared matrices");
301 for (Eigen::Index i = 0; i < m.rows(); ++i) {
302 for (Eigen::Index k = 0; k < i; ++k) {
303 m(i,k) = Conj(m(k,i));
312template < typename Pr inter>
313void PrintTo(std::stringstream& ostr, Printer&& printer)
318template < typename Printer, typename T0, typename... Ts>
319void PrintTo(std::stringstream& ostr, Printer&& printer, T0&& v, Ts&&... vs)
322 PrintTo(ostr, printer, std::forward<Ts>(vs)...);
328template< typename... Ts>
331 std::stringstream ss;
332 PrintTo( ss, [] ( const std::string& s) { DEBUG_MSG(s); }, std::forward<Ts>(vs)...);
337template< typename... Ts>
340 std::stringstream ss;
341 PrintTo( ss, [] ( const std::string& s) { ERROR(s); }, std::forward<Ts>(vs)...);
346template< typename... Ts>
349 std::stringstream ss;
350 PrintTo( ss, [] ( const std::string& s) { FATAL(s); }, std::forward<Ts>(vs)...);
355template< typename... Ts>
358 std::stringstream ss;
359 PrintTo( ss, [] ( const std::string& s) { INFO(s); }, std::forward<Ts>(vs)...);
364template< typename... Ts>
367 std::stringstream ss;
368 PrintTo( ss, [] ( const std::string& s) { VERBOSE_MSG(s); }, std::forward<Ts>(vs)...);
373template< typename... Ts>
376 std::stringstream ss;
377 PrintTo( ss, [] ( const std::string& s) { WARNING(s); }, std::forward<Ts>(vs)...);
383double Log( double a) noexcept;
389double MaxRelDiff( const std::complex<double>&, const std::complex<double>&) noexcept;
391template < class Derived>
393 const Eigen::PlainObjectBase<Derived>& b)
394 -> decltype( MaxRelDiff(a.data()[0], b.data()[0]))
396 if (a.rows() != b.rows() || a.cols() != b.cols()) {
397 throw SetupError( "MaxRelDiff: Matrices/Vectors have different size!");
400 using Scalar_t = decltype( MaxRelDiff(a.data()[0], b.data()[0]));
404 for (Eigen::Index i = 0; i < a.size(); i++) {
405 max = std::max(max, MaxRelDiff(a.data()[i], b.data()[i]));
415double MaxAbsValue( const std::complex<double>& x) noexcept;
417template < class Derived>
418auto MaxAbsValue( const Eigen::MatrixBase<Derived>& x) noexcept -> decltype(x.cwiseAbs().maxCoeff())
420 return x.cwiseAbs().maxCoeff();
423template < class Derived>
424auto MaxAbsValue( const Eigen::ArrayBase<Derived>& x) noexcept -> decltype(x.cwiseAbs().maxCoeff())
426 return x.cwiseAbs().maxCoeff();
434 return std::forward<T>(t);
437template< typename T0, typename T1, typename... Ts>
438typename std::common_type<T0, T1, Ts...>::type Max(T0&& val1, T1&& val2, Ts&&... vs) noexcept
441 return Max(val1, std::forward<Ts>(vs)...);
443 return Max(val2, std::forward<Ts>(vs)...);
449 return std::forward<T>(t);
452template< typename T0, typename T1, typename... Ts>
453typename std::common_type<T0, T1, Ts...>::type Min(T0&& val1, T1&& val2, Ts&&... vs) noexcept
456 return Min(val2, std::forward<Ts>(vs)...);
458 return Min(val1, std::forward<Ts>(vs)...);
463int Sign( double x) noexcept;
464int Sign( int x) noexcept;
469double PolyLog( int, double) noexcept;
472std::complex<double> PolyLog( int, const std::complex<double>&) noexcept;
476template < typename Base, typename Exponent>
477Base Power(Base base, Exponent exp) noexcept
479 return std::pow(base, exp);
482template < typename Base>
488template < typename Base>
494template < typename Base>
500template < typename Base>
506template < typename Base>
512template < typename Base>
518template < typename Base>
524template < typename Base>
530template < typename Base>
536template < typename Base>
542template < typename Base>
556double Re( double) noexcept;
558double Re( const std::complex<double>&) noexcept;
560template< class Derived>
561auto Re( const Eigen::MatrixBase<Derived>& x) noexcept -> decltype(x.real().eval())
563 return x.real().eval();
568double Im( double) noexcept;
570double Im( const std::complex<double>&) noexcept;
572template< class Derived>
573auto Im( const Eigen::MatrixBase<Derived>& x) noexcept -> decltype(x.imag().eval())
575 return x.imag().eval();
581T RelDiff(T a, T b, T eps = std::numeric_limits<T>::epsilon()) noexcept
583 const T max = std::max(a, b);
585 if (std::abs(max) < eps)
588 return (a - b) / max;
593int Round( double a) noexcept;
601template < typename Derived>
602auto SignedAbsSqrt( const Eigen::ArrayBase<Derived>& a) noexcept -> typename Derived::PlainObject
604 using Scalar = typename Derived::PlainObject::Scalar;
605 return a.unaryExpr([](Scalar a) -> Scalar { return SignedAbsSqrt(a); });
610template <class T, typename = std::enable_if_t<std::is_floating_point<T>::value,T>>
616template <class T, typename = std::enable_if_t<std::is_integral<T>::value,T>>
619 return std::sqrt( static_cast<double>(a));
623template < typename Derived>
624auto Sqrt( const Eigen::ArrayBase<Derived>& a) noexcept -> typename Derived::PlainObject
626 using Scalar = typename Derived::PlainObject::Scalar;
627 return a.unaryExpr([](Scalar a) -> Scalar { return Sqrt(a); });
633constexpr std::complex<T> Sqr( const std::complex<T>& a) noexcept
638template <typename T, class = std::enable_if_t<std::is_arithmetic<T>::value,T>>
639constexpr T Sqr(T a) noexcept
645template < typename Derived>
646auto Sqr( const Eigen::ArrayBase<Derived>& a) noexcept -> typename Derived::PlainObject
648 using Scalar = typename Derived::PlainObject::Scalar;
649 return a.unaryExpr([](Scalar a) -> Scalar { return Sqr(a); });
653template < typename Derived>
654auto Sqr( const Eigen::MatrixBase<Derived>& a) noexcept -> typename Derived::PlainObject
661#define DEFINE_COMMUTATIVE_OPERATOR_COMPLEX_INT(op) \
662 template <typename T> \
663 std::complex<T> operator op(const std::complex<T>& lhs, int rhs) \
665 return lhs op static_cast<T>(rhs); \
668 template <typename T> \
669 std::complex<T> operator op(int lhs, const std::complex<T>& rhs) \
671 return static_cast<T>(lhs) op rhs; \
685template <typename Derived>
688 if (m.rows() != m.cols()) {
689 throw SetupError( "Symmetrize is only defined for squared matrices");
692 for (Eigen::Index i = 0; i < m.rows(); ++i) {
693 for (Eigen::Index k = 0; k < i; ++k) {
699#define UNITMATRIX(rows) Eigen::Matrix<double,rows,rows>::Identity()
700#define ZEROMATRIX(rows,cols) Eigen::Matrix<double,rows,cols>::Zero()
701#define ZEROTENSOR3(d1,d2,d3) ZeroTensor3<double,d1,d2,d3>()
702#define ZEROTENSOR4(d1,d2,d3,d4) ZeroTensor4<double,d1,d2,d3,d4>()
703#define ZEROVECTOR(rows) Eigen::Matrix<double,rows,1>::Zero()
704#define ZEROARRAY(rows) Eigen::Array<double,rows,1>::Zero()
705#define UNITMATRIXCOMPLEX(rows) Eigen::Matrix<std::complex<double>,rows,rows>::Identity()
706#define ZEROMATRIXCOMPLEX(rows,cols) Eigen::Matrix<std::complex<double>,rows,cols>::Zero()
707#define ZEROVECTORCOMPLEX(rows) Eigen::Matrix<std::complex<double>,rows,1>::Zero()
708#define ZEROTENSOR3COMPLEX(d1,d2,d3) ZeroTensor3<std::complex<double>,d1,d2,d3>()
709#define ZEROTENSOR4COMPLEX(d1,d2,d3,d4) ZeroTensor4<std::complex<double>,d1,d2,d3,d4>()
710#define ZEROARRAYCOMPLEX(rows) Eigen::Array<std::complex<double>,rows,1>::Zero()
714#define PROJECTOR Proj
715#define DEFINE_PROJECTOR(M,N,X,Y) \
716 Eigen::Matrix<double,M,N> Proj(Eigen::Matrix<double,M,N>::Zero()); \
717 Proj((X)-1,(Y)-1) = 1;
725template< class Scalar, int M>
726Eigen::Matrix<Scalar,M,M> ToMatrix( const Eigen::Array<Scalar,M,1>& a) noexcept
728 return Eigen::Matrix<Scalar,M,M>(a.matrix().asDiagonal());
731template< class Scalar, int M, int N>
732Eigen::Matrix<Scalar,M,N> ToMatrix( const Eigen::Matrix<Scalar,M,N>& a) noexcept
742std::string ToString( unsigned short);
745std::string ToString( unsigned long long);
751std::string ToString( signed long long);
754std::string ToString( const std::complex<double>&);
759double Total( double) noexcept;
762std::complex<double> Total( const std::complex<double>&) noexcept;
765template < typename Derived>
766auto Total( const Eigen::DenseBase<Derived>& a) noexcept -> typename Derived::Scalar
774template < int N, int i, typename Scalar = double>
775constexpr auto UnitVector() noexcept -> Eigen::Matrix<Scalar,N,1>
777 return Eigen::Matrix<Scalar,N,1>::Unit(i);
781template < int N, typename Scalar = double>
782constexpr auto UnitVector( int i) noexcept -> Eigen::Matrix<Scalar,N,1>
784 return Eigen::Matrix<Scalar,N,1>::Unit(i);
788Eigen::VectorXd UnitVector( int N, int i) noexcept;
793template < int M, int N, int i, int j, typename Scalar = double>
796 Eigen::Matrix<Scalar,M,N> proj(Eigen::Matrix<Scalar,M,N>::Zero());
803template < int M, int N, typename Scalar = double>
806 Eigen::Matrix<Scalar,M,N> proj(Eigen::Matrix<Scalar,M,N>::Zero());
821 return x < T() ? 0 : 1;
830template < typename Derived>
831Derived ZeroSqrt( const Eigen::ArrayBase<Derived>& m) noexcept
833 return m.unaryExpr([]( double a){ return ZeroSqrt(a); });
838 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)
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
static constexpr double oneLoop
double FSThrow(const std::string &s)
double FiniteLog(double a) noexcept
constexpr auto UnitVector() noexcept -> Eigen::Matrix< Scalar, N, 1 > unit vector of length N into direction i
constexpr Base Power7(Base b) noexcept
double PrintWARNING(Ts &&... vs) print warning to cerr
static constexpr double oneOver4Pi
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)
static constexpr double sqrt2
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
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
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
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
auto MatrixProjector() noexcept -> Eigen::Matrix< Scalar, M, N > matrix projector of size MxN into direction i, j
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
#define DEFINE_COMMUTATIVE_OPERATOR_COMPLEX_INT(op)
|