mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Make TernarySelectOp immune to const differences.
See merge request libeigen/eigen!2058 Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
This commit is contained in:
@@ -21,7 +21,8 @@ namespace internal {
|
||||
|
||||
template <typename ThenScalar, typename ElseScalar, typename ConditionScalar>
|
||||
struct scalar_boolean_select_op {
|
||||
static constexpr bool ThenElseAreSame = is_same<ThenScalar, ElseScalar>::value;
|
||||
static constexpr bool ThenElseAreSame =
|
||||
is_same<std::remove_const_t<ThenScalar>, std::remove_const_t<ElseScalar>>::value;
|
||||
EIGEN_STATIC_ASSERT(ThenElseAreSame, THEN AND ELSE MUST BE SAME TYPE)
|
||||
using Scalar = ThenScalar;
|
||||
using result_type = Scalar;
|
||||
|
||||
@@ -789,7 +789,7 @@ struct TensorEvaluator<const TensorSelectOp<IfArgType, ThenArgType, ElseArgType>
|
||||
|
||||
template <int LoadMode, bool UseTernary = TernaryPacketAccess, std::enable_if_t<!UseTernary, bool> = true>
|
||||
EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const {
|
||||
Scalar arr[PacketSize];
|
||||
std::remove_const_t<Scalar> arr[PacketSize];
|
||||
EIGEN_UNROLL_LOOP
|
||||
for (Index i = 0; i < PacketSize; ++i) {
|
||||
arr[i] = m_condImpl.coeff(index + i) ? Scalar(-1) : Scalar(0);
|
||||
|
||||
Reference in New Issue
Block a user