6 #define Pi2 6.2831853071795864769252867665590 12 template <
typename Float,
typename Gauge,
bool density_ = false>
struct QChargeArg :
public ReduceArg<double> {
21 threads(Fmunu.VolumeCB()),
30 int x_cb = threadIdx.x + blockIdx.x * blockDim.x;
35 while (x_cb < arg.threads) {
37 Matrix<complex<Float>, 3> F[] = {arg.data(0, x_cb, parity), arg.data(1, x_cb, parity), arg.data(2, x_cb, parity),
38 arg.data(3, x_cb, parity), arg.data(4, x_cb, parity), arg.data(5, x_cb, parity)};
40 double Q1 =
getTrace(F[0] * F[5]).real();
41 double Q2 =
getTrace(F[1] * F[4]).real();
42 double Q3 =
getTrace(F[3] * F[2]).real();
43 double Q_idx = (Q1 + Q3 - Q2);
47 int idx = x_cb + parity * arg.threads;
48 arg.qDensity[idx] = Q_idx / (
Pi2 *
Pi2);
50 x_cb += blockDim.x * gridDim.x;
54 reduce2d<blockSize, 2>(
arg, Q);
QChargeArg(const Gauge &data, const GaugeField &Fmunu, Float *qDensity=nullptr)
static constexpr bool density
__global__ void qChargeComputeKernel(Arg arg)
Main header file for host and device accessors to GaugeFields.
__device__ __host__ T getTrace(const Matrix< T, 3 > &a)
__host__ __device__ ValueType arg(const complex< ValueType > &z)
Returns the phase angle of z.