diff options
author | 2014-03-13 15:44:20 +0100 | |
---|---|---|
committer | 2014-03-13 15:44:20 +0100 | |
commit | 0a6c472335b593a227c3adbcf1d770187449a30f (patch) | |
tree | 4f70fcccec5dfaa160f0013097147ff07e48ef1f /Eigen/src | |
parent | aceae8314b80fbf96e8dc1b0d45c1e99951e770c (diff) |
A bit of cleaning
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/Assign.h | 82 |
1 files changed, 56 insertions, 26 deletions
diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h index 95eb37dd5..0e10f125f 100644 --- a/Eigen/src/Core/Assign.h +++ b/Eigen/src/Core/Assign.h @@ -509,7 +509,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived> #ifdef EIGEN_TEST_EVALUATORS eigen_assert(rows() == other.rows() && cols() == other.cols()); - internal::call_dense_assignment_loop(derived(),other.derived()); + internal::call_assignment_no_alias(derived(),other.derived()); #else // EIGEN_TEST_EVALUATORS @@ -530,23 +530,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived> namespace internal { -#ifdef EIGEN_TEST_EVALUATORS - -// TODO remove this class which is now useless - -template<typename Derived, typename OtherDerived> -struct assign_selector { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { - call_assignment(dst, other.derived(), internal::assign_op<typename OtherDerived::Scalar>()); - return dst; - } - template<typename ActualDerived, typename ActualOtherDerived> - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Derived& evalTo(ActualDerived& dst, const ActualOtherDerived& other) { other.evalTo(dst); return dst; } -}; - -#else // EIGEN_TEST_EVALUATORS +#ifndef EIGEN_TEST_EVALUATORS template<typename Derived, typename OtherDerived, bool EvalBeforeAssigning = (int(internal::traits<OtherDerived>::Flags) & EvalBeforeAssigningBit) != 0, bool NeedToTranspose = ((int(Derived::RowsAtCompileTime) == 1 && int(OtherDerived::ColsAtCompileTime) == 1) @@ -585,6 +569,59 @@ struct assign_selector<Derived,OtherDerived,true,true> { #endif // EIGEN_TEST_EVALUATORS } // end namespace internal +#ifdef EIGEN_TEST_EVALUATORS +template<typename Derived> +template<typename OtherDerived> +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template<typename Derived> +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template<typename Derived> +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template<typename Derived> +template <typename OtherDerived> +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const DenseBase<OtherDerived>& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template<typename Derived> +template <typename OtherDerived> +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const EigenBase<OtherDerived>& other) +{ + other.derived().evalTo(derived()); + return derived(); +} + +template<typename Derived> +template<typename OtherDerived> +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other) +{ + other.derived().evalTo(derived()); + return derived(); +} +#else // EIGEN_TEST_EVALUATORS template<typename Derived> template<typename OtherDerived> EIGEN_DEVICE_FUNC @@ -620,11 +657,7 @@ template <typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const EigenBase<OtherDerived>& other) { -#ifdef EIGEN_TEST_EVALUATORS - return internal::assign_selector<Derived,OtherDerived>::evalTo(derived(), other.derived()); -#else return internal::assign_selector<Derived,OtherDerived,false>::evalTo(derived(), other.derived()); -#endif } template<typename Derived> @@ -632,12 +665,9 @@ template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other) { -#ifdef EIGEN_TEST_EVALUATORS - return internal::assign_selector<Derived,OtherDerived>::evalTo(derived(), other.derived()); -#else return internal::assign_selector<Derived,OtherDerived,false>::evalTo(derived(), other.derived()); -#endif } +#endif // EIGEN_TEST_EVALUATORS } // end namespace Eigen |