TensorDevice.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) 2014 Benoit Steiner <benoit.steiner.goog@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_CXX11_TENSOR_TENSOR_DEVICE_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
12 
13 namespace Eigen {
14 
27 template <typename ExpressionType, typename DeviceType> class TensorDevice {
28  public:
29  TensorDevice(const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {}
30 
31  template<typename OtherDerived>
32  EIGEN_STRONG_INLINE TensorDevice& operator=(const OtherDerived& other) {
34  Assign assign(m_expression, other);
36  return *this;
37  }
38 
39  template<typename OtherDerived>
40  EIGEN_STRONG_INLINE TensorDevice& operator+=(const OtherDerived& other) {
41  typedef typename OtherDerived::Scalar Scalar;
42  typedef TensorCwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ExpressionType, const OtherDerived> Sum;
43  Sum sum(m_expression, other);
45  Assign assign(m_expression, sum);
47  return *this;
48  }
49 
50  template<typename OtherDerived>
51  EIGEN_STRONG_INLINE TensorDevice& operator-=(const OtherDerived& other) {
52  typedef typename OtherDerived::Scalar Scalar;
53  typedef TensorCwiseBinaryOp<internal::scalar_difference_op<Scalar>, const ExpressionType, const OtherDerived> Difference;
54  Difference difference(m_expression, other);
56  Assign assign(m_expression, difference);
58  return *this;
59  }
60 
61  protected:
62  const DeviceType& m_device;
63  ExpressionType& m_expression;
64 };
65 
66 } // end namespace Eigen
67 
68 #endif // EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H
SCALAR Scalar
Definition: bench_gemm.cpp:33
#define EIGEN_STRONG_INLINE
Definition: Macros.h:494
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Pseudo expression providing an operator = that will evaluate its argument on the specified computing ...
Definition: TensorDevice.h:27
EIGEN_STRONG_INLINE TensorDevice & operator=(const OtherDerived &other)
Definition: TensorDevice.h:32
ExpressionType & m_expression
Definition: TensorDevice.h:63
EIGEN_STRONG_INLINE TensorDevice & operator-=(const OtherDerived &other)
Definition: TensorDevice.h:51
EIGEN_STRONG_INLINE TensorDevice & operator+=(const OtherDerived &other)
Definition: TensorDevice.h:40
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
Definition: mpreal.h:2381
static EIGEN_DEVICE_FUNC void run(const Expression &expr, const Device &device=Device())
TensorDevice(const DeviceType &device, ExpressionType &expression)
Definition: TensorDevice.h:29
const DeviceType & m_device
Definition: TensorDevice.h:62


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:45:20