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_SPARSE_FLAGGED_H
00027 #define EIGEN_SPARSE_FLAGGED_H
00028
00029 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
00030 struct ei_traits<SparseFlagged<ExpressionType, Added, Removed> > : ei_traits<ExpressionType>
00031 {
00032 enum { Flags = (ExpressionType::Flags | Added) & ~Removed };
00033 };
00034
00035 template<typename ExpressionType, unsigned int Added, unsigned int Removed> class SparseFlagged
00036 : public SparseMatrixBase<SparseFlagged<ExpressionType, Added, Removed> >
00037 {
00038 public:
00039
00040 EIGEN_SPARSE_GENERIC_PUBLIC_INTERFACE(SparseFlagged)
00041 class InnerIterator;
00042 class ReverseInnerIterator;
00043
00044 typedef typename ei_meta_if<ei_must_nest_by_value<ExpressionType>::ret,
00045 ExpressionType, const ExpressionType&>::ret ExpressionTypeNested;
00046
00047 inline SparseFlagged(const ExpressionType& matrix) : m_matrix(matrix) {}
00048
00049 inline int rows() const { return m_matrix.rows(); }
00050 inline int cols() const { return m_matrix.cols(); }
00051
00052
00053 inline Scalar& coeffRef(int row, int col)
00054 { return m_matrix.const_cast_derived().coeffRef(col, row); }
00055
00056 inline const Scalar coeff(int row, int col) const
00057 { return m_matrix.coeff(col, row); }
00058
00059 inline const Scalar coeff(int index) const
00060 { return m_matrix.coeff(index); }
00061
00062 inline Scalar& coeffRef(int index)
00063 { return m_matrix.const_cast_derived().coeffRef(index); }
00064
00065 protected:
00066 ExpressionTypeNested m_matrix;
00067
00068 private:
00069 SparseFlagged& operator=(const SparseFlagged&);
00070 };
00071
00072 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
00073 class SparseFlagged<ExpressionType,Added,Removed>::InnerIterator : public ExpressionType::InnerIterator
00074 {
00075 public:
00076 EIGEN_STRONG_INLINE InnerIterator(const SparseFlagged& xpr, int outer)
00077 : ExpressionType::InnerIterator(xpr.m_matrix, outer)
00078 {}
00079
00080 private:
00081 InnerIterator& operator=(const InnerIterator&);
00082 };
00083
00084 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
00085 class SparseFlagged<ExpressionType,Added,Removed>::ReverseInnerIterator : public ExpressionType::ReverseInnerIterator
00086 {
00087 public:
00088
00089 EIGEN_STRONG_INLINE ReverseInnerIterator(const SparseFlagged& xpr, int outer)
00090 : ExpressionType::ReverseInnerIterator(xpr.m_matrix, outer)
00091 {}
00092 };
00093
00094 template<typename Derived>
00095 template<unsigned int Added>
00096 inline const SparseFlagged<Derived, Added, 0>
00097 SparseMatrixBase<Derived>::marked() const
00098 {
00099 return derived();
00100 }
00101
00102 #endif // EIGEN_SPARSE_FLAGGED_H