Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef EIGEN_NESTBYVALUE_H
00027 #define EIGEN_NESTBYVALUE_H
00028
00029 namespace Eigen {
00030
00044 namespace internal {
00045 template<typename ExpressionType>
00046 struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
00047 {};
00048 }
00049
00050 template<typename ExpressionType> class NestByValue
00051 : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
00052 {
00053 public:
00054
00055 typedef typename internal::dense_xpr_base<NestByValue>::type Base;
00056 EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
00057
00058 inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
00059
00060 inline Index rows() const { return m_expression.rows(); }
00061 inline Index cols() const { return m_expression.cols(); }
00062 inline Index outerStride() const { return m_expression.outerStride(); }
00063 inline Index innerStride() const { return m_expression.innerStride(); }
00064
00065 inline const CoeffReturnType coeff(Index row, Index col) const
00066 {
00067 return m_expression.coeff(row, col);
00068 }
00069
00070 inline Scalar& coeffRef(Index row, Index col)
00071 {
00072 return m_expression.const_cast_derived().coeffRef(row, col);
00073 }
00074
00075 inline const CoeffReturnType coeff(Index index) const
00076 {
00077 return m_expression.coeff(index);
00078 }
00079
00080 inline Scalar& coeffRef(Index index)
00081 {
00082 return m_expression.const_cast_derived().coeffRef(index);
00083 }
00084
00085 template<int LoadMode>
00086 inline const PacketScalar packet(Index row, Index col) const
00087 {
00088 return m_expression.template packet<LoadMode>(row, col);
00089 }
00090
00091 template<int LoadMode>
00092 inline void writePacket(Index row, Index col, const PacketScalar& x)
00093 {
00094 m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
00095 }
00096
00097 template<int LoadMode>
00098 inline const PacketScalar packet(Index index) const
00099 {
00100 return m_expression.template packet<LoadMode>(index);
00101 }
00102
00103 template<int LoadMode>
00104 inline void writePacket(Index index, const PacketScalar& x)
00105 {
00106 m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
00107 }
00108
00109 operator const ExpressionType&() const { return m_expression; }
00110
00111 protected:
00112 const ExpressionType m_expression;
00113 };
00114
00117 template<typename Derived>
00118 inline const NestByValue<Derived>
00119 DenseBase<Derived>::nestByValue() const
00120 {
00121 return NestByValue<Derived>(derived());
00122 }
00123
00124 }
00125
00126 #endif // EIGEN_NESTBYVALUE_H