From 4365a48748b3aeb6c15178b8471b1a5a8e0e9802 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Tue, 26 Jan 2010 19:42:17 +0100 Subject: Added an ei_linspaced_op to create linearly spaced vectors. Added setLinSpaced/LinSpaced functionality to DenseBase. Improved vectorized assignment - overcomes MSVC optimization issues. CwiseNullaryOp is now requiring functors to offer 1D and 2D operators. Adapted existing functors to the new CwiseNullaryOp requirements. Added ei_plset to create packages as [a, a+1, ..., a+size]. Added more nullaray unit tests. --- Eigen/src/Core/Assign.h | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'Eigen/src/Core/Assign.h') diff --git a/Eigen/src/Core/Assign.h b/Eigen/src/Core/Assign.h index e5c17b3f4..41653098f 100644 --- a/Eigen/src/Core/Assign.h +++ b/Eigen/src/Core/Assign.h @@ -378,6 +378,31 @@ struct ei_assign_impl +struct ei_unaligned_assign_impl +{ + template + static EIGEN_STRONG_INLINE void run(const Derived& src, OtherDerived& dst, int start, int end) {} +}; + +template <> +struct ei_unaligned_assign_impl +{ + // MSVC must not inline this functions. If it does, it fails to optimize the + // packet access path. +#ifdef _MSC_VER + template + static EIGEN_DONT_INLINE void run(const Derived& src, OtherDerived& dst, int start, int end) +#else + template + static EIGEN_STRONG_INLINE void run(const Derived& src, OtherDerived& dst, int start, int end) +#endif + { + for (int index = start; index < end; ++index) + dst.copyCoeff(index, src); + } +}; + template struct ei_assign_impl { @@ -389,16 +414,14 @@ struct ei_assign_impl::DstIsAligned!=0>::run(src,dst,0,alignedStart); + for(int index = alignedStart; index < alignedEnd; index += packetSize) { dst.template copyPacket::SrcAlignment>(index, src); } - for(int index = alignedEnd; index < size; ++index) - dst.copyCoeff(index, src); + ei_unaligned_assign_impl<>::run(src,dst,alignedEnd,size); } }; -- cgit v1.2.3