mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-06 13:15:14 +08:00
fix resizing in noalias for blocks, and make -=/+= use evaluators
This commit is contained in:
parent
2ca0ccd2f2
commit
e94fe4cc3e
@ -213,8 +213,12 @@ template<typename OtherDerived>
|
|||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_STRONG_INLINE Derived &
|
||||||
MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
|
MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other)
|
||||||
{
|
{
|
||||||
|
#ifdef EIGEN_TEST_EVALUATORS
|
||||||
|
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar>());
|
||||||
|
#else
|
||||||
SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
|
SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived());
|
||||||
tmp = other.derived();
|
tmp = other.derived();
|
||||||
|
#endif
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,8 +231,12 @@ template<typename OtherDerived>
|
|||||||
EIGEN_STRONG_INLINE Derived &
|
EIGEN_STRONG_INLINE Derived &
|
||||||
MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
|
MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
|
#ifdef EIGEN_TEST_EVALUATORS
|
||||||
|
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar>());
|
||||||
|
#else
|
||||||
SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
|
SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived());
|
||||||
tmp = other.derived();
|
tmp = other.derived();
|
||||||
|
#endif
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class NoAlias
|
|||||||
EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
|
EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
// TODO either call resize here or call "call_assignment" through m_expression.lazyAssign() ??
|
// TODO either call resize here or call "call_assignment" through m_expression.lazyAssign() ??
|
||||||
m_expression.resizeLike(other.derived());
|
m_expression.resize(other.derived().rows(), other.derived().cols());
|
||||||
call_assignment(*this, other.derived(), internal::assign_op<Scalar>());
|
call_assignment(*this, other.derived(), internal::assign_op<Scalar>());
|
||||||
return m_expression;
|
return m_expression;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user