Add evaluator for Ref

This commit is contained in:
Gael Guennebaud 2014-02-18 13:30:16 +01:00
parent a08cba6b5f
commit 1b5de5a37b

View File

@ -587,7 +587,7 @@ struct evaluator<MapBase<Derived, AccessorsType> >
CoeffReturnType coeff(Index index) const CoeffReturnType coeff(Index index) const
{ {
return coeff(RowsAtCompileTime == 1 ? 0 : index, return coeff(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0); RowsAtCompileTime == 1 ? index : 0);
} }
Scalar& coeffRef(Index row, Index col) Scalar& coeffRef(Index row, Index col)
@ -598,7 +598,7 @@ struct evaluator<MapBase<Derived, AccessorsType> >
Scalar& coeffRef(Index index) Scalar& coeffRef(Index index)
{ {
return coeffRef(RowsAtCompileTime == 1 ? 0 : index, return coeffRef(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0); RowsAtCompileTime == 1 ? index : 0);
} }
template<int LoadMode> template<int LoadMode>
@ -612,7 +612,7 @@ struct evaluator<MapBase<Derived, AccessorsType> >
PacketReturnType packet(Index index) const PacketReturnType packet(Index index) const
{ {
return packet<LoadMode>(RowsAtCompileTime == 1 ? 0 : index, return packet<LoadMode>(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0); RowsAtCompileTime == 1 ? index : 0);
} }
template<int StoreMode> template<int StoreMode>
@ -626,8 +626,8 @@ struct evaluator<MapBase<Derived, AccessorsType> >
void writePacket(Index index, const PacketScalar& x) void writePacket(Index index, const PacketScalar& x)
{ {
return writePacket<StoreMode>(RowsAtCompileTime == 1 ? 0 : index, return writePacket<StoreMode>(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0, RowsAtCompileTime == 1 ? index : 0,
x); x);
} }
protected: protected:
@ -647,6 +647,19 @@ struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
{ } { }
}; };
// -------------------- Ref --------------------
template<typename PlainObjectType, int RefOptions, typename StrideType>
struct evaluator<Ref<PlainObjectType, RefOptions, StrideType> >
: public evaluator<MapBase<Ref<PlainObjectType, RefOptions, StrideType> > >
{
typedef Ref<PlainObjectType, RefOptions, StrideType> XprType;
evaluator(const XprType& map)
: evaluator<MapBase<XprType> >(map)
{ }
};
// -------------------- Block -------------------- // -------------------- Block --------------------
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel, template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel,