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 #ifndef EIGEN_FLAGGED_H
00026 #define EIGEN_FLAGGED_H
00027
00042 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
00043 struct ei_traits<Flagged<ExpressionType, Added, Removed> > : ei_traits<ExpressionType>
00044 {
00045 enum { Flags = (ExpressionType::Flags | Added) & ~Removed };
00046 };
00047
00048 template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged
00049 : public MatrixBase<Flagged<ExpressionType, Added, Removed> >
00050 {
00051 public:
00052
00053 EIGEN_GENERIC_PUBLIC_INTERFACE(Flagged)
00054 typedef typename ei_meta_if<ei_must_nest_by_value<ExpressionType>::ret,
00055 ExpressionType, const ExpressionType&>::ret ExpressionTypeNested;
00056 typedef typename ExpressionType::InnerIterator InnerIterator;
00057
00058 inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {}
00059
00060 inline int rows() const { return m_matrix.rows(); }
00061 inline int cols() const { return m_matrix.cols(); }
00062 inline int stride() const { return m_matrix.stride(); }
00063
00064 inline const Scalar coeff(int row, int col) const
00065 {
00066 return m_matrix.coeff(row, col);
00067 }
00068
00069 inline Scalar& coeffRef(int row, int col)
00070 {
00071 return m_matrix.const_cast_derived().coeffRef(row, col);
00072 }
00073
00074 inline const Scalar coeff(int index) const
00075 {
00076 return m_matrix.coeff(index);
00077 }
00078
00079 inline Scalar& coeffRef(int index)
00080 {
00081 return m_matrix.const_cast_derived().coeffRef(index);
00082 }
00083
00084 template<int LoadMode>
00085 inline const PacketScalar packet(int row, int col) const
00086 {
00087 return m_matrix.template packet<LoadMode>(row, col);
00088 }
00089
00090 template<int LoadMode>
00091 inline void writePacket(int row, int col, const PacketScalar& x)
00092 {
00093 m_matrix.const_cast_derived().template writePacket<LoadMode>(row, col, x);
00094 }
00095
00096 template<int LoadMode>
00097 inline const PacketScalar packet(int index) const
00098 {
00099 return m_matrix.template packet<LoadMode>(index);
00100 }
00101
00102 template<int LoadMode>
00103 inline void writePacket(int index, const PacketScalar& x)
00104 {
00105 m_matrix.const_cast_derived().template writePacket<LoadMode>(index, x);
00106 }
00107
00108 const ExpressionType& _expression() const { return m_matrix; }
00109
00110 protected:
00111 ExpressionTypeNested m_matrix;
00112
00113 private:
00114 Flagged& operator=(const Flagged&);
00115 };
00116
00126 template<typename Derived>
00127 template<unsigned int Added>
00128 inline const Flagged<Derived, Added, 0>
00129 MatrixBase<Derived>::marked() const
00130 {
00131 return derived();
00132 }
00133
00142 template<typename Derived>
00143 inline const Flagged<Derived, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit>
00144 MatrixBase<Derived>::lazy() const
00145 {
00146 return derived();
00147 }
00148
00149 #endif // EIGEN_FLAGGED_H