Re-enable aliasing checks when using evaluators

This commit is contained in:
Gael Guennebaud 2014-09-14 19:06:08 +02:00
parent fda680f9cf
commit 26db954776
4 changed files with 22 additions and 4 deletions

View File

@ -521,12 +521,13 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
eigen_assert(rows() == other.rows() && cols() == other.cols());
internal::assign_impl<Derived, OtherDerived, int(SameType) ? int(internal::assign_traits<Derived, OtherDerived>::Traversal)
: int(InvalidTraversal)>::run(derived(),other.derived());
#endif // EIGEN_TEST_EVALUATORS
#ifndef EIGEN_NO_DEBUG
checkTransposeAliasing(other.derived());
#endif
#endif // EIGEN_TEST_EVALUATORS
return derived();
}

View File

@ -763,6 +763,9 @@ void call_assignment_no_alias(Dst& dst, const Src& src)
call_assignment_no_alias(dst, src, internal::assign_op<typename Dst::Scalar>());
}
// forxard declaration
template<typename Dst, typename Src> void check_for_aliasing(const Dst &dst, const Src &src);
// Generic Dense to Dense assignment
template< typename DstXprType, typename SrcXprType, typename Functor, typename Scalar>
struct Assignment<DstXprType, SrcXprType, Functor, Dense2Dense, Scalar>
@ -771,6 +774,10 @@ struct Assignment<DstXprType, SrcXprType, Functor, Dense2Dense, Scalar>
{
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
#ifndef EIGEN_NO_DEBUG
internal::check_for_aliasing(dst, src);
#endif
call_dense_assignment_loop(dst, src, func);
}
};

View File

@ -314,11 +314,13 @@ template<typename Derived> class DenseBase
EIGEN_DEVICE_FUNC
void transposeInPlace();
#ifndef EIGEN_NO_DEBUG
#ifndef EIGEN_TEST_EVALUATORS
protected:
template<typename OtherDerived>
void checkTransposeAliasing(const OtherDerived& other) const;
public:
#endif
#endif
EIGEN_DEVICE_FUNC static const ConstantReturnType

View File

@ -437,15 +437,23 @@ struct checkTransposeAliasing_impl<Derived, OtherDerived, false>
}
};
template<typename Dst, typename Src>
void check_for_aliasing(const Dst &dst, const Src &src)
{
internal::checkTransposeAliasing_impl<Dst, Src>::run(dst, src);
}
} // end namespace internal
#ifndef EIGEN_TEST_EVALUATORS
template<typename Derived>
template<typename OtherDerived>
void DenseBase<Derived>::checkTransposeAliasing(const OtherDerived& other) const
{
internal::checkTransposeAliasing_impl<Derived, OtherDerived>::run(derived(), other);
}
#endif
#endif // EIGEN_TEST_EVALUATORS
#endif // EIGEN_NO_DEBUG
} // end namespace Eigen