diff options
author | Yi Kong <yikong@google.com> | 2022-02-25 15:53:09 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-02-25 15:53:09 +0000 |
commit | 10f298fc4175c1b8537c674f654a070c871960e5 (patch) | |
tree | fb979fb4cf4f8052c8cc66b1ec9516d91fcd859b /Eigen/src/Core/NestByValue.h | |
parent | 892aea0d75825c43d5b630e2060622cbba23694c (diff) | |
parent | 79df15ea886a5fc1b85de433f9b3518c68934bae (diff) | |
download | eigen-10f298fc4175c1b8537c674f654a070c871960e5.tar.gz |
Merge changes Iee153445,Iee274471 am: 79df15ea88android-games-sdk-games-performance-tuner-releaseandroid-games-sdk-games-memory-advice-releaseandroid-games-sdk-games-frame-pacing-releaseandroid-games-sdk-games-controller-releaseandroid-games-sdk-game-text-input-releaseandroid-games-sdk-game-activity-release
Original change: https://android-review.googlesource.com/c/platform/external/eigen/+/1999079
Change-Id: I0c5108390c595f0d39af8797875f2b88accb7b56
Diffstat (limited to 'Eigen/src/Core/NestByValue.h')
-rw-r--r-- | Eigen/src/Core/NestByValue.h | 75 |
1 files changed, 25 insertions, 50 deletions
diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h index 13adf070e..b4275768a 100644 --- a/Eigen/src/Core/NestByValue.h +++ b/Eigen/src/Core/NestByValue.h @@ -16,7 +16,11 @@ namespace Eigen { namespace internal { template<typename ExpressionType> struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType> -{}; +{ + enum { + Flags = traits<ExpressionType>::Flags & ~NestByRefBit + }; +}; } /** \class NestByValue @@ -41,57 +45,13 @@ template<typename ExpressionType> class NestByValue EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} - EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); } - EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); } - EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); } - EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); } - - EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const - { - return m_expression.coeff(row, col); - } - - EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) - { - return m_expression.const_cast_derived().coeffRef(row, col); - } - - EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const - { - return m_expression.coeff(index); - } - - EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) - { - return m_expression.const_cast_derived().coeffRef(index); - } - - template<int LoadMode> - inline const PacketScalar packet(Index row, Index col) const - { - return m_expression.template packet<LoadMode>(row, col); - } - - template<int LoadMode> - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x); - } - - template<int LoadMode> - inline const PacketScalar packet(Index index) const - { - return m_expression.template packet<LoadMode>(index); - } - - template<int LoadMode> - inline void writePacket(Index index, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket<LoadMode>(index, x); - } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } + EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; } + protected: const ExpressionType m_expression; }; @@ -99,12 +59,27 @@ template<typename ExpressionType> class NestByValue /** \returns an expression of the temporary version of *this. */ template<typename Derived> -inline const NestByValue<Derived> +EIGEN_DEVICE_FUNC inline const NestByValue<Derived> DenseBase<Derived>::nestByValue() const { return NestByValue<Derived>(derived()); } +namespace internal { + +// Evaluator of Solve -> eval into a temporary +template<typename ArgType> +struct evaluator<NestByValue<ArgType> > + : public evaluator<ArgType> +{ + typedef evaluator<ArgType> Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue<ArgType>& xpr) + : Base(xpr.nestedExpression()) + {} +}; +} + } // end namespace Eigen #endif // EIGEN_NESTBYVALUE_H |