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
00040 template<typename ExpressionType>
00041 struct ei_traits<NestByValue<ExpressionType> > : public ei_traits<ExpressionType>
00042 {};
00043
00044 template<typename ExpressionType> class NestByValue
00045 : public MatrixBase<NestByValue<ExpressionType> >
00046 {
00047 public:
00048
00049 EIGEN_GENERIC_PUBLIC_INTERFACE(NestByValue)
00050
00051 inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
00052
00053 inline int rows() const { return m_expression.rows(); }
00054 inline int cols() const { return m_expression.cols(); }
00055 inline int stride() const { return m_expression.stride(); }
00056
00057 inline const Scalar coeff(int row, int col) const
00058 {
00059 return m_expression.coeff(row, col);
00060 }
00061
00062 inline Scalar& coeffRef(int row, int col)
00063 {
00064 return m_expression.const_cast_derived().coeffRef(row, col);
00065 }
00066
00067 inline const Scalar coeff(int index) const
00068 {
00069 return m_expression.coeff(index);
00070 }
00071
00072 inline Scalar& coeffRef(int index)
00073 {
00074 return m_expression.const_cast_derived().coeffRef(index);
00075 }
00076
00077 template<int LoadMode>
00078 inline const PacketScalar packet(int row, int col) const
00079 {
00080 return m_expression.template packet<LoadMode>(row, col);
00081 }
00082
00083 template<int LoadMode>
00084 inline void writePacket(int row, int col, const PacketScalar& x)
00085 {
00086 m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
00087 }
00088
00089 template<int LoadMode>
00090 inline const PacketScalar packet(int index) const
00091 {
00092 return m_expression.template packet<LoadMode>(index);
00093 }
00094
00095 template<int LoadMode>
00096 inline void writePacket(int index, const PacketScalar& x)
00097 {
00098 m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
00099 }
00100
00101 protected:
00102 const ExpressionType m_expression;
00103
00104 private:
00105 NestByValue& operator=(const NestByValue&);
00106 };
00107
00110 template<typename Derived>
00111 inline const NestByValue<Derived>
00112 MatrixBase<Derived>::nestByValue() const
00113 {
00114 return NestByValue<Derived>(derived());
00115 }
00116
00117 #endif // EIGEN_NESTBYVALUE_H