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 #ifndef EIGEN_FLAGGED_H
00026 #define EIGEN_FLAGGED_H
00027
00044 namespace internal {
00045 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
00046 struct traits<Flagged<ExpressionType, Added, Removed> > : traits<ExpressionType>
00047 {
00048 enum { Flags = (ExpressionType::Flags | Added) & ~Removed };
00049 };
00050 }
00051
00052 template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged
00053 : public MatrixBase<Flagged<ExpressionType, Added, Removed> >
00054 {
00055 public:
00056
00057 typedef MatrixBase<Flagged> Base;
00058
00059 EIGEN_DENSE_PUBLIC_INTERFACE(Flagged)
00060 typedef typename internal::conditional<internal::must_nest_by_value<ExpressionType>::ret,
00061 ExpressionType, const ExpressionType&>::type ExpressionTypeNested;
00062 typedef typename ExpressionType::InnerIterator InnerIterator;
00063
00064 inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {}
00065
00066 inline Index rows() const { return m_matrix.rows(); }
00067 inline Index cols() const { return m_matrix.cols(); }
00068 inline Index outerStride() const { return m_matrix.outerStride(); }
00069 inline Index innerStride() const { return m_matrix.innerStride(); }
00070
00071 inline CoeffReturnType coeff(Index row, Index col) const
00072 {
00073 return m_matrix.coeff(row, col);
00074 }
00075
00076 inline CoeffReturnType coeff(Index index) const
00077 {
00078 return m_matrix.coeff(index);
00079 }
00080
00081 inline const Scalar& coeffRef(Index row, Index col) const
00082 {
00083 return m_matrix.const_cast_derived().coeffRef(row, col);
00084 }
00085
00086 inline const Scalar& coeffRef(Index index) const
00087 {
00088 return m_matrix.const_cast_derived().coeffRef(index);
00089 }
00090
00091 inline Scalar& coeffRef(Index row, Index col)
00092 {
00093 return m_matrix.const_cast_derived().coeffRef(row, col);
00094 }
00095
00096 inline Scalar& coeffRef(Index index)
00097 {
00098 return m_matrix.const_cast_derived().coeffRef(index);
00099 }
00100
00101 template<int LoadMode>
00102 inline const PacketScalar packet(Index row, Index col) const
00103 {
00104 return m_matrix.template packet<LoadMode>(row, col);
00105 }
00106
00107 template<int LoadMode>
00108 inline void writePacket(Index row, Index col, const PacketScalar& x)
00109 {
00110 m_matrix.const_cast_derived().template writePacket<LoadMode>(row, col, x);
00111 }
00112
00113 template<int LoadMode>
00114 inline const PacketScalar packet(Index index) const
00115 {
00116 return m_matrix.template packet<LoadMode>(index);
00117 }
00118
00119 template<int LoadMode>
00120 inline void writePacket(Index index, const PacketScalar& x)
00121 {
00122 m_matrix.const_cast_derived().template writePacket<LoadMode>(index, x);
00123 }
00124
00125 const ExpressionType& _expression() const { return m_matrix; }
00126
00127 template<typename OtherDerived>
00128 typename ExpressionType::PlainObject solveTriangular(const MatrixBase<OtherDerived>& other) const;
00129
00130 template<typename OtherDerived>
00131 void solveTriangularInPlace(const MatrixBase<OtherDerived>& other) const;
00132
00133 protected:
00134 ExpressionTypeNested m_matrix;
00135 };
00136
00143 template<typename Derived>
00144 template<unsigned int Added,unsigned int Removed>
00145 inline const Flagged<Derived, Added, Removed>
00146 DenseBase<Derived>::flagged() const
00147 {
00148 return derived();
00149 }
00150
00151 #endif // EIGEN_FLAGGED_H