Grid
Grid copied to clipboard
Ambigous overload of Lattice+Scalar operators
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.