TensorContraction.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_CONTRACTION_H
11 #define EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_H
12 
13 namespace Eigen {
14 
22 namespace internal {
23 
24 template<typename Dimensions, typename LhsXprType, typename RhsXprType>
25 struct traits<TensorContractionOp<Dimensions, LhsXprType, RhsXprType> >
26 {
27  // Type promotion to handle the case where the types of the lhs and the rhs are different.
30 
35  typedef typename LhsXprType::Nested LhsNested;
36  typedef typename RhsXprType::Nested RhsNested;
39 
40  // From NumDims below.
42  static const int Layout = traits<LhsXprType>::Layout;
43 
44  enum {
45  Flags = 0
46  };
47 };
48 
49 template<typename Dimensions, typename LhsXprType, typename RhsXprType>
50 struct eval<TensorContractionOp<Dimensions, LhsXprType, RhsXprType>, Eigen::Dense>
51 {
53 };
54 
55 template<typename Dimensions, typename LhsXprType, typename RhsXprType>
56 struct nested<TensorContractionOp<Dimensions, LhsXprType, RhsXprType>, 1, typename eval<TensorContractionOp<Dimensions, LhsXprType, RhsXprType> >::type>
57 {
59 };
60 
61 template<typename Indices_, typename LeftArgType_, typename RightArgType_, typename Device_>
62 struct traits<TensorEvaluator<const TensorContractionOp<Indices_, LeftArgType_, RightArgType_>, Device_> > {
63  typedef Indices_ Indices;
64  typedef LeftArgType_ LeftArgType;
65  typedef RightArgType_ RightArgType;
66  typedef Device_ Device;
67 
68  // From NumDims below.
70 };
71 
72 } // end namespace internal
73 
74 template<typename Indices, typename LhsXprType, typename RhsXprType>
75 class TensorContractionOp : public TensorBase<TensorContractionOp<Indices, LhsXprType, RhsXprType>, ReadOnlyAccessors>
76 {
77  public:
79  typedef typename internal::gebp_traits<typename LhsXprType::CoeffReturnType,
80  typename RhsXprType::CoeffReturnType>::ResScalar CoeffReturnType;
84 
86  const LhsXprType& lhs, const RhsXprType& rhs, const Indices& dims)
87  : m_lhs_xpr(lhs), m_rhs_xpr(rhs), m_indices(dims) {}
88 
89  EIGEN_DEVICE_FUNC
90  const Indices& indices() const { return m_indices; }
91 
93  EIGEN_DEVICE_FUNC
95  lhsExpression() const { return m_lhs_xpr; }
96 
97  EIGEN_DEVICE_FUNC
99  rhsExpression() const { return m_rhs_xpr; }
100 
101  protected:
102  typename LhsXprType::Nested m_lhs_xpr;
103  typename RhsXprType::Nested m_rhs_xpr;
104  const Indices m_indices;
105 };
106 
107 
108 template<typename Derived>
110 {
115 
118  typedef typename XprType::Index Index;
121 
122  enum {
123  IsAligned = true,
126  CoordAccess = false, // to be implemented
127  RawAccess = true
128  };
129 
130  // Most of the code is assuming that both input tensors are ColMajor. If the
131  // inputs are RowMajor, we will "cheat" by swapping the LHS and RHS:
132  // If we want to compute A * B = C, where A is LHS and B is RHS, the code
133  // will pretend B is LHS and A is RHS.
134  typedef typename internal::conditional<
135  static_cast<int>(Layout) == static_cast<int>(ColMajor), LeftArgType, RightArgType>::type EvalLeftArgType;
136  typedef typename internal::conditional<
137  static_cast<int>(Layout) == static_cast<int>(ColMajor), RightArgType, LeftArgType>::type EvalRightArgType;
138 
139  static const int LDims =
141  static const int RDims =
144  static const int NumDims = LDims + RDims - 2 * ContractDims;
145 
149 
151 
152  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
154  : m_leftImpl(choose(Cond<static_cast<int>(Layout) == static_cast<int>(ColMajor)>(),
155  op.lhsExpression(), op.rhsExpression()), device),
156  m_rightImpl(choose(Cond<static_cast<int>(Layout) == static_cast<int>(ColMajor)>(),
157  op.rhsExpression(), op.lhsExpression()), device),
158  m_device(device),
159  m_result(NULL) {
162  YOU_MADE_A_PROGRAMMING_MISTAKE);
163 
164 
165  DSizes<Index, LDims> eval_left_dims;
166  DSizes<Index, RDims> eval_right_dims;
167  array<IndexPair<Index>, ContractDims> eval_op_indices;
168  if (static_cast<int>(Layout) == static_cast<int>(ColMajor)) {
169  // For ColMajor, we keep using the existing dimensions
170  for (int i = 0; i < LDims; i++) {
171  eval_left_dims[i] = m_leftImpl.dimensions()[i];
172  }
173  for (int i = 0; i < RDims; i++) {
174  eval_right_dims[i] = m_rightImpl.dimensions()[i];
175  }
176  // We keep the pairs of contracting indices.
177  for (int i = 0; i < ContractDims; i++) {
178  eval_op_indices[i].first = op.indices()[i].first;
179  eval_op_indices[i].second = op.indices()[i].second;
180  }
181  } else {
182  // For RowMajor, we need to reverse the existing dimensions
183  for (int i = 0; i < LDims; i++) {
184  eval_left_dims[i] = m_leftImpl.dimensions()[LDims - i - 1];
185  }
186  for (int i = 0; i < RDims; i++) {
187  eval_right_dims[i] = m_rightImpl.dimensions()[RDims - i - 1];
188  }
189  // We need to flip all the pairs of contracting indices as well as
190  // reversing the dimensions.
191  for (int i = 0; i < ContractDims; i++) {
192  eval_op_indices[i].first = LDims - 1 - op.indices()[ContractDims - 1 - i].second;
193  eval_op_indices[i].second = RDims - 1 - op.indices()[ContractDims - 1 - i].first;
194  }
195  }
196 
197  // Check for duplicate axes and make sure the first index in eval_op_indices
198  // is increasing. Using O(n^2) sorting is OK since ContractDims is small
199  for (int i = 0; i < ContractDims; i++) {
200  for (int j = i + 1; j < ContractDims; j++) {
201  eigen_assert(eval_op_indices[j].first != eval_op_indices[i].first &&
202  eval_op_indices[j].second != eval_op_indices[i].second &&
203  "contraction axes should be unique");
204  if (eval_op_indices[j].first < eval_op_indices[i].first) {
205  numext::swap(eval_op_indices[j], eval_op_indices[i]);
206  }
207  }
208  }
209 
210  array<Index, LDims> lhs_strides;
211  lhs_strides[0] = 1;
212  for (int i = 0; i < LDims-1; ++i) {
213  lhs_strides[i+1] = lhs_strides[i] * eval_left_dims[i];
214  }
215 
216  array<Index, RDims> rhs_strides;
217  rhs_strides[0] = 1;
218  for (int i = 0; i < RDims-1; ++i) {
219  rhs_strides[i+1] = rhs_strides[i] * eval_right_dims[i];
220  }
221 
222  if (m_i_strides.size() > 0) m_i_strides[0] = 1;
223  if (m_j_strides.size() > 0) m_j_strides[0] = 1;
224  if (m_k_strides.size() > 0) m_k_strides[0] = 1;
225 
226  m_i_size = 1;
227  m_j_size = 1;
228  m_k_size = 1;
229 
230  // To compute the dimension, we simply concatenate the non-contracting
231  // dimensions of the left and then the right tensor. Additionally, we also
232  // compute the strides corresponding to the left non-contracting
233  // dimensions and right non-contracting dimensions.
235  int dim_idx = 0;
236  unsigned int nocontract_idx = 0;
237 
238  for (int i = 0; i < LDims; i++) {
239  // find if we are contracting on index i of left tensor
240  bool contracting = false;
241  for (int j = 0; j < ContractDims; j++) {
242  if (eval_op_indices[j].first == i) {
243  contracting = true;
244  break;
245  }
246  }
247  if (!contracting) {
248  // add dimension size to output dimensions
249  m_dimensions[dim_idx] = eval_left_dims[i];
250  m_left_nocontract_strides[nocontract_idx] = lhs_strides[i];
251  if (dim_idx != i) {
253  }
254  if (nocontract_idx+1 < internal::array_size<left_nocontract_t>::value) {
255  m_i_strides[nocontract_idx+1] =
256  m_i_strides[nocontract_idx] * eval_left_dims[i];
257  } else {
258  m_i_size = m_i_strides[nocontract_idx] * eval_left_dims[i];
259  }
260  dim_idx++;
261  nocontract_idx++;
262  }
263  }
264 
265  nocontract_idx = 0;
266  for (int i = 0; i < RDims; i++) {
267  bool contracting = false;
268  // find if we are contracting on index i of right tensor
269  for (int j = 0; j < ContractDims; j++) {
270  if (eval_op_indices[j].second == i) {
271  contracting = true;
272  break;
273  }
274  }
275  if (!contracting) {
276  m_dimensions[dim_idx] = eval_right_dims[i];
277  if (nocontract_idx+1 < internal::array_size<right_nocontract_t>::value) {
278  m_j_strides[nocontract_idx+1] =
279  m_j_strides[nocontract_idx] * eval_right_dims[i];
280  } else {
281  m_j_size = m_j_strides[nocontract_idx] * eval_right_dims[i];
282  }
283  m_right_nocontract_strides[nocontract_idx] = rhs_strides[i];
284  dim_idx++;
285  nocontract_idx++;
286  }
287  }
288 
289  // Now compute the strides corresponding to the contracting dimensions. We
290  // assumed above that non-contracting axes are represented in the same order
291  // in the matrix as they are in the tensor. This is not the case for
292  // contracting axes. As the contracting axes must be of the same size in
293  // each tensor, we'll only look at the first tensor here.
296  for (int i = 0; i < ContractDims; i++) {
297  Index left = eval_op_indices[i].first;
298  Index right = eval_op_indices[i].second;
299 
300  Index size = eval_left_dims[left];
301  eigen_assert(size == eval_right_dims[right] &&
302  "Contraction axes must be same size");
303 
304  if (i+1 < static_cast<int>(internal::array_size<contract_t>::value)) {
305  m_k_strides[i+1] = m_k_strides[i] * size;
306  } else {
307  m_k_size = m_k_strides[i] * size;
308  }
309  m_left_contracting_strides[i] = lhs_strides[left];
310  m_right_contracting_strides[i] = rhs_strides[right];
311 
312  if (i > 0 && right < eval_op_indices[i-1].second) {
314  }
315  if (right != i) {
317  }
318  }
319 
320  // If the layout is RowMajor, we need to reverse the m_dimensions
321  if (static_cast<int>(Layout) == static_cast<int>(RowMajor)) {
322  for (int i = 0, j = NumDims - 1; i < j; i++, j--) {
324  }
325  }
326  }
327 
328  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
329 
331  m_leftImpl.evalSubExprsIfNeeded(NULL);
332  m_rightImpl.evalSubExprsIfNeeded(NULL);
333  if (data) {
334  evalTo(data);
335  return false;
336  } else {
337  m_result = static_cast<Scalar *>(m_device.allocate(dimensions().TotalSize() * sizeof(Scalar)));
338  evalTo(m_result);
339  return true;
340  }
341  }
342 
343  EIGEN_DEVICE_FUNC void evalTo(Scalar* buffer) const {
344  if (this->m_lhs_inner_dim_contiguous) {
345  if (this->m_rhs_inner_dim_contiguous) {
346  if (this->m_rhs_inner_dim_reordered) {
347  static_cast<const Derived*>(this)->template evalProduct<true, true, true, Unaligned>(buffer);
348  }
349  else {
350  static_cast<const Derived*>(this)->template evalProduct<true, true, false, Unaligned>(buffer);
351  }
352  }
353  else {
354  if (this->m_rhs_inner_dim_reordered) {
355  static_cast<const Derived*>(this)->template evalProduct<true, false, true, Unaligned>(buffer);
356  }
357  else {
358  static_cast<const Derived*>(this)->template evalProduct<true, false, false, Unaligned>(buffer);
359  }
360  }
361  }
362  else {
363  if (this->m_rhs_inner_dim_contiguous) {
364  if (this->m_rhs_inner_dim_reordered) {
365  static_cast<const Derived*>(this)->template evalProduct<false, true, true, Unaligned>(buffer);
366  }
367  else {
368  static_cast<const Derived*>(this)->template evalProduct<false, true, false, Unaligned>(buffer);
369  }
370  }
371  else {
372  if (this->m_rhs_inner_dim_reordered) {
373  static_cast<const Derived*>(this)->template evalProduct<false, false, true, Unaligned>(buffer);
374  }
375  else {
376  static_cast<const Derived*>(this)->template evalProduct<false, false, false, Unaligned>(buffer);
377  }
378  }
379  }
380  }
381 
382  template <bool lhs_inner_dim_contiguous, bool rhs_inner_dim_contiguous, bool rhs_inner_dim_reordered, int Alignment>
383  EIGEN_DEVICE_FUNC void evalGemv(Scalar* buffer) const {
384  const Index rows = m_i_size;
385  const Index cols = m_k_size;
386 
389  typedef TensorEvaluator<EvalLeftArgType, Device> LeftEvaluator;
390  typedef TensorEvaluator<EvalRightArgType, Device> RightEvaluator;
393  const int lhs_alignment = LeftEvaluator::IsAligned ? Aligned : Unaligned;
394  const int rhs_alignment = RightEvaluator::IsAligned ? Aligned : Unaligned;
396  LeftEvaluator, left_nocontract_t,
397  contract_t, lhs_packet_size,
398  lhs_inner_dim_contiguous,
399  false, lhs_alignment> LhsMapper;
400 
402  RightEvaluator, right_nocontract_t,
403  contract_t, rhs_packet_size,
404  rhs_inner_dim_contiguous,
405  rhs_inner_dim_reordered, rhs_alignment> RhsMapper;
406 
411 
412  const Scalar alpha(1);
413  const Index resIncr(1);
414 
415  // zero out the result buffer (which must be of size at least rows * sizeof(Scalar)
416  m_device.memset(buffer, 0, rows * sizeof(Scalar));
417 
419  rows, cols, lhs, rhs,
420  buffer, resIncr, alpha);
421  }
422 
423  template <bool lhs_inner_dim_contiguous, bool rhs_inner_dim_contiguous, bool rhs_inner_dim_reordered, int Alignment>
424  EIGEN_DEVICE_FUNC void evalGemm(Scalar* buffer) const {
425  // columns in left side, rows in right side
426  const Index k = this->m_k_size;
427 
428  // rows in left side
429  const Index m = this->m_i_size;
430 
431  // columns in right side
432  const Index n = this->m_j_size;
433 
434  // zero out the result buffer (which must be of size at least m * n * sizeof(Scalar)
435  this->m_device.memset(buffer, 0, m * n * sizeof(Scalar));
436 
437  // define mr, nr, and all of my data mapper types
440  typedef typename internal::gebp_traits<LhsScalar, RhsScalar> Traits;
441 
442  const Index nr = Traits::nr;
443  const Index mr = Traits::mr;
444 
445  typedef TensorEvaluator<EvalLeftArgType, Device> LeftEvaluator;
446  typedef TensorEvaluator<EvalRightArgType, Device> RightEvaluator;
447 
450 
452  LeftEvaluator, left_nocontract_t,
453  contract_t, lhs_packet_size,
454  lhs_inner_dim_contiguous,
455  false, Unaligned> LhsMapper;
456 
458  RightEvaluator, right_nocontract_t,
459  contract_t, rhs_packet_size,
460  rhs_inner_dim_contiguous,
461  rhs_inner_dim_reordered, Unaligned> RhsMapper;
462 
464 
465  // Declare GEBP packing and kernel structs
468 
470 
471  // initialize data mappers
472  LhsMapper lhs(this->m_leftImpl, this->m_left_nocontract_strides, this->m_i_strides,
474 
475  RhsMapper rhs(this->m_rightImpl, this->m_right_nocontract_strides, this->m_j_strides,
477 
478  OutputMapper output(buffer, m);
479 
480  // Sizes of the blocks to load in cache. See the Goto paper for details.
482  const Index kc = blocking.kc();
483  const Index mc = numext::mini(m, blocking.mc());
484  const Index nc = numext::mini(n, blocking.nc());
485  const Index sizeA = mc * kc;
486  const Index sizeB = kc * nc;
487 
488  LhsScalar* blockA = static_cast<LhsScalar *>(this->m_device.allocate(sizeA * sizeof(LhsScalar)));
489  RhsScalar* blockB = static_cast<RhsScalar *>(this->m_device.allocate(sizeB * sizeof(RhsScalar)));
490 
491  for(Index i2=0; i2<m; i2+=mc)
492  {
493  const Index actual_mc = numext::mini(i2+mc,m)-i2;
494  for (Index k2 = 0; k2 < k; k2 += kc) {
495  // make sure we don't overshoot right edge of left matrix, then pack vertical panel
496  const Index actual_kc = numext::mini(k2 + kc, k) - k2;
497  pack_lhs(blockA, lhs.getSubMapper(i2, k2), actual_kc, actual_mc, 0, 0);
498 
499  // series of horizontal blocks
500  for (Index j2 = 0; j2 < n; j2 += nc) {
501  // make sure we don't overshoot right edge of right matrix, then pack block
502  const Index actual_nc = numext::mini(j2 + nc, n) - j2;
503  pack_rhs(blockB, rhs.getSubMapper(k2, j2), actual_kc, actual_nc, 0, 0);
504 
505  // call gebp (matrix kernel)
506  // The parameters here are copied from Eigen's GEMM implementation
507  gebp(output.getSubMapper(i2, j2), blockA, blockB, actual_mc, actual_kc, actual_nc, Scalar(1), -1, -1, 0, 0);
508  }
509  }
510  }
511 
512  this->m_device.deallocate(blockA);
513  this->m_device.deallocate(blockB);
514  }
515 
516  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup() {
517  m_leftImpl.cleanup();
518  m_rightImpl.cleanup();
519 
520  if (m_result != NULL) {
521  m_device.deallocate(m_result);
522  m_result = NULL;
523  }
524  }
525 
526  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
527  return m_result[index];
528  }
529 
530  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool) const {
531  return TensorOpCost(sizeof(CoeffReturnType), 0, 0);
532  }
533 
534  template<int LoadMode>
535  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const {
536  return internal::ploadt<PacketReturnType, LoadMode>(m_result + index);
537  }
538 
539  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar* data() const { return m_result; }
540 
541  protected:
542  // Prevent assignment
545 
549 
553 
558 
562 
565  const Device& m_device;
567 };
568 
569 
570 // evaluator for default device
571 template<typename Indices, typename LeftArgType, typename RightArgType, typename Device>
574  TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgType>, Device> > {
577 
580  typedef typename XprType::Index Index;
583 
584  enum {
586  };
587 
588  // Most of the code is assuming that both input tensors are ColMajor. If the
589  // inputs are RowMajor, we will "cheat" by swapping the LHS and RHS:
590  // If we want to compute A * B = C, where A is LHS and B is RHS, the code
591  // will pretend B is LHS and A is RHS.
592  typedef typename internal::conditional<
593  static_cast<int>(Layout) == static_cast<int>(ColMajor), LeftArgType, RightArgType>::type EvalLeftArgType;
594  typedef typename internal::conditional<
595  static_cast<int>(Layout) == static_cast<int>(ColMajor), RightArgType, LeftArgType>::type EvalRightArgType;
596 
597  static const int LDims =
599  static const int RDims =
601  static const int ContractDims = internal::array_size<Indices>::value;
602 
604  typedef array<Index, LDims - ContractDims> left_nocontract_t;
605  typedef array<Index, RDims - ContractDims> right_nocontract_t;
606 
607  static const int NumDims = LDims + RDims - 2 * ContractDims;
608 
609  // Could we use NumDimensions here?
611 
612  EIGEN_DEVICE_FUNC TensorEvaluator(const XprType& op, const Device& device) :
613  Base(op, device) { }
614 
615  template <bool lhs_inner_dim_contiguous, bool rhs_inner_dim_contiguous, bool rhs_inner_dim_reordered, int Alignment>
616  EIGEN_DEVICE_FUNC void evalProduct(Scalar* buffer) const {
617  if (this->m_j_size == 1) {
618  this->template evalGemv<lhs_inner_dim_contiguous, rhs_inner_dim_contiguous, rhs_inner_dim_reordered, Alignment>(buffer);
619  return;
620  }
621 
622  this->template evalGemm<lhs_inner_dim_contiguous, rhs_inner_dim_contiguous, rhs_inner_dim_reordered, Alignment>(buffer);
623  }
624 };
625 
626 } // end namespace Eigen
627 
628 #endif // EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_H
Eigen::TensorContractionEvaluatorBase::TensorContractionEvaluatorBase
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorContractionEvaluatorBase(const XprType &op, const Device &device)
Definition: TensorContraction.h:153
Eigen::TensorContractionEvaluatorBase::right_nocontract_t
array< Index, RDims - ContractDims > right_nocontract_t
Definition: TensorContraction.h:148
Eigen::TensorEvaluator::device
const Device & device() const
required by sycl in order to construct sycl buffer from raw pointer
Definition: TensorEvaluator.h:114
Eigen
Definition: common.h:73
Eigen::internal::traits< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::LhsNested
LhsXprType::Nested LhsNested
Definition: TensorContraction.h:35
Eigen::TensorContractionOp::m_indices
const Indices m_indices
Definition: TensorContraction.h:104
Eigen::TensorContractionEvaluatorBase::m_result
Scalar * m_result
Definition: TensorContraction.h:566
Eigen::TensorContractionEvaluatorBase::PacketAccess
@ PacketAccess
Definition: TensorContraction.h:124
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::TensorEvaluator
EIGEN_DEVICE_FUNC TensorEvaluator(const XprType &op, const Device &device)
Definition: TensorContraction.h:612
Eigen::TensorContractionEvaluatorBase::m_k_strides
contract_t m_k_strides
Definition: TensorContraction.h:546
Eigen::internal::gebp_traits
Definition: GeneralBlockPanelKernel.h:19
Eigen::internal::Rhs
@ Rhs
Definition: TensorContractionMapper.h:18
alpha
RealScalar alpha
Definition: level1_cplx_impl.h:125
Eigen::TensorContractionEvaluatorBase::LDims
static const int LDims
Definition: TensorContraction.h:139
Eigen::array< Index, ContractDims >
Eigen::TensorContractionEvaluatorBase::left_nocontract_t
array< Index, LDims - ContractDims > left_nocontract_t
Definition: TensorContraction.h:147
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::Dimensions
DSizes< Index, NumDims > Dimensions
Definition: TensorContraction.h:610
Eigen::internal::TensorContractionBlocking::kc
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index kc() const
Definition: TensorContractionBlocking.h:42
Eigen::internal::traits< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::Index
promote_index_type< typename traits< LhsXprType >::Index, typename traits< RhsXprType >::Index >::type Index
Definition: TensorContraction.h:34
Eigen::internal::nested
Definition: TensorTraits.h:170
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::EvalLeftArgType
internal::conditional< static_cast< int >Layout)==static_cast< int >ColMajor), LeftArgType, RightArgType >::type EvalLeftArgType
Definition: TensorContraction.h:593
Eigen::Unaligned
@ Unaligned
Definition: Constants.h:228
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::XprType
TensorContractionOp< Indices, LeftArgType, RightArgType > XprType
Definition: TensorContraction.h:578
Eigen::TensorContractionEvaluatorBase::PacketReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorContraction.h:120
Eigen::internal::TensorContractionBlocking::mc
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index mc() const
Definition: TensorContractionBlocking.h:43
Eigen::TensorContractionEvaluatorBase::m_dimensions
Dimensions m_dimensions
Definition: TensorContraction.h:544
Eigen::TensorContractionOp::Nested
Eigen::internal::nested< TensorContractionOp >::type Nested
Definition: TensorContraction.h:81
eigen_assert
#define eigen_assert(x)
Definition: Macros.h:579
Eigen::internal::traits< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::StorageKind
promote_storage_type< typename traits< LhsXprType >::StorageKind, typename traits< RhsXprType >::StorageKind >::ret StorageKind
Definition: TensorContraction.h:32
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::right_nocontract_t
array< Index, RDims - ContractDims > right_nocontract_t
Definition: TensorContraction.h:605
Eigen::TensorEvaluator::Index
Derived::Index Index
Definition: TensorEvaluator.h:30
Eigen::PacketType::type
internal::packet_traits< Scalar >::type type
Definition: TensorMeta.h:51
Eigen::internal::remove_all::type
T type
Definition: Meta.h:78
Eigen::TensorContractionEvaluatorBase::evalGemm
EIGEN_DEVICE_FUNC void evalGemm(Scalar *buffer) const
Definition: TensorContraction.h:424
Eigen::TensorContractionOp::indices
const EIGEN_DEVICE_FUNC Indices & indices() const
Definition: TensorContraction.h:90
Eigen::TensorContractionEvaluatorBase::CoordAccess
@ CoordAccess
Definition: TensorContraction.h:126
Eigen::TensorContractionEvaluatorBase::IsAligned
@ IsAligned
Definition: TensorContraction.h:123
Eigen::TensorContractionEvaluatorBase::EvalLeftArgType
internal::conditional< static_cast< int >Layout)==static_cast< int >ColMajor), LeftArgType, RightArgType >::type EvalLeftArgType
Definition: TensorContraction.h:135
Eigen::internal::traits< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::_LhsNested
remove_reference< LhsNested >::type _LhsNested
Definition: TensorContraction.h:37
Eigen::TensorContractionEvaluatorBase::m_j_strides
right_nocontract_t m_j_strides
Definition: TensorContraction.h:555
Eigen::TensorContractionEvaluatorBase::Device
internal::traits< Derived >::Device Device
Definition: TensorContraction.h:114
Scalar
SCALAR Scalar
Definition: common.h:84
Eigen::RowMajor
@ RowMajor
Definition: Constants.h:322
Eigen::TensorContractionOp::m_rhs_xpr
RhsXprType::Nested m_rhs_xpr
Definition: TensorContraction.h:103
ret
DenseIndex ret
Definition: level1_impl.h:59
Eigen::TensorContractionEvaluatorBase::m_rightImpl
TensorEvaluator< EvalRightArgType, Device > m_rightImpl
Definition: TensorContraction.h:564
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::CoeffReturnType
XprType::CoeffReturnType CoeffReturnType
Definition: TensorContraction.h:581
Eigen::internal::traits< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::Scalar
gebp_traits< typename remove_const< typename LhsXprType::Scalar >::type, typename remove_const< typename RhsXprType::Scalar >::type >::ResScalar Scalar
Definition: TensorContraction.h:29
Eigen::TensorContractionOp::lhsExpression
const EIGEN_DEVICE_FUNC internal::remove_all< typename LhsXprType::Nested >::type & lhsExpression() const
Definition: TensorContraction.h:95
Eigen::internal::TensorContractionBlocking::nc
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index nc() const
Definition: TensorContractionBlocking.h:44
Eigen::DSizes< Index, NumDims >
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::evalProduct
EIGEN_DEVICE_FUNC void evalProduct(Scalar *buffer) const
Definition: TensorContraction.h:616
Eigen::internal::traits< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::_RhsNested
remove_reference< RhsNested >::type _RhsNested
Definition: TensorContraction.h:38
Eigen::TensorContractionEvaluatorBase::evalSubExprsIfNeeded
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(Scalar *data)
Definition: TensorContraction.h:330
Eigen::internal::traits< TensorEvaluator< const TensorContractionOp< Indices_, LeftArgType_, RightArgType_ >, Device_ > >::LeftArgType
LeftArgType_ LeftArgType
Definition: TensorContraction.h:64
Eigen::TensorContractionEvaluatorBase::EvalRightArgType
internal::conditional< static_cast< int >Layout)==static_cast< int >ColMajor), RightArgType, LeftArgType >::type EvalRightArgType
Definition: TensorContraction.h:137
Eigen::internal::true_type
Definition: Meta.h:54
Eigen::TensorContractionEvaluatorBase::m_right_nocontract_strides
right_nocontract_t m_right_nocontract_strides
Definition: TensorContraction.h:557
Eigen::internal::remove_reference::type
T type
Definition: Meta.h:66
Eigen::TensorContractionEvaluatorBase::m_leftImpl
TensorEvaluator< EvalLeftArgType, Device > m_leftImpl
Definition: TensorContraction.h:563
Eigen::internal::traits< TensorEvaluator< const TensorContractionOp< Indices_, LeftArgType_, RightArgType_ >, Device_ > >::Device
Device_ Device
Definition: TensorContraction.h:66
Eigen::Cond
Definition: TensorMeta.h:15
Eigen::internal::TensorContractionBlocking
Definition: TensorContractionBlocking.h:25
Eigen::internal::nested< TensorContractionOp< Dimensions, LhsXprType, RhsXprType >, 1, typename eval< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::type >::type
TensorContractionOp< Dimensions, LhsXprType, RhsXprType > type
Definition: TensorContraction.h:58
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::Base
TensorContractionEvaluatorBase< Self > Base
Definition: TensorContraction.h:576
Eigen::TensorContractionOp::Scalar
Eigen::internal::traits< TensorContractionOp >::Scalar Scalar
Definition: TensorContraction.h:78
Eigen::TensorContractionEvaluatorBase::operator=
TensorContractionEvaluatorBase & operator=(const TensorContractionEvaluatorBase &)
Eigen::numext::mini
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
Definition: Eigen/src/Core/MathFunctions.h:817
Eigen::internal::unpacket_traits
Definition: XprHelper.h:158
Eigen::TensorContractionEvaluatorBase::cleanup
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void cleanup()
Definition: TensorContraction.h:516
Eigen::internal::eval< TensorContractionOp< Dimensions, LhsXprType, RhsXprType >, Eigen::Dense >::type
const typedef TensorContractionOp< Dimensions, LhsXprType, RhsXprType > & type
Definition: TensorContraction.h:52
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:494
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::contract_t
array< Index, ContractDims > contract_t
Definition: TensorContraction.h:603
Eigen::TensorContractionEvaluatorBase::Indices
internal::traits< Derived >::Indices Indices
Definition: TensorContraction.h:111
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::Self
TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device > Self
Definition: TensorContraction.h:575
Eigen::TensorContractionEvaluatorBase::RDims
static const int RDims
Definition: TensorContraction.h:141
Eigen::internal::gebp_kernel
Definition: GeneralBlockPanelKernel.h:859
Eigen::TensorContractionEvaluatorBase::evalGemv
EIGEN_DEVICE_FUNC void evalGemv(Scalar *buffer) const
Definition: TensorContraction.h:383
Eigen::TensorContractionEvaluatorBase::RawAccess
@ RawAccess
Definition: TensorContraction.h:127
Eigen::TensorContractionEvaluatorBase::ContractDims
static const int ContractDims
Definition: TensorContraction.h:143
Eigen::internal::TensorContractionInputMapper
Definition: TensorContractionMapper.h:436
Eigen::TensorContractionEvaluatorBase::coeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: TensorContraction.h:526
Eigen::TensorContractionEvaluatorBase::CoeffReturnType
XprType::CoeffReturnType CoeffReturnType
Definition: TensorContraction.h:119
Eigen::internal::promote_storage_type
Definition: XprHelper.h:498
Eigen::TensorContractionEvaluatorBase::m_j_size
Index m_j_size
Definition: TensorContraction.h:560
Eigen::TensorContractionEvaluatorBase::dimensions
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Dimensions & dimensions() const
Definition: TensorContraction.h:328
Eigen::Map< Matrix< Scalar, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> >
Eigen::TensorBase
The tensor base class.
Definition: TensorBase.h:829
Eigen::TensorContractionEvaluatorBase::Layout
@ Layout
Definition: TensorContraction.h:125
int
return int(ret)+1
Eigen::TensorContractionEvaluatorBase::XprType
TensorContractionOp< Indices, LeftArgType, RightArgType > XprType
Definition: TensorContraction.h:116
Eigen::TensorEvaluator::Layout
@ Layout
Definition: TensorEvaluator.h:43
Eigen::internal::gemm_pack_rhs
Definition: BlasUtil.h:25
Eigen::internal::array_size
Definition: EmulateArray.h:203
Eigen::TensorContractionEvaluatorBase::evalTo
EIGEN_DEVICE_FUNC void evalTo(Scalar *buffer) const
Definition: TensorContraction.h:343
Eigen::TensorContractionEvaluatorBase::NumDims
static const int NumDims
Definition: TensorContraction.h:144
Eigen::TensorContractionOp::TensorContractionOp
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorContractionOp(const LhsXprType &lhs, const RhsXprType &rhs, const Indices &dims)
Definition: TensorContraction.h:85
Eigen::TensorContractionEvaluatorBase::m_left_nocontract_strides
left_nocontract_t m_left_nocontract_strides
Definition: TensorContraction.h:556
Eigen::internal::remove_const::type
T type
Definition: Meta.h:73
Eigen::TensorContractionEvaluatorBase::Scalar
internal::remove_const< typename XprType::Scalar >::type Scalar
Definition: TensorContraction.h:117
Eigen::internal::blas_data_mapper
Definition: BlasUtil.h:192
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
Eigen::TensorContractionOp::m_lhs_xpr
LhsXprType::Nested m_lhs_xpr
Definition: TensorContraction.h:102
Eigen::internal::gemm_pack_lhs
Definition: BlasUtil.h:28
Eigen::TensorContractionEvaluatorBase::m_rhs_inner_dim_contiguous
bool m_rhs_inner_dim_contiguous
Definition: TensorContraction.h:551
EIGEN_STATIC_ASSERT
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:124
Eigen::numext::swap
EIGEN_STRONG_INLINE void swap(T &a, T &b)
Definition: Meta.h:493
Eigen::TensorContractionEvaluatorBase::m_rhs_inner_dim_reordered
bool m_rhs_inner_dim_reordered
Definition: TensorContraction.h:552
Eigen::TensorContractionOp::Index
Eigen::internal::traits< TensorContractionOp >::Index Index
Definition: TensorContraction.h:83
Eigen::internal::traits< TensorContractionOp< Dimensions, LhsXprType, RhsXprType > >::RhsNested
RhsXprType::Nested RhsNested
Definition: TensorContraction.h:36
Eigen::TensorContractionEvaluatorBase::data
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar * data() const
Definition: TensorContraction.h:539
Eigen::TensorContractionOp::CoeffReturnType
internal::gebp_traits< typename LhsXprType::CoeffReturnType, typename RhsXprType::CoeffReturnType >::ResScalar CoeffReturnType
Definition: TensorContraction.h:80
Eigen::internal::conditional
Definition: Meta.h:58
Eigen::TensorContractionEvaluatorBase::Dimensions
DSizes< Index, NumDims > Dimensions
Definition: TensorContraction.h:150
Eigen::array::size
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE std::size_t size()
Definition: EmulateArray.h:39
Eigen::TensorContractionOp
Definition: TensorContraction.h:75
Eigen::TensorContractionEvaluatorBase::contract_t
array< Index, ContractDims > contract_t
Definition: TensorContraction.h:146
Eigen::TensorSycl::run
void run(Expr &expr, Dev &dev)
Definition: TensorSyclRun.h:47
Eigen::TensorContractionEvaluatorBase::m_k_size
Index m_k_size
Definition: TensorContraction.h:561
Eigen::TensorContractionEvaluatorBase::costPerCoeff
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool) const
Definition: TensorContraction.h:530
Eigen::internal::traits< TensorEvaluator< const TensorContractionOp< Indices_, LeftArgType_, RightArgType_ >, Device_ > >::Indices
Indices_ Indices
Definition: TensorContraction.h:63
Eigen::TensorContractionOp::StorageKind
Eigen::internal::traits< TensorContractionOp >::StorageKind StorageKind
Definition: TensorContraction.h:82
Eigen::TensorContractionEvaluatorBase::m_left_contracting_strides
contract_t m_left_contracting_strides
Definition: TensorContraction.h:547
utility::tuple::size
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
Definition: TensorSyclTuple.h:143
Eigen::TensorEvaluator
A cost model used to limit the number of threads used for evaluating tensor expression.
Definition: TensorEvaluator.h:28
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::EvalRightArgType
internal::conditional< static_cast< int >Layout)==static_cast< int >ColMajor), RightArgType, LeftArgType >::type EvalRightArgType
Definition: TensorContraction.h:595
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::PacketReturnType
PacketType< CoeffReturnType, Device >::type PacketReturnType
Definition: TensorContraction.h:582
Eigen::TensorContractionEvaluatorBase::m_i_strides
left_nocontract_t m_i_strides
Definition: TensorContraction.h:554
Eigen::TensorContractionEvaluatorBase::RightArgType
internal::traits< Derived >::RightArgType RightArgType
Definition: TensorContraction.h:113
Eigen::TensorContractionOp::rhsExpression
const EIGEN_DEVICE_FUNC internal::remove_all< typename RhsXprType::Nested >::type & rhsExpression() const
Definition: TensorContraction.h:99
Eigen::TensorContractionEvaluatorBase::LeftArgType
internal::traits< Derived >::LeftArgType LeftArgType
Definition: TensorContraction.h:112
Eigen::internal::traits< TensorEvaluator< const TensorContractionOp< Indices_, LeftArgType_, RightArgType_ >, Device_ > >::RightArgType
RightArgType_ RightArgType
Definition: TensorContraction.h:65
internal
Definition: BandTriangularSolver.h:13
Eigen::internal::Lhs
@ Lhs
Definition: TensorContractionMapper.h:19
n
PlainMatrixType mat * n
Definition: eigenvalues.cpp:41
Eigen::TensorContractionEvaluatorBase::Index
XprType::Index Index
Definition: TensorContraction.h:118
Eigen::TensorContractionEvaluatorBase::m_lhs_inner_dim_contiguous
bool m_lhs_inner_dim_contiguous
Definition: TensorContraction.h:550
Eigen::choose
EIGEN_DEVICE_FUNC const EIGEN_ALWAYS_INLINE T1 & choose(Cond< true >, const T1 &first, const T2 &)
Definition: TensorMeta.h:18
Eigen::ColMajor
@ ColMajor
Definition: Constants.h:320
Eigen::internal::promote_index_type
Definition: XprHelper.h:97
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::left_nocontract_t
array< Index, LDims - ContractDims > left_nocontract_t
Definition: TensorContraction.h:604
Eigen::TensorContractionEvaluatorBase::packet
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const
Definition: TensorContraction.h:535
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::Index
XprType::Index Index
Definition: TensorContraction.h:580
Eigen::internal::eval
Definition: XprHelper.h:312
Eigen::TensorContractionEvaluatorBase
Definition: TensorContraction.h:109
Eigen::TensorContractionEvaluatorBase::m_right_contracting_strides
contract_t m_right_contracting_strides
Definition: TensorContraction.h:548
Eigen::TensorOpCost
Definition: TensorCostModel.h:25
Eigen::TensorContractionEvaluatorBase::m_device
const Device & m_device
Definition: TensorContraction.h:565
Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType >, Device >::Scalar
internal::remove_const< typename XprType::Scalar >::type Scalar
Definition: TensorContraction.h:579
Eigen::TensorContractionEvaluatorBase::m_i_size
Index m_i_size
Definition: TensorContraction.h:559
Eigen::Aligned
@ Aligned
Definition: Constants.h:235
Eigen::Dense
Definition: Constants.h:491


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:06:38