21 computeTraceLog(computeTraceLog),
22 twist(field.Twisted()),
32 template <
typename Float,
typename Arg,
bool computeTrLog,
bool twist>
37 constexpr
int nSpin = 4;
38 constexpr
int N = nColor * nSpin / 2;
42 for (
int ch = 0; ch < 2; ch++) {
43 Mat A = arg.clover(x_cb, parity, ch);
44 A *=
static_cast<Float
>(2.0);
56 for (
int j = 0; j < N; j++) trlogA += 2.0 *
log(cholesky.
D(j));
58 Mat Ainv =
static_cast<Float
>(0.5) * cholesky.
invert();
59 arg.inverse(x_cb, parity, ch) = Ainv;
65 template <
typename Float,
typename Arg,
bool computeTrLog,
bool twist>
void cloverInvert(
Arg &
arg)
68 for (
int x = 0; x < arg.clover.
volumeCB; x++) {
70 double trlogA = cloverInvertCompute<Float, Arg, computeTrLog, twist>(
arg, x,
parity);
73 arg.result_h[0].y += trlogA;
75 arg.result_h[0].x += trlogA;
81 template <
int blockSize,
typename Float,
typename Arg,
bool computeTrLog,
bool twist>
84 int idx = blockIdx.x * blockDim.x + threadIdx.x;
86 double2 trlogA = make_double2(0.0, 0.0);
87 double trlogA_parity = 0.0;
89 trlogA_parity = cloverInvertCompute<Float, Arg, computeTrLog, twist>(
arg, idx,
parity);
90 trlogA = parity ? make_double2(0.0, trlogA.y + trlogA_parity) : make_double2(trlogA.x + trlogA_parity, 0.0);
91 idx += blockDim.x * gridDim.x;
93 if (computeTrLog) reduce2d<blockSize, 2>(
arg, trlogA);
__device__ __host__ const T D(int i) const
Return the diagonal element of the Cholesky decomposition L(i,i)
Compute Cholesky decomposition of A. By default, we use a modified Cholesky which avoids the division...
__device__ __host__ double cloverInvertCompute(Arg &arg, int x_cb, int parity)
void Mat(sFloat *out, gFloat **link, sFloat *in, int daggerBit, int mu)
QudaCloverFieldOrder Order() const
Main header file for host and device accessors to CloverFields.
void cloverInvert(CloverField &clover, bool computeTraceLog)
This function compute the Cholesky decomposition of each clover matrix and stores the clover inverse ...
CloverInvertArg(CloverField &field, bool computeTraceLog=0)
Specialized container for Hermitian matrices (e.g., used for wrapping clover matrices) ...
__global__ void cloverInvertKernel(Arg arg)
__host__ __device__ ValueType log(ValueType x)
__device__ __host__ Mat< T, N > invert()
Compute the inverse of A (the matrix used to construct the Cholesky decomposition).
__host__ __device__ ValueType arg(const complex< ValueType > &z)
Returns the phase angle of z.
clover_mapper< Float >::type C