Grid icon indicating copy to clipboard operation
Grid copied to clipboard

Ambigous overload of Lattice+Scalar operators

Open krox opened this issue 6 years ago • 0 comments

The function

void foo(LatticeColourMatrix& field)
{
    ColourMatrix avg = sum(field) * (1.0 / field._grid->gSites());
    field = field - avg;
}

does not compile due to an ambigous overload https://github.com/paboyle/Grid/blob/e37614bde4aaf0822f00306cf766bb02b1a6b50a/Grid/tensors/Tensor_arith_scalar.h#L207 and https://github.com/paboyle/Grid/blob/e37614bde4aaf0822f00306cf766bb02b1a6b50a/Grid/tensors/Tensor_arith_scalar.h#L212

I tested it with both clang 6.0 and gcc 7.3 on my local machine (--enable-simd=AVX2 --enable-comms=none). It is worth noting that only + and - have this problem. * works fine.

krox avatar Feb 19 '19 14:02 krox