Swap.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_SWAP_H
11 #define EIGEN_SWAP_H
12 
13 namespace Eigen {
14 
15 namespace internal {
16 
17 // Overload default assignPacket behavior for swapping them
18 template<typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT>
19 class generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, Specialized>
20  : public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, BuiltIn>
21 {
22 protected:
24  using Base::m_dst;
25  using Base::m_src;
26  using Base::m_functor;
27 
28 public:
29  typedef typename Base::Scalar Scalar;
30  typedef typename Base::DstXprType DstXprType;
32 
34  generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr)
35  : Base(dst, src, func, dstExpr)
36  {}
37 
38  template<int StoreMode, int LoadMode, typename PacketType>
40  {
41  PacketType tmp = m_src.template packet<LoadMode,PacketType>(row,col);
42  const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(row,col, m_dst.template packet<StoreMode,PacketType>(row,col));
43  m_dst.template writePacket<StoreMode>(row,col,tmp);
44  }
45 
46  template<int StoreMode, int LoadMode, typename PacketType>
48  {
49  PacketType tmp = m_src.template packet<LoadMode,PacketType>(index);
50  const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(index, m_dst.template packet<StoreMode,PacketType>(index));
51  m_dst.template writePacket<StoreMode>(index,tmp);
52  }
53 
54  // TODO find a simple way not to have to copy/paste this function from generic_dense_assignment_kernel, by simple I mean no CRTP (Gael)
55  template<int StoreMode, int LoadMode, typename PacketType>
57  {
58  Index row = Base::rowIndexByOuterInner(outer, inner);
59  Index col = Base::colIndexByOuterInner(outer, inner);
60  assignPacket<StoreMode,LoadMode,PacketType>(row, col);
61  }
62 };
63 
64 } // namespace internal
65 
66 } // end namespace Eigen
67 
68 #endif // EIGEN_SWAP_H
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen::internal::generic_dense_assignment_kernel
Definition: AssignEvaluator.h:618
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
col
m col(1)
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::Scalar
Base::Scalar Scalar
Definition: Swap.h:29
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::assignPacketByOuterInner
EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner)
Definition: Swap.h:56
Eigen::internal::generic_dense_assignment_kernel::Scalar
DstEvaluatorType::Scalar Scalar
Definition: AssignEvaluator.h:629
Eigen::internal::true_type
Definition: Meta.h:96
Eigen::internal::generic_dense_assignment_kernel::m_src
const SrcEvaluatorType & m_src
Definition: AssignEvaluator.h:719
Eigen::internal::swap_assign_op
Definition: AssignmentFunctors.h:142
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
Eigen::Specialized
@ Specialized
Definition: Constants.h:310
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::Base
generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, BuiltIn > Base
Definition: Swap.h:23
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::assignPacket
EIGEN_STRONG_INLINE void assignPacket(Index row, Index col)
Definition: Swap.h:39
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::DstXprType
Base::DstXprType DstXprType
Definition: Swap.h:30
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::Functor
swap_assign_op< Scalar > Functor
Definition: Swap.h:31
Eigen::BuiltIn
@ BuiltIn
Definition: Constants.h:311
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::assignPacket
EIGEN_STRONG_INLINE void assignPacket(Index index)
Definition: Swap.h:47
row
m row(1)
Eigen::internal::generic_dense_assignment_kernel< DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op< typename DstEvaluatorTypeT::Scalar >, Specialized >::generic_dense_assignment_kernel
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType &dstExpr)
Definition: Swap.h:34
Eigen::internal::generic_dense_assignment_kernel::DstXprType
DstEvaluatorTypeT::XprType DstXprType
Definition: AssignEvaluator.h:623
internal
Definition: BandTriangularSolver.h:13
func
Definition: benchGeometry.cpp:23
Eigen::internal::generic_dense_assignment_kernel::m_dst
DstEvaluatorType & m_dst
Definition: AssignEvaluator.h:718
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:14:22