Fixed a bug in the tensor type converter

This commit is contained in:
Benoit Steiner 2016-02-19 15:03:26 +00:00
parent ac5d706a94
commit cd042dbbfd

View File

@ -124,9 +124,12 @@ struct PacketConverter<TensorEvaluator, SrcPacket, TgtPacket, 1, 2> {
return internal::pcast<SrcPacket, TgtPacket>(m_impl.template packet<Unaligned>(index)); return internal::pcast<SrcPacket, TgtPacket>(m_impl.template packet<Unaligned>(index));
} else { } else {
const int TgtPacketSize = internal::unpacket_traits<TgtPacket>::size; const int TgtPacketSize = internal::unpacket_traits<TgtPacket>::size;
typedef typename internal::unpacket_traits<SrcPacket>::type SrcType;
typedef typename internal::unpacket_traits<TgtPacket>::type TgtType;
internal::scalar_cast_op<SrcType, TgtType> converter;
EIGEN_ALIGN_MAX typename internal::unpacket_traits<TgtPacket>::type values[TgtPacketSize]; EIGEN_ALIGN_MAX typename internal::unpacket_traits<TgtPacket>::type values[TgtPacketSize];
for (int i = 0; i < TgtPacketSize; ++i) { for (int i = 0; i < TgtPacketSize; ++i) {
values[i] = m_impl.coeff(index+i); values[i] = converter(m_impl.coeff(index+i));
} }
TgtPacket rslt = internal::pload<TgtPacket>(values); TgtPacket rslt = internal::pload<TgtPacket>(values);
return rslt; return rslt;