File indexing completed on 2025-01-18 09:56:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef EIGEN_SWAP_H
0011 #define EIGEN_SWAP_H
0012
0013 namespace Eigen {
0014
0015 namespace internal {
0016
0017
0018 template<typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT>
0019 class generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, Specialized>
0020 : public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, BuiltIn>
0021 {
0022 protected:
0023 typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, BuiltIn> Base;
0024 using Base::m_dst;
0025 using Base::m_src;
0026 using Base::m_functor;
0027
0028 public:
0029 typedef typename Base::Scalar Scalar;
0030 typedef typename Base::DstXprType DstXprType;
0031 typedef swap_assign_op<Scalar> Functor;
0032
0033 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0034 generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr)
0035 : Base(dst, src, func, dstExpr)
0036 {}
0037
0038 template<int StoreMode, int LoadMode, typename PacketType>
0039 EIGEN_STRONG_INLINE void assignPacket(Index row, Index col)
0040 {
0041 PacketType tmp = m_src.template packet<LoadMode,PacketType>(row,col);
0042 const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(row,col, m_dst.template packet<StoreMode,PacketType>(row,col));
0043 m_dst.template writePacket<StoreMode>(row,col,tmp);
0044 }
0045
0046 template<int StoreMode, int LoadMode, typename PacketType>
0047 EIGEN_STRONG_INLINE void assignPacket(Index index)
0048 {
0049 PacketType tmp = m_src.template packet<LoadMode,PacketType>(index);
0050 const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(index, m_dst.template packet<StoreMode,PacketType>(index));
0051 m_dst.template writePacket<StoreMode>(index,tmp);
0052 }
0053
0054
0055 template<int StoreMode, int LoadMode, typename PacketType>
0056 EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner)
0057 {
0058 Index row = Base::rowIndexByOuterInner(outer, inner);
0059 Index col = Base::colIndexByOuterInner(outer, inner);
0060 assignPacket<StoreMode,LoadMode,PacketType>(row, col);
0061 }
0062 };
0063
0064 }
0065
0066 }
0067
0068 #endif