Disable testing of complex compound assignment operators for MSVC.

MSVC does not support specializing compound assignments for
`std::complex`, since it already specializes them (contrary to the
standard).

Trying to use one of these on device will currently lead to a
duplicate definition error.  This is still probably preferable
to no error though.  If we remove the definitions for MSVC, then
it will compile, but the kernel will fail silently.

The only proper solution would be to define our own custom `Complex`
type.

(cherry picked from commit f0f1d7938b)
This commit is contained in:
Antonio Sanchez
2021-09-27 15:03:24 -07:00
parent 7ea4adb5f0
commit 943ef50a2d
2 changed files with 16 additions and 1 deletions

View File

@@ -138,10 +138,12 @@ struct complex_operators {
out[out_idx++] = a / numext::real(b);
out[out_idx++] = numext::real(a) / b;
#if !defined(EIGEN_COMP_MSVC)
out[out_idx] = a; out[out_idx++] += b;
out[out_idx] = a; out[out_idx++] -= b;
out[out_idx] = a; out[out_idx++] *= b;
out[out_idx] = a; out[out_idx++] /= b;
#endif
const ComplexType true_value = ComplexType(ValueType(1), ValueType(0));
const ComplexType false_value = ComplexType(ValueType(0), ValueType(0));
@@ -188,6 +190,7 @@ struct complex_operators {
res.segment(block_idx, size) = x1.real().array() / x2.array();
block_idx += size;
#if !defined(EIGEN_COMP_MSVC)
res.segment(block_idx, size) = x1; res.segment(block_idx, size) += x2;
block_idx += size;
res.segment(block_idx, size) = x1; res.segment(block_idx, size) -= x2;
@@ -196,6 +199,7 @@ struct complex_operators {
block_idx += size;
res.segment(block_idx, size) = x1; res.segment(block_idx, size).array() /= x2.array();
block_idx += size;
#endif
const T true_vector = T::Constant(true_value);
const T false_vector = T::Constant(false_value);