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 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
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


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:08