Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
NestByValue.h
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 // This Source Code Form is subject to the terms of the Mozilla 00008 // Public License v. 2.0. If a copy of the MPL was not distributed 00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 00010 00011 #ifndef EIGEN_NESTBYVALUE_H 00012 #define EIGEN_NESTBYVALUE_H 00013 00014 namespace Eigen { 00015 00016 /** \class NestByValue 00017 * \ingroup Core_Module 00018 * 00019 * \brief Expression which must be nested by value 00020 * 00021 * \param ExpressionType the type of the object of which we are requiring nesting-by-value 00022 * 00023 * This class is the return type of MatrixBase::nestByValue() 00024 * and most of the time this is the only way it is used. 00025 * 00026 * \sa MatrixBase::nestByValue() 00027 */ 00028 00029 namespace internal { 00030 template<typename ExpressionType> 00031 struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType> 00032 {}; 00033 } 00034 00035 template<typename ExpressionType> class NestByValue 00036 : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type 00037 { 00038 public: 00039 00040 typedef typename internal::dense_xpr_base<NestByValue>::type Base; 00041 EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) 00042 00043 inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} 00044 00045 inline Index rows() const { return m_expression.rows(); } 00046 inline Index cols() const { return m_expression.cols(); } 00047 inline Index outerStride() const { return m_expression.outerStride(); } 00048 inline Index innerStride() const { return m_expression.innerStride(); } 00049 00050 inline const CoeffReturnType coeff(Index row, Index col) const 00051 { 00052 return m_expression.coeff(row, col); 00053 } 00054 00055 inline Scalar& coeffRef(Index row, Index col) 00056 { 00057 return m_expression.const_cast_derived().coeffRef(row, col); 00058 } 00059 00060 inline const CoeffReturnType coeff(Index index) const 00061 { 00062 return m_expression.coeff(index); 00063 } 00064 00065 inline Scalar& coeffRef(Index index) 00066 { 00067 return m_expression.const_cast_derived().coeffRef(index); 00068 } 00069 00070 template<int LoadMode> 00071 inline const PacketScalar packet(Index row, Index col) const 00072 { 00073 return m_expression.template packet<LoadMode>(row, col); 00074 } 00075 00076 template<int LoadMode> 00077 inline void writePacket(Index row, Index col, const PacketScalar& x) 00078 { 00079 m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x); 00080 } 00081 00082 template<int LoadMode> 00083 inline const PacketScalar packet(Index index) const 00084 { 00085 return m_expression.template packet<LoadMode>(index); 00086 } 00087 00088 template<int LoadMode> 00089 inline void writePacket(Index index, const PacketScalar& x) 00090 { 00091 m_expression.const_cast_derived().template writePacket<LoadMode>(index, x); 00092 } 00093 00094 operator const ExpressionType&() const { return m_expression; } 00095 00096 protected: 00097 const ExpressionType m_expression; 00098 }; 00099 00100 /** \returns an expression of the temporary version of *this. 00101 */ 00102 template<typename Derived> 00103 inline const NestByValue<Derived> 00104 DenseBase<Derived>::nestByValue() const 00105 { 00106 return NestByValue<Derived>(derived()); 00107 } 00108 00109 } // end namespace Eigen 00110 00111 #endif // EIGEN_NESTBYVALUE_H
Generated on Thu Nov 17 2022 22:01:29 by
1.7.2