NestByValue.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 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // Eigen is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public
00009 // License as published by the Free Software Foundation; either
00010 // version 3 of the License, or (at your option) any later version.
00011 //
00012 // Alternatively, you can redistribute it and/or
00013 // modify it under the terms of the GNU General Public License as
00014 // published by the Free Software Foundation; either version 2 of
00015 // the License, or (at your option) any later version.
00016 //
00017 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00018 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00019 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License and a copy of the GNU General Public License along with
00024 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00025 
00026 #ifndef EIGEN_NESTBYVALUE_H
00027 #define EIGEN_NESTBYVALUE_H
00028 
00042 namespace internal {
00043 template<typename ExpressionType>
00044 struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
00045 {};
00046 }
00047 
00048 template<typename ExpressionType> class NestByValue
00049   : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
00050 {
00051   public:
00052 
00053     typedef typename internal::dense_xpr_base<NestByValue>::type Base;
00054     EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
00055 
00056     inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
00057 
00058     inline Index rows() const { return m_expression.rows(); }
00059     inline Index cols() const { return m_expression.cols(); }
00060     inline Index outerStride() const { return m_expression.outerStride(); }
00061     inline Index innerStride() const { return m_expression.innerStride(); }
00062 
00063     inline const CoeffReturnType coeff(Index row, Index col) const
00064     {
00065       return m_expression.coeff(row, col);
00066     }
00067 
00068     inline Scalar& coeffRef(Index row, Index col)
00069     {
00070       return m_expression.const_cast_derived().coeffRef(row, col);
00071     }
00072 
00073     inline const CoeffReturnType coeff(Index index) const
00074     {
00075       return m_expression.coeff(index);
00076     }
00077 
00078     inline Scalar& coeffRef(Index index)
00079     {
00080       return m_expression.const_cast_derived().coeffRef(index);
00081     }
00082 
00083     template<int LoadMode>
00084     inline const PacketScalar packet(Index row, Index col) const
00085     {
00086       return m_expression.template packet<LoadMode>(row, col);
00087     }
00088 
00089     template<int LoadMode>
00090     inline void writePacket(Index row, Index col, const PacketScalar& x)
00091     {
00092       m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
00093     }
00094 
00095     template<int LoadMode>
00096     inline const PacketScalar packet(Index index) const
00097     {
00098       return m_expression.template packet<LoadMode>(index);
00099     }
00100 
00101     template<int LoadMode>
00102     inline void writePacket(Index index, const PacketScalar& x)
00103     {
00104       m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
00105     }
00106 
00107     operator const ExpressionType&() const { return m_expression; }
00108 
00109   protected:
00110     const ExpressionType m_expression;
00111 };
00112 
00115 template<typename Derived>
00116 inline const NestByValue<Derived>
00117 DenseBase<Derived>::nestByValue() const
00118 {
00119   return NestByValue<Derived>(derived());
00120 }
00121 
00122 #endif // EIGEN_NESTBYVALUE_H


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