mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Finally, the simplest remains to deffer resizing at the latest
This commit is contained in:
parent
1b5de5a37b
commit
8cfb138e73
@ -676,12 +676,7 @@ void call_assignment(const Dst& dst, const Src& src)
|
|||||||
template<typename Dst, typename Src, typename Func>
|
template<typename Dst, typename Src, typename Func>
|
||||||
void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if<evaluator_traits<Src>::AssumeAliasing==1, void*>::type = 0)
|
void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if<evaluator_traits<Src>::AssumeAliasing==1, void*>::type = 0)
|
||||||
{TRACK;
|
{TRACK;
|
||||||
// The following initial implementation through an EvalToTemp object does not permit to
|
|
||||||
// perform deferred resizing as in 'A = A * B' when the size of 'A' as to be changed
|
|
||||||
// typedef typename internal::conditional<evaluator_traits<Src>::AssumeAliasing==1, EvalToTemp<Src>, Src>::type ActualSrc;
|
|
||||||
// Assignment<Dst,ActualSrc,Func>::run(dst, src, func);
|
|
||||||
|
|
||||||
// TODO we should simply do tmp(src);
|
|
||||||
#ifdef EIGEN_TEST_EVALUATORS
|
#ifdef EIGEN_TEST_EVALUATORS
|
||||||
typename Src::PlainObject tmp(src);
|
typename Src::PlainObject tmp(src);
|
||||||
#else
|
#else
|
||||||
@ -697,8 +692,6 @@ void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable
|
|||||||
template<typename Dst, typename Src, typename Func>
|
template<typename Dst, typename Src, typename Func>
|
||||||
void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if<evaluator_traits<Src>::AssumeAliasing==0, void*>::type = 0)
|
void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if<evaluator_traits<Src>::AssumeAliasing==0, void*>::type = 0)
|
||||||
{TRACK;
|
{TRACK;
|
||||||
// There is no explicit no-aliasing, so we must resize here:
|
|
||||||
dst.resize(src.rows(), src.cols());
|
|
||||||
call_assignment_no_alias(dst, src, func);
|
call_assignment_no_alias(dst, src, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,6 +721,9 @@ void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func)
|
|||||||
&& int(Dst::SizeAtCompileTime) != 1
|
&& int(Dst::SizeAtCompileTime) != 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dst.resize(NeedToTranspose ? src.cols() : src.rows(),
|
||||||
|
NeedToTranspose ? src.rows() : src.cols());
|
||||||
|
|
||||||
typedef typename internal::conditional<NeedToTranspose, Transpose<Dst>, Dst>::type ActualDstTypeCleaned;
|
typedef typename internal::conditional<NeedToTranspose, Transpose<Dst>, Dst>::type ActualDstTypeCleaned;
|
||||||
typedef typename internal::conditional<NeedToTranspose, Transpose<Dst>, Dst&>::type ActualDstType;
|
typedef typename internal::conditional<NeedToTranspose, Transpose<Dst>, Dst&>::type ActualDstType;
|
||||||
ActualDstType actualDst(dst);
|
ActualDstType actualDst(dst);
|
||||||
|
@ -40,9 +40,7 @@ class NoAlias
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
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() ??
|
call_assignment_no_alias(m_expression, other.derived(), internal::assign_op<Scalar>());
|
||||||
m_expression.resize(other.derived().rows(), other.derived().cols());
|
|
||||||
call_assignment(*this, other.derived(), internal::assign_op<Scalar>());
|
|
||||||
return m_expression;
|
return m_expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ class NoAlias
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
|
EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
call_assignment(*this, other.derived(), internal::add_assign_op<Scalar>());
|
call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op<Scalar>());
|
||||||
return m_expression;
|
return m_expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +56,7 @@ class NoAlias
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
|
EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
call_assignment(*this, other.derived(), internal::sub_assign_op<Scalar>());
|
call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op<Scalar>());
|
||||||
return m_expression;
|
return m_expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user