28#ifndef GRID_MATH_EXP_H
29#define GRID_MATH_EXP_H
31#define DEFAULT_MAT_EXP 20
50 for (
int i = 0; i < N; i++)
58template<class vtype, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0>
::type * =
nullptr>
69 const Complex one_over_three = 1.0 / 3.0;
70 const Complex one_over_two = 1.0 / 2.0;
72 scalar c0, c1, tmp, c0max, theta, u, w;
73 scalar xi0, u2, w2, cosw;
74 scalar fden, h0, h1, h2;
75 scalar e2iu, emiu, ixi0;
79 mat iQ2 = arg*arg*alpha*alpha;
80 mat iQ3 = arg*iQ2*alpha;
85 c0 = -imQ3 * one_over_three;
86 c1 = -reQ2 * one_over_two;
89 tmp = c1 * one_over_three;
90 c0max = 2.0 *
pow(tmp, 1.5);
92 theta =
acos(c0 / c0max) * one_over_three;
105 h0 = e2iu * (u2 - w2) +
106 emiu * ((8.0 * u2 * cosw) + (2.0 * u * (3.0 * u2 + w2) * ixi0));
107 h1 = e2iu * (2.0 * u) - emiu * ((2.0 * u * cosw) - (3.0 * u2 - w2) * ixi0);
108 h2 = e2iu - emiu * (cosw + (3.0 * u) * ixi0);
110 fden = unity / (9.0 * u2 - w2);
115 return (f0 * unit +
timesMinusI(f1) * arg*alpha - f2 * iQ2);
121template<class vtype,int N, typename std::enable_if< GridTypeMapper<vtype>::TensorLevel == 0 >
::type * =
nullptr>
131 for(
int i=Nexp; i>=1;--i){
132 temp *= alpha/
RealD(i);
133 temp = unit + temp*arg;
#define accelerator_inline
accelerator_inline void timesMinusI(Grid_simd2< S, V > &ret, const Grid_simd2< S, V > &in)
accelerator_inline void timesI(Grid_simd2< S, V > &ret, const Grid_simd2< S, V > &in)
accelerator_inline Grid_simd2< S, V > trace(const Grid_simd2< S, V > &arg)
accelerator_inline Grid_simd< S, V > cos(const Grid_simd< S, V > &r)
accelerator_inline Grid_simd< S, V > sin(const Grid_simd< S, V > &r)
accelerator_inline Grid_simd< S, V > acos(const Grid_simd< S, V > &r)
accelerator_inline Grid_simd< S, V > sqrt(const Grid_simd< S, V > &r)
Lattice< vobj > real(const Lattice< vobj > &lhs)
Lattice< vobj > imag(const Lattice< vobj > &lhs)
Lattice< obj > pow(const Lattice< obj > &rhs_i, RealD y)
#define NAMESPACE_BEGIN(A)
std::complex< Real > Complex
accelerator_inline iScalar< vtype > Exponentiate(const iScalar< vtype > &r, RealD alpha, Integer Nexp=DEFAULT_MAT_EXP)