mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
fix bad mat * mat * scalar when the implicit conversion operator to a Matrix is used
This commit is contained in:
parent
dd94f10442
commit
b49dde01dc
@ -125,7 +125,7 @@ class ProductBase : public MatrixBase<Derived>
|
|||||||
operator const PlainObject& () const
|
operator const PlainObject& () const
|
||||||
{
|
{
|
||||||
m_result.resize(m_lhs.rows(), m_rhs.cols());
|
m_result.resize(m_lhs.rows(), m_rhs.cols());
|
||||||
this->evalTo(m_result);
|
derived().evalTo(m_result);
|
||||||
return m_result;
|
return m_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,6 +216,7 @@ class ScaledProduct
|
|||||||
typename NestedProduct::_LhsNested,
|
typename NestedProduct::_LhsNested,
|
||||||
typename NestedProduct::_RhsNested> Base;
|
typename NestedProduct::_RhsNested> Base;
|
||||||
typedef typename Base::Scalar Scalar;
|
typedef typename Base::Scalar Scalar;
|
||||||
|
typedef typename Base::PlainObject PlainObject;
|
||||||
// EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct)
|
// EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct)
|
||||||
|
|
||||||
ScaledProduct(const NestedProduct& prod, Scalar x)
|
ScaledProduct(const NestedProduct& prod, Scalar x)
|
||||||
|
@ -110,6 +110,10 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
|
|||||||
|
|
||||||
VERIFY_IS_APPROX(m1.col(j2).adjoint() * m1.block(0,j,m1.rows(),c), m1.col(j2).adjoint().eval() * m1.block(0,j,m1.rows(),c).eval());
|
VERIFY_IS_APPROX(m1.col(j2).adjoint() * m1.block(0,j,m1.rows(),c), m1.col(j2).adjoint().eval() * m1.block(0,j,m1.rows(),c).eval());
|
||||||
VERIFY_IS_APPROX(m1.block(i,0,r,m1.cols()) * m1.row(i2).adjoint(), m1.block(i,0,r,m1.cols()).eval() * m1.row(i2).adjoint().eval());
|
VERIFY_IS_APPROX(m1.block(i,0,r,m1.cols()) * m1.row(i2).adjoint(), m1.block(i,0,r,m1.cols()).eval() * m1.row(i2).adjoint().eval());
|
||||||
|
|
||||||
|
// regression test
|
||||||
|
MatrixType tmp = m1 * m1.adjoint() * s1;
|
||||||
|
VERIFY_IS_APPROX(tmp, m1 * m1.adjoint() * s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_product_extra()
|
void test_product_extra()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user