diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h --- a/Eigen/src/Core/ProductBase.h +++ b/Eigen/src/Core/ProductBase.h @@ -108,24 +108,16 @@ class ProductBase : public MatrixBase inline void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { derived().scaleAndAddTo(dst,alpha); } const _LhsNested& lhs() const { return m_lhs; } const _RhsNested& rhs() const { return m_rhs; } - // Implicit conversion to the nested type (trigger the evaluation of the product) - operator const PlainObject& () const - { - m_result.resize(m_lhs.rows(), m_rhs.cols()); - derived().evalTo(m_result); - return m_result; - } - const Diagonal diagonal() const { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } template const Diagonal diagonal() const { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } const Diagonal diagonal(Index index) const @@ -165,27 +157,25 @@ class ProductBase : public MatrixBaserows() == 1 && this->cols() == 1); return derived().coeffRef(i); } protected: LhsNested m_lhs; RhsNested m_rhs; - - mutable PlainObject m_result; }; // here we need to overload the nested rule for products -// such that the nested type is a const reference to a plain matrix +// such that the nested type is a plain matrix storing the result of the product namespace internal { template struct nested, N, PlainObject> { - typedef PlainObject const& type; + typedef PlainObject type; }; } template class ScaledProduct; // Note that these two operator* functions are not defined as member // functions of ProductBase, because, otherwise we would have to diff --git a/Eigen/src/Core/products/CoeffBasedProduct.h b/Eigen/src/Core/products/CoeffBasedProduct.h --- a/Eigen/src/Core/products/CoeffBasedProduct.h +++ b/Eigen/src/Core/products/CoeffBasedProduct.h @@ -185,51 +185,42 @@ class CoeffBasedProduct PacketScalar res; internal::product_packet_impl ::run(row, col, m_lhs, m_rhs, res); return res; } - // Implicit conversion to the nested type (trigger the evaluation of the product) - EIGEN_STRONG_INLINE operator const PlainObject& () const - { - m_result.lazyAssign(*this); - return m_result; - } - const _LhsNested& lhs() const { return m_lhs; } const _RhsNested& rhs() const { return m_rhs; } const Diagonal diagonal() const { return reinterpret_cast(*this); } template const Diagonal diagonal() const { return reinterpret_cast(*this); } const Diagonal diagonal(Index index) const { return reinterpret_cast(*this).diagonal(index); } protected: typename internal::add_const_on_value_type::type m_lhs; typename internal::add_const_on_value_type::type m_rhs; - - mutable PlainObject m_result; }; namespace internal { // here we need to overload the nested rule for products -// such that the nested type is a const reference to a plain matrix +// such that the nested type is a plain matrix storing the result of the product template struct nested, N, PlainObject> { - typedef PlainObject const& type; + typedef PlainObject type; }; /*************************************************************************** * Normal product .coeff() implementation (with meta-unrolling) ***************************************************************************/ /************************************** *** Scalar path - no vectorization ***