diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-06-25 17:23:52 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-06-25 17:23:52 +0200 |
commit | b868bfb84a4a86231bb338e9bcf08afd882d32dc (patch) | |
tree | 29f019cbbe4f5821fc41c6f2358961fc99c7c7e0 /Eigen/src/Core/AssignEvaluator.h | |
parent | 3b19b466a7609fd381db2c53569d4d1d1621dbfc (diff) |
Make operator=(EigenBase<>) uses the new assignment mechanism and introduce a generic EigenBase to EigenBase assignment kind based on the previous evalTo mechanism.
Diffstat (limited to 'Eigen/src/Core/AssignEvaluator.h')
-rw-r--r-- | Eigen/src/Core/AssignEvaluator.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h index 77b4dd9bc..c45ac96f2 100644 --- a/Eigen/src/Core/AssignEvaluator.h +++ b/Eigen/src/Core/AssignEvaluator.h @@ -663,7 +663,9 @@ template<typename DstShape, typename SrcShape> struct AssignmentKind; // Assignement kind defined in this file: struct Dense2Dense {}; +struct EigenBase2EigenBase {}; +template<typename,typename> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; template<> struct AssignmentKind<DenseShape,DenseShape> { typedef Dense2Dense Kind; }; // This is the main assignment class @@ -750,8 +752,12 @@ void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func) // TODO check whether this is the right place to perform these checks: EIGEN_STATIC_ASSERT_LVALUE(Dst) EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src) - EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar); + // TODO this line is commented to allow matrix = permutation + // Actually, the "Scalar" type for a permutation matrix does not really make sense, + // perhaps it could be void, and EIGEN_CHECK_BINARY_COMPATIBILIY could allow micing void with anything...? +// EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar); + Assignment<ActualDstTypeCleaned,Src,Func>::run(actualDst, src, func); } template<typename Dst, typename Src> @@ -772,6 +778,19 @@ struct Assignment<DstXprType, SrcXprType, Functor, Dense2Dense, Scalar> } }; +// Generic assignment through evalTo. +// TODO: not sure we have to keep that one, but it helps porting current code to new evaluator mechanism. +template< typename DstXprType, typename SrcXprType, typename Functor, typename Scalar> +struct Assignment<DstXprType, SrcXprType, Functor, EigenBase2EigenBase, Scalar> +{ + static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar> &/*func*/) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + + src.evalTo(dst); + } +}; + } // namespace internal } // end namespace Eigen |