Flagged.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_FLAGGED_H
00011 #define EIGEN_FLAGGED_H
00012 
00013 namespace Eigen { 
00014 
00031 namespace internal {
00032 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
00033 struct traits<Flagged<ExpressionType, Added, Removed> > : traits<ExpressionType>
00034 {
00035   enum { Flags = (ExpressionType::Flags | Added) & ~Removed };
00036 };
00037 }
00038 
00039 template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged
00040   : public MatrixBase<Flagged<ExpressionType, Added, Removed> >
00041 {
00042   public:
00043 
00044     typedef MatrixBase<Flagged> Base;
00045     
00046     EIGEN_DENSE_PUBLIC_INTERFACE(Flagged)
00047     typedef typename internal::conditional<internal::must_nest_by_value<ExpressionType>::ret,
00048         ExpressionType, const ExpressionType&>::type ExpressionTypeNested;
00049     typedef typename ExpressionType::InnerIterator InnerIterator;
00050 
00051     inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {}
00052 
00053     inline Index rows() const { return m_matrix.rows(); }
00054     inline Index cols() const { return m_matrix.cols(); }
00055     inline Index outerStride() const { return m_matrix.outerStride(); }
00056     inline Index innerStride() const { return m_matrix.innerStride(); }
00057 
00058     inline CoeffReturnType coeff(Index row, Index col) const
00059     {
00060       return m_matrix.coeff(row, col);
00061     }
00062 
00063     inline CoeffReturnType coeff(Index index) const
00064     {
00065       return m_matrix.coeff(index);
00066     }
00067     
00068     inline const Scalar& coeffRef(Index row, Index col) const
00069     {
00070       return m_matrix.const_cast_derived().coeffRef(row, col);
00071     }
00072 
00073     inline const Scalar& coeffRef(Index index) const
00074     {
00075       return m_matrix.const_cast_derived().coeffRef(index);
00076     }
00077 
00078     inline Scalar& coeffRef(Index row, Index col)
00079     {
00080       return m_matrix.const_cast_derived().coeffRef(row, col);
00081     }
00082 
00083     inline Scalar& coeffRef(Index index)
00084     {
00085       return m_matrix.const_cast_derived().coeffRef(index);
00086     }
00087 
00088     template<int LoadMode>
00089     inline const PacketScalar packet(Index row, Index col) const
00090     {
00091       return m_matrix.template packet<LoadMode>(row, col);
00092     }
00093 
00094     template<int LoadMode>
00095     inline void writePacket(Index row, Index col, const PacketScalar& x)
00096     {
00097       m_matrix.const_cast_derived().template writePacket<LoadMode>(row, col, x);
00098     }
00099 
00100     template<int LoadMode>
00101     inline const PacketScalar packet(Index index) const
00102     {
00103       return m_matrix.template packet<LoadMode>(index);
00104     }
00105 
00106     template<int LoadMode>
00107     inline void writePacket(Index index, const PacketScalar& x)
00108     {
00109       m_matrix.const_cast_derived().template writePacket<LoadMode>(index, x);
00110     }
00111 
00112     const ExpressionType& _expression() const { return m_matrix; }
00113 
00114     template<typename OtherDerived>
00115     typename ExpressionType::PlainObject solveTriangular(const MatrixBase<OtherDerived>& other) const;
00116 
00117     template<typename OtherDerived>
00118     void solveTriangularInPlace(const MatrixBase<OtherDerived>& other) const;
00119 
00120   protected:
00121     ExpressionTypeNested m_matrix;
00122 };
00123 
00130 template<typename Derived>
00131 template<unsigned int Added,unsigned int Removed>
00132 inline const Flagged<Derived, Added, Removed>
00133 DenseBase<Derived>::flagged() const
00134 {
00135   return derived();
00136 }
00137 
00138 } // end namespace Eigen
00139 
00140 #endif // EIGEN_FLAGGED_H


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:10