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