mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
make sure the correct diagoanl() function is called in trace()
This commit is contained in:
parent
73eb0e633c
commit
52167be4c8
@ -49,7 +49,7 @@ private:
|
||||
MightVectorize = (int(Derived::Flags)&ActualPacketAccessBit)
|
||||
&& (ei_functor_traits<Func>::PacketAccess),
|
||||
MayLinearVectorize = MightVectorize && (int(Derived::Flags)&LinearAccessBit),
|
||||
MaySliceVectorize = MightVectorize && int(InnerMaxSize)>=3*PacketSize
|
||||
MaySliceVectorize = MightVectorize && int(InnerMaxSize)>=3*PacketSize
|
||||
};
|
||||
|
||||
public:
|
||||
@ -58,7 +58,7 @@ public:
|
||||
: int(MaySliceVectorize) ? int(SliceVectorizedTraversal)
|
||||
: int(DefaultTraversal)
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
enum {
|
||||
Cost = Derived::SizeAtCompileTime * Derived::CoeffReadCost
|
||||
@ -123,7 +123,7 @@ struct ei_redux_novec_unroller<Func, Derived, Start, 0>
|
||||
};
|
||||
|
||||
/*** vectorization ***/
|
||||
|
||||
|
||||
template<typename Func, typename Derived, int Start, int Length>
|
||||
struct ei_redux_vec_unroller
|
||||
{
|
||||
@ -223,7 +223,7 @@ struct ei_redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
|
||||
for(int index = alignedStart + packetSize; index < alignedEnd; index += packetSize)
|
||||
packet_res = func.packetOp(packet_res, mat.template packet<alignment>(index));
|
||||
res = func.predux(packet_res);
|
||||
|
||||
|
||||
for(int index = 0; index < alignedStart; ++index)
|
||||
res = func(res,mat.coeff(index));
|
||||
|
||||
@ -265,7 +265,7 @@ struct ei_redux_impl<Func, Derived, SliceVectorizedTraversal, NoUnrolling>
|
||||
for(int i=0; i<packetedInnerSize; i+=int(packetSize))
|
||||
packet_res = func.packetOp(packet_res, mat.template packet<Unaligned>
|
||||
(isRowMajor?j:i, isRowMajor?i:j));
|
||||
|
||||
|
||||
res = func.predux(packet_res);
|
||||
for(int j=0; j<outerSize; ++j)
|
||||
for(int i=packetedInnerSize; i<innerSize; ++i)
|
||||
@ -382,7 +382,7 @@ template<typename Derived>
|
||||
EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar
|
||||
MatrixBase<Derived>::trace() const
|
||||
{
|
||||
return diagonal().sum();
|
||||
return derived().diagonal().sum();
|
||||
}
|
||||
|
||||
#endif // EIGEN_REDUX_H
|
||||
|
Loading…
Reference in New Issue
Block a user