fix a couple of issues related to recent products
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index e643144..2010340 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h
@@ -173,14 +173,16 @@ using Base::operator=; using Base::operator*=; + using Base::operator+=; + using Base::operator-=; - template<typename Lhs,typename Rhs> - Derived& operator+=(const Flagged<Product<Lhs,Rhs,CacheFriendlyProduct>, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit>& other) - { return Base::operator+=(other); } - - template<typename Lhs,typename Rhs> - Derived& operator-=(const Flagged<Product<Lhs,Rhs,CacheFriendlyProduct>, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit>& other) - { return Base::operator-=(other); } +// template<typename Lhs,typename Rhs> +// Derived& operator+=(const Flagged<Product<Lhs,Rhs,CacheFriendlyProduct>, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit>& other) +// { return Base::operator+=(other); } +// +// template<typename Lhs,typename Rhs> +// Derived& operator-=(const Flagged<Product<Lhs,Rhs,CacheFriendlyProduct>, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit>& other) +// { return Base::operator-=(other); } template<typename OtherDerived> Derived& operator+=(const MatrixBase<OtherDerived>& other)
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index c4adc1c..8937596 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h
@@ -334,7 +334,10 @@ template<typename OtherDerived,typename OtherEvalType> EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue<OtherDerived,OtherEvalType>& func) - { return Base::operator=(func); } + { + resize(func.rows(), func.cols()); + return Base::operator=(func); + } using Base::operator +=; using Base::operator -=; @@ -438,6 +441,7 @@ EIGEN_STRONG_INLINE Matrix(const ReturnByValue<OtherDerived,OtherEvalType>& other) { _check_template_params(); + resize(other.rows(), other.cols()); other.evalTo(*this); } /** Destructor */
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index ac2b253..b881c09 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h
@@ -409,15 +409,8 @@ const typename ProductReturnType<Derived,OtherDerived>::Type operator*(const MatrixBase<OtherDerived> &other) const; - /** replaces \c *this by \c *this * \a other. - * - * \returns a reference to \c *this - */ template<typename OtherDerived> - Derived& operator*=(const MultiplierBase<OtherDerived>& other) - { - return *this = *this * other.derived(); - } + Derived& operator*=(const MultiplierBase<OtherDerived>& other); template<typename DiagonalDerived> const DiagonalProduct<Derived, DiagonalDerived, DiagonalOnTheRight>
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index b46440e..ff45cba 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h
@@ -294,7 +294,7 @@ template<typename Derived> template<typename OtherDerived> inline Derived & -MatrixBase<Derived>::operator*=(const MatrixBase<OtherDerived> &other) +MatrixBase<Derived>::operator*=(const MultiplierBase<OtherDerived> &other) { return derived() = derived() * other.derived(); }
diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h index 72f4a8f..58b205e 100644 --- a/Eigen/src/Core/ReturnByValue.h +++ b/Eigen/src/Core/ReturnByValue.h
@@ -76,6 +76,8 @@ { EvalType res; evalTo(res); dst += res; } template<typename Dest> inline void _subTo(Dest& dst) const { EvalType res; evalTo(res); dst -= res; } + inline int rows() const { return static_cast<const Functor* const>(this)->rows(); } + inline int cols() const { return static_cast<const Functor* const>(this)->cols(); } }; template<typename Derived>
diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index 5644e2f..48d368e 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h
@@ -228,6 +228,9 @@ : m_lhs(lhs), m_rhs(rhs) {} + inline int rows() const { return m_lhs.rows(); } + inline int cols() const { return m_lhs.cols(); } + template<typename Dest> inline void _addTo(Dest& dst) const { evalTo(dst,1); } template<typename Dest> inline void _subTo(Dest& dst) const @@ -278,6 +281,9 @@ : m_lhs(lhs), m_rhs(rhs) {} + inline int rows() const { return m_lhs.rows(); } + inline int cols() const { return m_lhs.cols(); } + typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Nested LhsNested;
diff --git a/Eigen/src/Core/products/TriangularMatrixMatrix.h b/Eigen/src/Core/products/TriangularMatrixMatrix.h index 39a2bc4..b97eaea 100644 --- a/Eigen/src/Core/products/TriangularMatrixMatrix.h +++ b/Eigen/src/Core/products/TriangularMatrixMatrix.h
@@ -330,6 +330,9 @@ : m_lhs(lhs), m_rhs(rhs) {} + inline int rows() const { return m_lhs.rows(); } + inline int cols() const { return m_lhs.cols(); } + typedef typename Lhs::Scalar Scalar; typedef typename Lhs::Nested LhsNested;
diff --git a/Eigen/src/Core/products/TriangularMatrixVector.h b/Eigen/src/Core/products/TriangularMatrixVector.h index de65b1e..864b89a 100644 --- a/Eigen/src/Core/products/TriangularMatrixVector.h +++ b/Eigen/src/Core/products/TriangularMatrixVector.h
@@ -141,6 +141,9 @@ : m_lhs(lhs), m_rhs(rhs) {} + inline int rows() const { return m_lhs.rows(); } + inline int cols() const { return m_lhs.cols(); } + template<typename Dest> inline void _addTo(Dest& dst) const { evalTo(dst,1); } template<typename Dest> inline void _subTo(Dest& dst) const
diff --git a/test/product_notemporary.cpp b/test/product_notemporary.cpp index 478bc25..62f6167 100644 --- a/test/product_notemporary.cpp +++ b/test/product_notemporary.cpp
@@ -102,9 +102,13 @@ VERIFY_EVALUATION_COUNT(( m3.block(r0,r0,r1,r1) += m1.block(r0,r0,r1,r1).template selfadjointView<UpperTriangular>() * (s1*m2.block(c0,r0,c1,r1)) ), 0); VERIFY_EVALUATION_COUNT(( m3.block(r0,r0,r1,r1) = m1.block(r0,r0,r1,r1).template selfadjointView<UpperTriangular>() * m2.block(c0,r0,c1,r1) ), 0); - VERIFY_EVALUATION_COUNT(( m3 = m1.block(r0,r0,r1,r1).template selfadjointView<LowerTriangular>() * m2.block(c0,r0,c1,r1) ), 0); VERIFY_EVALUATION_COUNT( m3.template selfadjointView<LowerTriangular>().rankUpdate(m2.adjoint()), 0); + + m3.resize(1,1); + VERIFY_EVALUATION_COUNT(( m3 = m1.block(r0,r0,r1,r1).template selfadjointView<LowerTriangular>() * m2.block(c0,r0,c1,r1) ), 0); + m3.resize(1,1); + VERIFY_EVALUATION_COUNT(( m3 = m1.block(r0,r0,r1,r1).template triangularView<UnitUpperTriangular>() * m2.block(c0,r0,c1,r1) ), 0); } void test_product_notemporary()