Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef EIGEN_NESTBYVALUE_H
00012 #define EIGEN_NESTBYVALUE_H
00013
00014 namespace Eigen {
00015
00029 namespace internal {
00030 template<typename ExpressionType>
00031 struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
00032 {};
00033 }
00034
00035 template<typename ExpressionType> class NestByValue
00036 : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
00037 {
00038 public:
00039
00040 typedef typename internal::dense_xpr_base<NestByValue>::type Base;
00041 EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
00042
00043 inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
00044
00045 inline Index rows() const { return m_expression.rows(); }
00046 inline Index cols() const { return m_expression.cols(); }
00047 inline Index outerStride() const { return m_expression.outerStride(); }
00048 inline Index innerStride() const { return m_expression.innerStride(); }
00049
00050 inline const CoeffReturnType coeff(Index row, Index col) const
00051 {
00052 return m_expression.coeff(row, col);
00053 }
00054
00055 inline Scalar& coeffRef(Index row, Index col)
00056 {
00057 return m_expression.const_cast_derived().coeffRef(row, col);
00058 }
00059
00060 inline const CoeffReturnType coeff(Index index) const
00061 {
00062 return m_expression.coeff(index);
00063 }
00064
00065 inline Scalar& coeffRef(Index index)
00066 {
00067 return m_expression.const_cast_derived().coeffRef(index);
00068 }
00069
00070 template<int LoadMode>
00071 inline const PacketScalar packet(Index row, Index col) const
00072 {
00073 return m_expression.template packet<LoadMode>(row, col);
00074 }
00075
00076 template<int LoadMode>
00077 inline void writePacket(Index row, Index col, const PacketScalar& x)
00078 {
00079 m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
00080 }
00081
00082 template<int LoadMode>
00083 inline const PacketScalar packet(Index index) const
00084 {
00085 return m_expression.template packet<LoadMode>(index);
00086 }
00087
00088 template<int LoadMode>
00089 inline void writePacket(Index index, const PacketScalar& x)
00090 {
00091 m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
00092 }
00093
00094 operator const ExpressionType&() const { return m_expression; }
00095
00096 protected:
00097 const ExpressionType m_expression;
00098 };
00099
00102 template<typename Derived>
00103 inline const NestByValue<Derived>
00104 DenseBase<Derived>::nestByValue() const
00105 {
00106 return NestByValue<Derived>(derived());
00107 }
00108
00109 }
00110
00111 #endif // EIGEN_NESTBYVALUE_H