summaryrefslogtreecommitdiff
path: root/runtimes/nn/depend/external/eigen/Eigen/src/Core/Swap.h
diff options
context:
space:
mode:
authorChunseok Lee <chunseok.lee@samsung.com>2018-05-04 17:57:16 +0900
committerChunseok Lee <chunseok.lee@samsung.com>2018-05-04 17:57:16 +0900
commit07659ccd9fe7b1cf1547cc6cad78bcf489f0a361 (patch)
treecf3a123812b7f1ad8b50d7d0ace891e0c03c6110 /runtimes/nn/depend/external/eigen/Eigen/src/Core/Swap.h
parentda6f7a3e8360a49fd073a6e0031a4da134d9d984 (diff)
downloadnnfw-44439e0eae2c6abf8dcee1ba95f371724f65155c.tar.gz
nnfw-44439e0eae2c6abf8dcee1ba95f371724f65155c.tar.bz2
nnfw-44439e0eae2c6abf8dcee1ba95f371724f65155c.zip
Imported Upstream version 0.1upstream/0.1submit/tizen/20180504.091146
Diffstat (limited to 'runtimes/nn/depend/external/eigen/Eigen/src/Core/Swap.h')
-rw-r--r--runtimes/nn/depend/external/eigen/Eigen/src/Core/Swap.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/runtimes/nn/depend/external/eigen/Eigen/src/Core/Swap.h b/runtimes/nn/depend/external/eigen/Eigen/src/Core/Swap.h
new file mode 100644
index 000000000..d70200918
--- /dev/null
+++ b/runtimes/nn/depend/external/eigen/Eigen/src/Core/Swap.h
@@ -0,0 +1,67 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef EIGEN_SWAP_H
+#define EIGEN_SWAP_H
+
+namespace Eigen {
+
+namespace internal {
+
+// Overload default assignPacket behavior for swapping them
+template<typename DstEvaluatorTypeT, typename SrcEvaluatorTypeT>
+class generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, Specialized>
+ : public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, BuiltIn>
+{
+protected:
+ typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, swap_assign_op<typename DstEvaluatorTypeT::Scalar>, BuiltIn> Base;
+ using Base::m_dst;
+ using Base::m_src;
+ using Base::m_functor;
+
+public:
+ typedef typename Base::Scalar Scalar;
+ typedef typename Base::DstXprType DstXprType;
+ typedef swap_assign_op<Scalar> Functor;
+
+ EIGEN_DEVICE_FUNC generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr)
+ : Base(dst, src, func, dstExpr)
+ {}
+
+ template<int StoreMode, int LoadMode, typename PacketType>
+ void assignPacket(Index row, Index col)
+ {
+ PacketType tmp = m_src.template packet<LoadMode,PacketType>(row,col);
+ const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(row,col, m_dst.template packet<StoreMode,PacketType>(row,col));
+ m_dst.template writePacket<StoreMode>(row,col,tmp);
+ }
+
+ template<int StoreMode, int LoadMode, typename PacketType>
+ void assignPacket(Index index)
+ {
+ PacketType tmp = m_src.template packet<LoadMode,PacketType>(index);
+ const_cast<SrcEvaluatorTypeT&>(m_src).template writePacket<LoadMode>(index, m_dst.template packet<StoreMode,PacketType>(index));
+ m_dst.template writePacket<StoreMode>(index,tmp);
+ }
+
+ // 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)
+ template<int StoreMode, int LoadMode, typename PacketType>
+ void assignPacketByOuterInner(Index outer, Index inner)
+ {
+ Index row = Base::rowIndexByOuterInner(outer, inner);
+ Index col = Base::colIndexByOuterInner(outer, inner);
+ assignPacket<StoreMode,LoadMode,PacketType>(row, col);
+ }
+};
+
+} // namespace internal
+
+} // end namespace Eigen
+
+#endif // EIGEN_SWAP_H