CoreEvaluators.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) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
5 // Copyright (C) 2011-2014 Gael Guennebaud <gael.guennebaud@inria.fr>
6 // Copyright (C) 2011-2012 Jitse Niesen <jitse@maths.leeds.ac.uk>
7 //
8 // This Source Code Form is subject to the terms of the Mozilla
9 // Public License v. 2.0. If a copy of the MPL was not distributed
10 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 
12 #ifndef EIGEN_COREEVALUATORS_H
13 #define EIGEN_COREEVALUATORS_H
14 
15 // IWYU pragma: private
16 #include "./InternalHeaderCheck.h"
17 
18 namespace Eigen {
19 
20 namespace internal {
21 
22 // This class returns the evaluator kind from the expression storage kind.
23 // Default assumes index based accessors
24 template <typename StorageKind>
26  typedef IndexBased Kind;
27 };
28 
29 // This class returns the evaluator shape from the expression storage kind.
30 // It can be Dense, Sparse, Triangular, Diagonal, SelfAdjoint, Band, etc.
31 template <typename StorageKind>
33 
34 template <>
36  typedef DenseShape Shape;
37 };
38 template <>
40  typedef SolverShape Shape;
41 };
42 template <>
45 };
46 template <>
49 };
50 
51 // Evaluators have to be specialized with respect to various criteria such as:
52 // - storage/structure/shape
53 // - scalar type
54 // - etc.
55 // Therefore, we need specialization of evaluator providing additional template arguments for each kind of evaluators.
56 // We currently distinguish the following kind of evaluators:
57 // - unary_evaluator for expressions taking only one arguments (CwiseUnaryOp, CwiseUnaryView, Transpose,
58 // MatrixWrapper, ArrayWrapper, Reverse, Replicate)
59 // - binary_evaluator for expression taking two arguments (CwiseBinaryOp)
60 // - ternary_evaluator for expression taking three arguments (CwiseTernaryOp)
61 // - product_evaluator for linear algebra products (Product); special case of binary_evaluator because it requires
62 // additional tags for dispatching.
63 // - mapbase_evaluator for Map, Block, Ref
64 // - block_evaluator for Block (special dispatching to a mapbase_evaluator or unary_evaluator)
65 
66 template <typename T, typename Arg1Kind = typename evaluator_traits<typename T::Arg1>::Kind,
67  typename Arg2Kind = typename evaluator_traits<typename T::Arg2>::Kind,
68  typename Arg3Kind = typename evaluator_traits<typename T::Arg3>::Kind,
69  typename Arg1Scalar = typename traits<typename T::Arg1>::Scalar,
70  typename Arg2Scalar = typename traits<typename T::Arg2>::Scalar,
71  typename Arg3Scalar = typename traits<typename T::Arg3>::Scalar>
73 
74 template <typename T, typename LhsKind = typename evaluator_traits<typename T::Lhs>::Kind,
75  typename RhsKind = typename evaluator_traits<typename T::Rhs>::Kind,
76  typename LhsScalar = typename traits<typename T::Lhs>::Scalar,
77  typename RhsScalar = typename traits<typename T::Rhs>::Scalar>
79 
80 template <typename T, typename Kind = typename evaluator_traits<typename T::NestedExpression>::Kind,
81  typename Scalar = typename T::Scalar>
83 
84 // evaluator_traits<T> contains traits for evaluator<T>
85 
86 template <typename T>
88  // by default, get evaluator kind and shape from storage
91 };
92 
93 // Default evaluator traits
94 template <typename T>
96 
97 template <typename T, typename Shape = typename evaluator_traits<T>::Shape>
99  static const bool value = false;
100 };
101 
102 // By default, we assume a unary expression:
103 template <typename T>
104 struct evaluator : public unary_evaluator<T> {
106  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const T& xpr) : Base(xpr) {}
107 };
108 
109 // TODO: Think about const-correctness
110 template <typename T>
111 struct evaluator<const T> : evaluator<T> {
112  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const T& xpr) : evaluator<T>(xpr) {}
113 };
114 
115 // ---------- base class for all evaluators ----------
116 
117 template <typename ExpressionType>
119  // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle
120  // outer,inner indices.
122 
123  enum { Alignment = 0 };
124  // noncopyable:
125  // Don't make this class inherit noncopyable as this kills EBO (Empty Base Optimization)
126  // and make complex evaluator much larger than then should do.
128 
129  private:
132 };
133 
134 // -------------------- Matrix and Array --------------------
135 //
136 // evaluator<PlainObjectBase> is a common base class for the
137 // Matrix and Array evaluators.
138 // Here we directly specialize evaluator. This is not really a unary expression, and it is, by definition, dense,
139 // so no need for more sophisticated dispatching.
140 
141 // this helper permits to completely eliminate m_outerStride if it is known at compiletime.
142 template <typename Scalar, int OuterStride>
144  public:
146  : data(ptr) {
147 #ifndef EIGEN_INTERNAL_DEBUGGING
149 #endif
151  }
153  const Scalar* data;
154 };
155 
156 template <typename Scalar>
158  public:
160  : data(ptr), m_outerStride(outerStride) {}
161  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index outerStride() const { return m_outerStride; }
162  const Scalar* data;
163 
164  protected:
166 };
167 
168 template <typename Derived>
169 struct evaluator<PlainObjectBase<Derived>> : evaluator_base<Derived> {
171  typedef typename PlainObjectType::Scalar Scalar;
172  typedef typename PlainObjectType::CoeffReturnType CoeffReturnType;
173 
174  enum {
175  IsRowMajor = PlainObjectType::IsRowMajor,
176  IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime,
177  RowsAtCompileTime = PlainObjectType::RowsAtCompileTime,
178  ColsAtCompileTime = PlainObjectType::ColsAtCompileTime,
179 
182  Alignment = traits<Derived>::Alignment
183  };
184  enum {
185  // We do not need to know the outer stride for vectors
186  OuterStrideAtCompileTime = IsVectorAtCompileTime ? 0
187  : int(IsRowMajor) ? ColsAtCompileTime
188  : RowsAtCompileTime
189  };
190 
191  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator() : m_d(0, OuterStrideAtCompileTime) {
192  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
193  }
194 
196  : m_d(m.data(), IsVectorAtCompileTime ? 0 : m.outerStride()) {
197  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
198  }
199 
201  if (IsRowMajor)
202  return m_d.data[row * m_d.outerStride() + col];
203  else
204  return m_d.data[row + col * m_d.outerStride()];
205  }
206 
207  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeff(Index index) const { return m_d.data[index]; }
208 
210  if (IsRowMajor)
211  return const_cast<Scalar*>(m_d.data)[row * m_d.outerStride() + col];
212  else
213  return const_cast<Scalar*>(m_d.data)[row + col * m_d.outerStride()];
214  }
215 
217  return const_cast<Scalar*>(m_d.data)[index];
218  }
219 
220  template <int LoadMode, typename PacketType>
222  if (IsRowMajor)
223  return ploadt<PacketType, LoadMode>(m_d.data + row * m_d.outerStride() + col);
224  else
225  return ploadt<PacketType, LoadMode>(m_d.data + row + col * m_d.outerStride());
226  }
227 
228  template <int LoadMode, typename PacketType>
230  return ploadt<PacketType, LoadMode>(m_d.data + index);
231  }
232 
233  template <int StoreMode, typename PacketType>
235  if (IsRowMajor)
236  return pstoret<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_d.data) + row * m_d.outerStride() + col, x);
237  else
238  return pstoret<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_d.data) + row + col * m_d.outerStride(), x);
239  }
240 
241  template <int StoreMode, typename PacketType>
243  return pstoret<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_d.data) + index, x);
244  }
245 
246  protected:
248 };
249 
250 template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
251 struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
252  : evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>> {
254 
256 
259 };
260 
261 template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
262 struct evaluator<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
263  : evaluator<PlainObjectBase<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>> {
265 
267 
270 };
271 
272 // -------------------- Transpose --------------------
273 
274 template <typename ArgType>
275 struct unary_evaluator<Transpose<ArgType>, IndexBased> : evaluator_base<Transpose<ArgType>> {
277 
278  enum {
282  };
283 
284  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {}
285 
286  typedef typename XprType::Scalar Scalar;
287  typedef typename XprType::CoeffReturnType CoeffReturnType;
288 
290  return m_argImpl.coeff(col, row);
291  }
292 
293  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const { return m_argImpl.coeff(index); }
294 
296 
298  return m_argImpl.coeffRef(index);
299  }
300 
301  template <int LoadMode, typename PacketType>
303  return m_argImpl.template packet<LoadMode, PacketType>(col, row);
304  }
305 
306  template <int LoadMode, typename PacketType>
308  return m_argImpl.template packet<LoadMode, PacketType>(index);
309  }
310 
311  template <int StoreMode, typename PacketType>
313  m_argImpl.template writePacket<StoreMode, PacketType>(col, row, x);
314  }
315 
316  template <int StoreMode, typename PacketType>
318  m_argImpl.template writePacket<StoreMode, PacketType>(index, x);
319  }
320 
321  protected:
323 };
324 
325 // -------------------- CwiseNullaryOp --------------------
326 // Like Matrix and Array, this is not really a unary expression, so we directly specialize evaluator.
327 // Likewise, there is not need to more sophisticated dispatching here.
328 
330  bool has_unary = has_unary_operator<NullaryOp>::value,
331  bool has_binary = has_binary_operator<NullaryOp>::value>
333  template <typename IndexType>
334  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const {
335  return op(i, j);
336  }
337  template <typename IndexType>
338  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const {
339  return op(i);
340  }
341 
342  template <typename T, typename IndexType>
343  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const {
344  return op.template packetOp<T>(i, j);
345  }
346  template <typename T, typename IndexType>
347  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const {
348  return op.template packetOp<T>(i);
349  }
350 };
351 
352 template <typename Scalar, typename NullaryOp>
353 struct nullary_wrapper<Scalar, NullaryOp, true, false, false> {
354  template <typename IndexType>
355  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType = 0, IndexType = 0) const {
356  return op();
357  }
358  template <typename T, typename IndexType>
359  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType = 0, IndexType = 0) const {
360  return op.template packetOp<T>();
361  }
362 };
363 
364 template <typename Scalar, typename NullaryOp>
365 struct nullary_wrapper<Scalar, NullaryOp, false, false, true> {
366  template <typename IndexType>
367  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j = 0) const {
368  return op(i, j);
369  }
370  template <typename T, typename IndexType>
371  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j = 0) const {
372  return op.template packetOp<T>(i, j);
373  }
374 };
375 
376 // We need the following specialization for vector-only functors assigned to a runtime vector,
377 // for instance, using linspace and assigning a RowVectorXd to a MatrixXd or even a row of a MatrixXd.
378 // In this case, i==0 and j is used for the actual iteration.
379 template <typename Scalar, typename NullaryOp>
380 struct nullary_wrapper<Scalar, NullaryOp, false, true, false> {
381  template <typename IndexType>
382  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const {
383  eigen_assert(i == 0 || j == 0);
384  return op(i + j);
385  }
386  template <typename T, typename IndexType>
387  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const {
388  eigen_assert(i == 0 || j == 0);
389  return op.template packetOp<T>(i + j);
390  }
391 
392  template <typename IndexType>
393  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const {
394  return op(i);
395  }
396  template <typename T, typename IndexType>
397  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const {
398  return op.template packetOp<T>(i);
399  }
400 };
401 
402 template <typename Scalar, typename NullaryOp>
403 struct nullary_wrapper<Scalar, NullaryOp, false, false, false> {};
404 
405 #if 0 && EIGEN_COMP_MSVC > 0
406 // Disable this ugly workaround. This is now handled in traits<Ref>::match,
407 // but this piece of code might still become handly if some other weird compilation
408 // errors pop up again.
409 
410 // MSVC exhibits a weird compilation error when
411 // compiling:
412 // Eigen::MatrixXf A = MatrixXf::Random(3,3);
413 // Ref<const MatrixXf> R = 2.f*A;
414 // and that has_*ary_operator<scalar_constant_op<float>> have not been instantiated yet.
415 // The "problem" is that evaluator<2.f*A> is instantiated by traits<Ref>::match<2.f*A>
416 // and at that time has_*ary_operator<T> returns true regardless of T.
417 // Then nullary_wrapper is badly instantiated as nullary_wrapper<.,.,true,true,true>.
418 // The trick is thus to defer the proper instantiation of nullary_wrapper when coeff(),
419 // and packet() are really instantiated as implemented below:
420 
421 // This is a simple wrapper around Index to enforce the re-instantiation of
422 // has_*ary_operator when needed.
423 template<typename T> struct nullary_wrapper_workaround_msvc {
424  nullary_wrapper_workaround_msvc(const T&);
425  operator T()const;
426 };
427 
428 template<typename Scalar,typename NullaryOp>
429 struct nullary_wrapper<Scalar,NullaryOp,true,true,true>
430 {
431  template <typename IndexType>
432  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const {
433  return nullary_wrapper<Scalar,NullaryOp,
434  has_nullary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
435  has_unary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
436  has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().operator()(op,i,j);
437  }
438  template <typename IndexType>
439  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const {
440  return nullary_wrapper<Scalar,NullaryOp,
441  has_nullary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
442  has_unary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
443  has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().operator()(op,i);
444  }
445 
446  template <typename T, typename IndexType>
447  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const {
448  return nullary_wrapper<Scalar,NullaryOp,
449  has_nullary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
450  has_unary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
451  has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().template packetOp<T>(op,i,j);
452  }
453  template <typename T, typename IndexType>
454  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const {
455  return nullary_wrapper<Scalar,NullaryOp,
456  has_nullary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
457  has_unary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
458  has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().template packetOp<T>(op,i);
459  }
460 };
461 #endif // MSVC workaround
462 
463 template <typename NullaryOp, typename PlainObjectType>
464 struct evaluator<CwiseNullaryOp<NullaryOp, PlainObjectType>>
465  : evaluator_base<CwiseNullaryOp<NullaryOp, PlainObjectType>> {
468 
469  enum {
471 
476  Alignment = AlignedMax
477  };
478 
479  EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n) : m_functor(n.functor()), m_wrapper() {
480  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
481  }
482 
483  typedef typename XprType::CoeffReturnType CoeffReturnType;
484 
485  template <typename IndexType>
487  return m_wrapper(m_functor, row, col);
488  }
489 
490  template <typename IndexType>
492  return m_wrapper(m_functor, index);
493  }
494 
495  template <int LoadMode, typename PacketType, typename IndexType>
497  return m_wrapper.template packetOp<PacketType>(m_functor, row, col);
498  }
499 
500  template <int LoadMode, typename PacketType, typename IndexType>
502  return m_wrapper.template packetOp<PacketType>(m_functor, index);
503  }
504 
505  protected:
506  const NullaryOp m_functor;
508 };
509 
510 // -------------------- CwiseUnaryOp --------------------
511 
512 template <typename UnaryOp, typename ArgType>
513 struct unary_evaluator<CwiseUnaryOp<UnaryOp, ArgType>, IndexBased> : evaluator_base<CwiseUnaryOp<UnaryOp, ArgType>> {
515 
516  enum {
518 
522  };
523 
526  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
527  }
528 
529  typedef typename XprType::CoeffReturnType CoeffReturnType;
530 
532  return m_d.func()(m_d.argImpl.coeff(row, col));
533  }
534 
536  return m_d.func()(m_d.argImpl.coeff(index));
537  }
538 
539  template <int LoadMode, typename PacketType>
541  return m_d.func().packetOp(m_d.argImpl.template packet<LoadMode, PacketType>(row, col));
542  }
543 
544  template <int LoadMode, typename PacketType>
546  return m_d.func().packetOp(m_d.argImpl.template packet<LoadMode, PacketType>(index));
547  }
548 
549  protected:
550  // this helper permits to completely eliminate the functor if it is empty
551  struct Data {
553  : op(xpr.functor()), argImpl(xpr.nestedExpression()) {}
554  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& func() const { return op; }
555  UnaryOp op;
557  };
558 
559  Data m_d;
560 };
561 
562 // ----------------------- Casting ---------------------
563 
564 template <typename SrcType, typename DstType, typename ArgType>
565 struct unary_evaluator<CwiseUnaryOp<core_cast_op<SrcType, DstType>, ArgType>, IndexBased> {
568 
569  // Use the largest packet type by default
571  static constexpr int SrcPacketSize = unpacket_traits<SrcPacketType>::size;
572  static constexpr int SrcPacketBytes = SrcPacketSize * sizeof(SrcType);
573 
574  enum {
581  };
582 
584  : m_argImpl(xpr.nestedExpression()), m_rows(xpr.rows()), m_cols(xpr.cols()) {
586  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
587  }
588 
589  template <typename DstPacketType>
590  using AltSrcScalarOp = std::enable_if_t<(unpacket_traits<DstPacketType>::size < SrcPacketSize &&
592  bool>;
593  template <typename DstPacketType>
596  template <typename DstPacketType>
597  using SrcPacketArgs2 = std::enable_if_t<(unpacket_traits<DstPacketType>::size) == (2 * SrcPacketSize), bool>;
598  template <typename DstPacketType>
599  using SrcPacketArgs4 = std::enable_if_t<(unpacket_traits<DstPacketType>::size) == (4 * SrcPacketSize), bool>;
600  template <typename DstPacketType>
601  using SrcPacketArgs8 = std::enable_if_t<(unpacket_traits<DstPacketType>::size) == (8 * SrcPacketSize), bool>;
602 
603  template <bool UseRowMajor = IsRowMajor, std::enable_if_t<UseRowMajor, bool> = true>
605  return col + packetSize <= cols();
606  }
607  template <bool UseRowMajor = IsRowMajor, std::enable_if_t<!UseRowMajor, bool> = true>
609  return row + packetSize <= rows();
610  }
612  return index + packetSize <= size();
613  }
614 
616  Index actualRow = IsRowMajor ? row : row + offset;
617  Index actualCol = IsRowMajor ? col + offset : col;
618  return m_argImpl.coeff(actualRow, actualCol);
619  }
621  Index actualIndex = index + offset;
622  return m_argImpl.coeff(actualIndex);
623  }
624 
626  return cast<SrcType, DstType>(srcCoeff(row, col, 0));
627  }
629  return cast<SrcType, DstType>(srcCoeff(index, 0));
630  }
631 
632  template <int LoadMode, typename PacketType = SrcPacketType>
634  constexpr int PacketSize = unpacket_traits<PacketType>::size;
635  Index actualRow = IsRowMajor ? row : row + (offset * PacketSize);
636  Index actualCol = IsRowMajor ? col + (offset * PacketSize) : col;
637  eigen_assert(check_array_bounds(actualRow, actualCol, PacketSize) && "Array index out of bounds");
638  return m_argImpl.template packet<LoadMode, PacketType>(actualRow, actualCol);
639  }
640  template <int LoadMode, typename PacketType = SrcPacketType>
642  constexpr int PacketSize = unpacket_traits<PacketType>::size;
643  Index actualIndex = index + (offset * PacketSize);
644  eigen_assert(check_array_bounds(actualIndex, PacketSize) && "Array index out of bounds");
645  return m_argImpl.template packet<LoadMode, PacketType>(actualIndex);
646  }
647 
648  // There is no source packet type with equal or fewer elements than DstPacketType.
649  // This is problematic as the evaluation loop may attempt to access data outside the bounds of the array.
650  // For example, consider the cast utilizing pcast<Packet4f,Packet2d> with an array of size 4: {0.0f,1.0f,2.0f,3.0f}.
651  // The first iteration of the evaluation loop will load 16 bytes: {0.0f,1.0f,2.0f,3.0f} and cast to {0.0,1.0}, which
652  // is acceptable. The second iteration will load 16 bytes: {2.0f,3.0f,?,?}, which is outside the bounds of the array.
653 
654  // Instead, perform runtime check to determine if the load would access data outside the bounds of the array.
655  // If not, perform full load. Otherwise, revert to a scalar loop to perform a partial load.
656  // In either case, perform a vectorized cast of the source packet.
657  template <int LoadMode, typename DstPacketType, AltSrcScalarOp<DstPacketType> = true>
659  constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
660  constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
661  constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
662  SrcPacketType src;
663  if (EIGEN_PREDICT_TRUE(check_array_bounds(row, col, SrcPacketSize))) {
664  src = srcPacket<SrcLoadMode>(row, col, 0);
665  } else {
667  for (size_t k = 0; k < DstPacketSize; k++) srcArray[k] = srcCoeff(row, col, k);
668  for (size_t k = DstPacketSize; k < SrcPacketSize; k++) srcArray[k] = SrcType(0);
669  src = pload<SrcPacketType>(srcArray.data());
670  }
671  return pcast<SrcPacketType, DstPacketType>(src);
672  }
673  // Use the source packet type with the same size as DstPacketType, if it exists
674  template <int LoadMode, typename DstPacketType, SrcPacketArgs1<DstPacketType> = true>
676  constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
677  using SizedSrcPacketType = typename find_packet_by_size<SrcType, DstPacketSize>::type;
678  constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
679  constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
680  return pcast<SizedSrcPacketType, DstPacketType>(srcPacket<SrcLoadMode, SizedSrcPacketType>(row, col, 0));
681  }
682  // unpacket_traits<DstPacketType>::size == 2 * SrcPacketSize
683  template <int LoadMode, typename DstPacketType, SrcPacketArgs2<DstPacketType> = true>
685  constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
686  return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(row, col, 0),
687  srcPacket<SrcLoadMode>(row, col, 1));
688  }
689  // unpacket_traits<DstPacketType>::size == 4 * SrcPacketSize
690  template <int LoadMode, typename DstPacketType, SrcPacketArgs4<DstPacketType> = true>
692  constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
693  return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(row, col, 0), srcPacket<SrcLoadMode>(row, col, 1),
694  srcPacket<SrcLoadMode>(row, col, 2),
695  srcPacket<SrcLoadMode>(row, col, 3));
696  }
697  // unpacket_traits<DstPacketType>::size == 8 * SrcPacketSize
698  template <int LoadMode, typename DstPacketType, SrcPacketArgs8<DstPacketType> = true>
700  constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
701  return pcast<SrcPacketType, DstPacketType>(
702  srcPacket<SrcLoadMode>(row, col, 0), srcPacket<SrcLoadMode>(row, col, 1), srcPacket<SrcLoadMode>(row, col, 2),
703  srcPacket<SrcLoadMode>(row, col, 3), srcPacket<SrcLoadMode>(row, col, 4), srcPacket<SrcLoadMode>(row, col, 5),
704  srcPacket<SrcLoadMode>(row, col, 6), srcPacket<SrcLoadMode>(row, col, 7));
705  }
706 
707  // Analogous routines for linear access.
708  template <int LoadMode, typename DstPacketType, AltSrcScalarOp<DstPacketType> = true>
709  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
710  constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
711  constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
712  constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
713  SrcPacketType src;
714  if (EIGEN_PREDICT_TRUE(check_array_bounds(index, SrcPacketSize))) {
715  src = srcPacket<SrcLoadMode>(index, 0);
716  } else {
718  for (size_t k = 0; k < DstPacketSize; k++) srcArray[k] = srcCoeff(index, k);
719  for (size_t k = DstPacketSize; k < SrcPacketSize; k++) srcArray[k] = SrcType(0);
720  src = pload<SrcPacketType>(srcArray.data());
721  }
722  return pcast<SrcPacketType, DstPacketType>(src);
723  }
724  template <int LoadMode, typename DstPacketType, SrcPacketArgs1<DstPacketType> = true>
725  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
726  constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
727  using SizedSrcPacketType = typename find_packet_by_size<SrcType, DstPacketSize>::type;
728  constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
729  constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
730  return pcast<SizedSrcPacketType, DstPacketType>(srcPacket<SrcLoadMode, SizedSrcPacketType>(index, 0));
731  }
732  template <int LoadMode, typename DstPacketType, SrcPacketArgs2<DstPacketType> = true>
733  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
734  constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
735  return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(index, 0), srcPacket<SrcLoadMode>(index, 1));
736  }
737  template <int LoadMode, typename DstPacketType, SrcPacketArgs4<DstPacketType> = true>
738  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
739  constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
740  return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(index, 0), srcPacket<SrcLoadMode>(index, 1),
741  srcPacket<SrcLoadMode>(index, 2), srcPacket<SrcLoadMode>(index, 3));
742  }
743  template <int LoadMode, typename DstPacketType, SrcPacketArgs8<DstPacketType> = true>
744  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
745  constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
746  return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(index, 0), srcPacket<SrcLoadMode>(index, 1),
747  srcPacket<SrcLoadMode>(index, 2), srcPacket<SrcLoadMode>(index, 3),
748  srcPacket<SrcLoadMode>(index, 4), srcPacket<SrcLoadMode>(index, 5),
749  srcPacket<SrcLoadMode>(index, 6), srcPacket<SrcLoadMode>(index, 7));
750  }
751 
752  constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const { return m_rows; }
753  constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const { return m_cols; }
754  constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const { return m_rows * m_cols; }
755 
756  protected:
760 };
761 
762 // -------------------- CwiseTernaryOp --------------------
763 
764 // this is a ternary expression
765 template <typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
766 struct evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>>
767  : public ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> {
770 
771  EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {}
772 };
773 
774 template <typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
775 struct ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>, IndexBased, IndexBased>
776  : evaluator_base<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> {
778 
779  enum {
782 
788  StorageOrdersAgree = (int(Arg1Flags) & RowMajorBit) == (int(Arg2Flags) & RowMajorBit) &&
789  (int(Arg1Flags) & RowMajorBit) == (int(Arg3Flags) & RowMajorBit),
790  Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) &
791  (HereditaryBits |
792  (int(Arg1Flags) & int(Arg2Flags) & int(Arg3Flags) &
793  ((StorageOrdersAgree ? LinearAccessBit : 0) |
794  (functor_traits<TernaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)))),
795  Flags = (Flags0 & ~RowMajorBit) | (Arg1Flags & RowMajorBit),
798  };
799 
800  EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) : m_d(xpr) {
802  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
803  }
804 
805  typedef typename XprType::CoeffReturnType CoeffReturnType;
806 
808  return m_d.func()(m_d.arg1Impl.coeff(row, col), m_d.arg2Impl.coeff(row, col), m_d.arg3Impl.coeff(row, col));
809  }
810 
812  return m_d.func()(m_d.arg1Impl.coeff(index), m_d.arg2Impl.coeff(index), m_d.arg3Impl.coeff(index));
813  }
814 
815  template <int LoadMode, typename PacketType>
817  return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode, PacketType>(row, col),
818  m_d.arg2Impl.template packet<LoadMode, PacketType>(row, col),
819  m_d.arg3Impl.template packet<LoadMode, PacketType>(row, col));
820  }
821 
822  template <int LoadMode, typename PacketType>
824  return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode, PacketType>(index),
825  m_d.arg2Impl.template packet<LoadMode, PacketType>(index),
826  m_d.arg3Impl.template packet<LoadMode, PacketType>(index));
827  }
828 
829  protected:
830  // this helper permits to completely eliminate the functor if it is empty
831  struct Data {
833  : op(xpr.functor()), arg1Impl(xpr.arg1()), arg2Impl(xpr.arg2()), arg3Impl(xpr.arg3()) {}
834  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TernaryOp& func() const { return op; }
835  TernaryOp op;
839  };
840 
841  Data m_d;
842 };
843 
844 // specialization for expressions like (a < b).select(c, d) to enable full vectorization
845 template <typename Arg1, typename Arg2, typename Scalar, typename CmpLhsType, typename CmpRhsType, ComparisonName cmp>
847  CwiseBinaryOp<scalar_cmp_op<Scalar, Scalar, cmp, false>, CmpLhsType, CmpRhsType>>>
848  : public ternary_evaluator<
849  CwiseTernaryOp<scalar_boolean_select_op<Scalar, Scalar, Scalar>, Arg1, Arg2,
850  CwiseBinaryOp<scalar_cmp_op<Scalar, Scalar, cmp, true>, CmpLhsType, CmpRhsType>>> {
854 
858 
860 
862  : Base(XprType(xpr.arg1(), xpr.arg2(), Arg3(xpr.arg3().lhs(), xpr.arg3().rhs()))) {}
863 };
864 
865 // -------------------- CwiseBinaryOp --------------------
866 
867 // this is a binary expression
868 template <typename BinaryOp, typename Lhs, typename Rhs>
869 struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> : public binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
872 
874 };
875 
876 template <typename BinaryOp, typename Lhs, typename Rhs>
878  : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
880 
881  enum {
882  CoeffReadCost =
884 
888  StorageOrdersAgree = (int(LhsFlags) & RowMajorBit) == (int(RhsFlags) & RowMajorBit),
889  Flags0 = (int(LhsFlags) | int(RhsFlags)) &
890  (HereditaryBits |
891  (int(LhsFlags) & int(RhsFlags) &
892  ((StorageOrdersAgree ? LinearAccessBit : 0) |
893  (functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)))),
894  Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit),
896  };
897 
900  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
901  }
902 
903  typedef typename XprType::CoeffReturnType CoeffReturnType;
904 
906  return m_d.func()(m_d.lhsImpl.coeff(row, col), m_d.rhsImpl.coeff(row, col));
907  }
908 
910  return m_d.func()(m_d.lhsImpl.coeff(index), m_d.rhsImpl.coeff(index));
911  }
912 
913  template <int LoadMode, typename PacketType>
915  return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode, PacketType>(row, col),
916  m_d.rhsImpl.template packet<LoadMode, PacketType>(row, col));
917  }
918 
919  template <int LoadMode, typename PacketType>
921  return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode, PacketType>(index),
922  m_d.rhsImpl.template packet<LoadMode, PacketType>(index));
923  }
924 
925  protected:
926  // this helper permits to completely eliminate the functor if it is empty
927  struct Data {
929  : op(xpr.functor()), lhsImpl(xpr.lhs()), rhsImpl(xpr.rhs()) {}
930  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const BinaryOp& func() const { return op; }
931  BinaryOp op;
934  };
935 
936  Data m_d;
937 };
938 
939 // -------------------- CwiseUnaryView --------------------
940 
941 template <typename UnaryOp, typename ArgType, typename StrideType>
942 struct unary_evaluator<CwiseUnaryView<UnaryOp, ArgType, StrideType>, IndexBased>
943  : evaluator_base<CwiseUnaryView<UnaryOp, ArgType, StrideType>> {
945 
946  enum {
948 
950 
951  Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost...
952  };
953 
954  EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : m_d(op) {
956  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
957  }
958 
959  typedef typename XprType::Scalar Scalar;
960  typedef typename XprType::CoeffReturnType CoeffReturnType;
961 
963  return m_d.func()(m_d.argImpl.coeff(row, col));
964  }
965 
967  return m_d.func()(m_d.argImpl.coeff(index));
968  }
969 
971  return m_d.func()(m_d.argImpl.coeffRef(row, col));
972  }
973 
975  return m_d.func()(m_d.argImpl.coeffRef(index));
976  }
977 
978  protected:
979  // this helper permits to completely eliminate the functor if it is empty
980  struct Data {
982  : op(xpr.functor()), argImpl(xpr.nestedExpression()) {}
983  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& func() const { return op; }
984  UnaryOp op;
986  };
987 
988  Data m_d;
989 };
990 
991 // -------------------- Map --------------------
992 
993 // FIXME perhaps the PlainObjectType could be provided by Derived::PlainObject ?
994 // but that might complicate template specialization
995 template <typename Derived, typename PlainObjectType>
996 struct mapbase_evaluator;
997 
998 template <typename Derived, typename PlainObjectType>
1000  typedef Derived XprType;
1001  typedef typename XprType::PointerType PointerType;
1002  typedef typename XprType::Scalar Scalar;
1003  typedef typename XprType::CoeffReturnType CoeffReturnType;
1004 
1005  enum {
1006  IsRowMajor = XprType::RowsAtCompileTime,
1007  ColsAtCompileTime = XprType::ColsAtCompileTime,
1009  };
1010 
1012  : m_data(const_cast<PointerType>(map.data())),
1013  m_innerStride(map.innerStride()),
1014  m_outerStride(map.outerStride()) {
1017  PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
1019  }
1020 
1022  return m_data[col * colStride() + row * rowStride()];
1023  }
1024 
1026  return m_data[index * m_innerStride.value()];
1027  }
1028 
1030  return m_data[col * colStride() + row * rowStride()];
1031  }
1032 
1034 
1035  template <int LoadMode, typename PacketType>
1037  PointerType ptr = m_data + row * rowStride() + col * colStride();
1038  return internal::ploadt<PacketType, LoadMode>(ptr);
1039  }
1040 
1041  template <int LoadMode, typename PacketType>
1043  return internal::ploadt<PacketType, LoadMode>(m_data + index * m_innerStride.value());
1044  }
1045 
1046  template <int StoreMode, typename PacketType>
1048  PointerType ptr = m_data + row * rowStride() + col * colStride();
1049  return internal::pstoret<Scalar, PacketType, StoreMode>(ptr, x);
1050  }
1051 
1052  template <int StoreMode, typename PacketType>
1054  internal::pstoret<Scalar, PacketType, StoreMode>(m_data + index * m_innerStride.value(), x);
1055  }
1056 
1057  protected:
1059  return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value();
1060  }
1062  return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value();
1063  }
1064 
1068 };
1069 
1070 template <typename PlainObjectType, int MapOptions, typename StrideType>
1071 struct evaluator<Map<PlainObjectType, MapOptions, StrideType>>
1072  : public mapbase_evaluator<Map<PlainObjectType, MapOptions, StrideType>, PlainObjectType> {
1074  typedef typename XprType::Scalar Scalar;
1075  // TODO: should check for smaller packet types once we can handle multi-sized packet types
1077 
1078  enum {
1079  InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
1080  ? int(PlainObjectType::InnerStrideAtCompileTime)
1081  : int(StrideType::InnerStrideAtCompileTime),
1082  OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
1083  ? int(PlainObjectType::OuterStrideAtCompileTime)
1084  : int(StrideType::OuterStrideAtCompileTime),
1085  HasNoInnerStride = InnerStrideAtCompileTime == 1,
1086  HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
1087  HasNoStride = HasNoInnerStride && HasNoOuterStride,
1088  IsDynamicSize = PlainObjectType::SizeAtCompileTime == Dynamic,
1089 
1090  PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit),
1091  LinearAccessMask =
1092  bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit),
1093  Flags = int(evaluator<PlainObjectType>::Flags) & (LinearAccessMask & PacketAccessMask),
1094 
1095  Alignment = int(MapOptions) & int(AlignedMask)
1096  };
1097 
1098  EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) : mapbase_evaluator<XprType, PlainObjectType>(map) {}
1099 };
1100 
1101 // -------------------- Ref --------------------
1102 
1103 template <typename PlainObjectType, int RefOptions, typename StrideType>
1104 struct evaluator<Ref<PlainObjectType, RefOptions, StrideType>>
1105  : public mapbase_evaluator<Ref<PlainObjectType, RefOptions, StrideType>, PlainObjectType> {
1107 
1108  enum {
1111  };
1112 
1114  : mapbase_evaluator<XprType, PlainObjectType>(ref) {}
1115 };
1116 
1117 // -------------------- Block --------------------
1118 
1119 template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel,
1120  bool HasDirectAccess = internal::has_direct_access<ArgType>::ret>
1122 
1123 template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1124 struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>>
1125  : block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel> {
1127  typedef typename XprType::Scalar Scalar;
1128  // TODO: should check for smaller packet types once we can handle multi-sized packet types
1130 
1131  enum {
1133 
1138 
1139  ArgTypeIsRowMajor = (int(evaluator<ArgType>::Flags) & RowMajorBit) != 0,
1140  IsRowMajor = (MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1) ? 1
1141  : (MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1) ? 0
1142  : ArgTypeIsRowMajor,
1143  HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor),
1144  InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
1145  InnerStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(inner_stride_at_compile_time<ArgType>::ret)
1147  OuterStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(outer_stride_at_compile_time<ArgType>::ret)
1149  MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0,
1150 
1151  FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 ||
1152  (InnerPanel && (evaluator<ArgType>::Flags & LinearAccessBit)))
1153  ? LinearAccessBit
1154  : 0,
1155  FlagsRowMajorBit = XprType::Flags & RowMajorBit,
1156  Flags0 = evaluator<ArgType>::Flags & ((HereditaryBits & ~RowMajorBit) | DirectAccessBit | MaskPacketAccessBit),
1157  Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit,
1158 
1159  PacketAlignment = unpacket_traits<PacketScalar>::alignment,
1160  Alignment0 = (InnerPanel && (OuterStrideAtCompileTime != Dynamic) && (OuterStrideAtCompileTime != 0) &&
1161  (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0))
1162  ? int(PacketAlignment)
1163  : 0,
1164  Alignment = plain_enum_min(evaluator<ArgType>::Alignment, Alignment0)
1165  };
1168  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
1169  }
1170 };
1171 
1172 // no direct-access => dispatch to a unary evaluator
1173 template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1174 struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /*HasDirectAccess*/ false>
1175  : unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>> {
1177 
1180 };
1181 
1182 template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1183 struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBased>
1184  : evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel>> {
1186 
1188  : m_argImpl(block.nestedExpression()),
1189  m_startRow(block.startRow()),
1190  m_startCol(block.startCol()),
1191  m_linear_offset(ForwardLinearAccess
1192  ? (ArgType::IsRowMajor
1193  ? block.startRow() * block.nestedExpression().cols() + block.startCol()
1194  : block.startCol() * block.nestedExpression().rows() + block.startRow())
1195  : 0) {}
1196 
1197  typedef typename XprType::Scalar Scalar;
1198  typedef typename XprType::CoeffReturnType CoeffReturnType;
1199 
1200  enum {
1201  RowsAtCompileTime = XprType::RowsAtCompileTime,
1202  ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor) == int(ArgType::IsRowMajor)) &&
1204  };
1205 
1207  return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col);
1208  }
1209 
1211  return linear_coeff_impl(index, bool_constant<ForwardLinearAccess>());
1212  }
1213 
1215  return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col);
1216  }
1217 
1219  return linear_coeffRef_impl(index, bool_constant<ForwardLinearAccess>());
1220  }
1221 
1222  template <int LoadMode, typename PacketType>
1224  return m_argImpl.template packet<LoadMode, PacketType>(m_startRow.value() + row, m_startCol.value() + col);
1225  }
1226 
1227  template <int LoadMode, typename PacketType>
1229  if (ForwardLinearAccess)
1230  return m_argImpl.template packet<LoadMode, PacketType>(m_linear_offset.value() + index);
1231  else
1232  return packet<LoadMode, PacketType>(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1233  }
1234 
1235  template <int StoreMode, typename PacketType>
1237  return m_argImpl.template writePacket<StoreMode, PacketType>(m_startRow.value() + row, m_startCol.value() + col, x);
1238  }
1239 
1240  template <int StoreMode, typename PacketType>
1242  if (ForwardLinearAccess)
1243  return m_argImpl.template writePacket<StoreMode, PacketType>(m_linear_offset.value() + index, x);
1244  else
1245  return writePacket<StoreMode, PacketType>(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0,
1246  x);
1247  }
1248 
1249  protected:
1250  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType
1251  linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const {
1252  return m_argImpl.coeff(m_linear_offset.value() + index);
1253  }
1254  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType
1255  linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const {
1256  return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1257  }
1258 
1260  internal::true_type /* ForwardLinearAccess */) {
1261  return m_argImpl.coeffRef(m_linear_offset.value() + index);
1262  }
1264  Index index, internal::false_type /* not ForwardLinearAccess */) {
1265  return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1266  }
1267 
1269  const variable_if_dynamic<Index, (ArgType::RowsAtCompileTime == 1 && BlockRows == 1) ? 0 : Dynamic> m_startRow;
1270  const variable_if_dynamic<Index, (ArgType::ColsAtCompileTime == 1 && BlockCols == 1) ? 0 : Dynamic> m_startCol;
1272 };
1273 
1274 // TODO: This evaluator does not actually use the child evaluator;
1275 // all action is via the data() as returned by the Block expression.
1276 
1277 template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1278 struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAccess */ true>
1279  : mapbase_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>,
1280  typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject> {
1282  typedef typename XprType::Scalar Scalar;
1283 
1285  : mapbase_evaluator<XprType, typename XprType::PlainObject>(block) {
1287  (std::uintptr_t(block.data()) % plain_enum_max(1, evaluator<XprType>::Alignment)) == 0) &&
1288  "data is not aligned");
1289  }
1290 };
1291 
1292 // -------------------- Select --------------------
1293 // NOTE shall we introduce a ternary_evaluator?
1294 
1295 // TODO enable vectorization for Select
1296 template <typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
1297 struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType>>
1298  : evaluator_base<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType>> {
1300  enum {
1303 
1305 
1307  };
1308 
1310  : m_conditionImpl(select.conditionMatrix()), m_thenImpl(select.thenMatrix()), m_elseImpl(select.elseMatrix()) {
1311  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
1312  }
1313 
1314  typedef typename XprType::CoeffReturnType CoeffReturnType;
1315 
1317  if (m_conditionImpl.coeff(row, col))
1318  return m_thenImpl.coeff(row, col);
1319  else
1320  return m_elseImpl.coeff(row, col);
1321  }
1322 
1324  if (m_conditionImpl.coeff(index))
1325  return m_thenImpl.coeff(index);
1326  else
1327  return m_elseImpl.coeff(index);
1328  }
1329 
1330  protected:
1334 };
1335 
1336 // -------------------- Replicate --------------------
1337 
1338 template <typename ArgType, int RowFactor, int ColFactor>
1339 struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor>>
1340  : evaluator_base<Replicate<ArgType, RowFactor, ColFactor>> {
1342  typedef typename XprType::CoeffReturnType CoeffReturnType;
1343  enum { Factor = (RowFactor == Dynamic || ColFactor == Dynamic) ? Dynamic : RowFactor * ColFactor };
1346 
1347  enum {
1349  LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0,
1352 
1354  };
1355 
1357  : m_arg(replicate.nestedExpression()),
1358  m_argImpl(m_arg),
1359  m_rows(replicate.nestedExpression().rows()),
1360  m_cols(replicate.nestedExpression().cols()) {}
1361 
1363  // try to avoid using modulo; this is a pure optimization strategy
1364  const Index actual_row = internal::traits<XprType>::RowsAtCompileTime == 1 ? 0
1365  : RowFactor == 1 ? row
1366  : row % m_rows.value();
1367  const Index actual_col = internal::traits<XprType>::ColsAtCompileTime == 1 ? 0
1368  : ColFactor == 1 ? col
1369  : col % m_cols.value();
1370 
1371  return m_argImpl.coeff(actual_row, actual_col);
1372  }
1373 
1375  // try to avoid using modulo; this is a pure optimization strategy
1376  const Index actual_index = internal::traits<XprType>::RowsAtCompileTime == 1
1377  ? (ColFactor == 1 ? index : index % m_cols.value())
1378  : (RowFactor == 1 ? index : index % m_rows.value());
1379 
1380  return m_argImpl.coeff(actual_index);
1381  }
1382 
1383  template <int LoadMode, typename PacketType>
1385  const Index actual_row = internal::traits<XprType>::RowsAtCompileTime == 1 ? 0
1386  : RowFactor == 1 ? row
1387  : row % m_rows.value();
1388  const Index actual_col = internal::traits<XprType>::ColsAtCompileTime == 1 ? 0
1389  : ColFactor == 1 ? col
1390  : col % m_cols.value();
1391 
1392  return m_argImpl.template packet<LoadMode, PacketType>(actual_row, actual_col);
1393  }
1394 
1395  template <int LoadMode, typename PacketType>
1397  const Index actual_index = internal::traits<XprType>::RowsAtCompileTime == 1
1398  ? (ColFactor == 1 ? index : index % m_cols.value())
1399  : (RowFactor == 1 ? index : index % m_rows.value());
1400 
1401  return m_argImpl.template packet<LoadMode, PacketType>(actual_index);
1402  }
1403 
1404  protected:
1409 };
1410 
1411 // -------------------- MatrixWrapper and ArrayWrapper --------------------
1412 //
1413 // evaluator_wrapper_base<T> is a common base class for the
1414 // MatrixWrapper and ArrayWrapper evaluators.
1415 
1416 template <typename XprType>
1419  enum {
1422  Alignment = evaluator<ArgType>::Alignment
1423  };
1424 
1425  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {}
1426 
1427  typedef typename ArgType::Scalar Scalar;
1428  typedef typename ArgType::CoeffReturnType CoeffReturnType;
1429 
1431  return m_argImpl.coeff(row, col);
1432  }
1433 
1434  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const { return m_argImpl.coeff(index); }
1435 
1437 
1438  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) { return m_argImpl.coeffRef(index); }
1439 
1440  template <int LoadMode, typename PacketType>
1442  return m_argImpl.template packet<LoadMode, PacketType>(row, col);
1443  }
1444 
1445  template <int LoadMode, typename PacketType>
1447  return m_argImpl.template packet<LoadMode, PacketType>(index);
1448  }
1449 
1450  template <int StoreMode, typename PacketType>
1452  m_argImpl.template writePacket<StoreMode>(row, col, x);
1453  }
1454 
1455  template <int StoreMode, typename PacketType>
1457  m_argImpl.template writePacket<StoreMode>(index, x);
1458  }
1459 
1460  protected:
1462 };
1463 
1464 template <typename TArgType>
1465 struct unary_evaluator<MatrixWrapper<TArgType>> : evaluator_wrapper_base<MatrixWrapper<TArgType>> {
1467 
1469  : evaluator_wrapper_base<MatrixWrapper<TArgType>>(wrapper.nestedExpression()) {}
1470 };
1471 
1472 template <typename TArgType>
1473 struct unary_evaluator<ArrayWrapper<TArgType>> : evaluator_wrapper_base<ArrayWrapper<TArgType>> {
1475 
1477  : evaluator_wrapper_base<ArrayWrapper<TArgType>>(wrapper.nestedExpression()) {}
1478 };
1479 
1480 // -------------------- Reverse --------------------
1481 
1482 // defined in Reverse.h:
1483 template <typename PacketType, bool ReversePacket>
1484 struct reverse_packet_cond;
1485 
1486 template <typename ArgType, int Direction>
1487 struct unary_evaluator<Reverse<ArgType, Direction>> : evaluator_base<Reverse<ArgType, Direction>> {
1489  typedef typename XprType::Scalar Scalar;
1490  typedef typename XprType::CoeffReturnType CoeffReturnType;
1491 
1492  enum {
1493  IsRowMajor = XprType::IsRowMajor,
1494  IsColMajor = !IsRowMajor,
1495  ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
1496  ReverseCol = (Direction == Horizontal) || (Direction == BothDirections),
1497  ReversePacket = (Direction == BothDirections) || ((Direction == Vertical) && IsColMajor) ||
1498  ((Direction == Horizontal) && IsRowMajor),
1499 
1501 
1502  // let's enable LinearAccess only with vectorization because of the product overhead
1503  // FIXME enable DirectAccess with negative strides?
1505  LinearAccess =
1506  ((Direction == BothDirections) && (int(Flags0) & PacketAccessBit)) ||
1507  ((ReverseRow && XprType::ColsAtCompileTime == 1) || (ReverseCol && XprType::RowsAtCompileTime == 1))
1508  ? LinearAccessBit
1509  : 0,
1510 
1511  Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess),
1512 
1513  Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f.
1514  };
1515 
1517  : m_argImpl(reverse.nestedExpression()),
1518  m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1),
1519  m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1) {}
1520 
1522  return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row, ReverseCol ? m_cols.value() - col - 1 : col);
1523  }
1524 
1526  return m_argImpl.coeff(m_rows.value() * m_cols.value() - index - 1);
1527  }
1528 
1530  return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row, ReverseCol ? m_cols.value() - col - 1 : col);
1531  }
1532 
1534  return m_argImpl.coeffRef(m_rows.value() * m_cols.value() - index - 1);
1535  }
1536 
1537  template <int LoadMode, typename PacketType>
1539  enum {
1540  PacketSize = unpacket_traits<PacketType>::size,
1541  OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
1542  OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1
1543  };
1545  return reverse_packet::run(m_argImpl.template packet<LoadMode, PacketType>(
1546  ReverseRow ? m_rows.value() - row - OffsetRow : row, ReverseCol ? m_cols.value() - col - OffsetCol : col));
1547  }
1548 
1549  template <int LoadMode, typename PacketType>
1551  enum { PacketSize = unpacket_traits<PacketType>::size };
1552  return preverse(
1553  m_argImpl.template packet<LoadMode, PacketType>(m_rows.value() * m_cols.value() - index - PacketSize));
1554  }
1555 
1556  template <int LoadMode, typename PacketType>
1558  // FIXME we could factorize some code with packet(i,j)
1559  enum {
1560  PacketSize = unpacket_traits<PacketType>::size,
1561  OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
1562  OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1
1563  };
1565  m_argImpl.template writePacket<LoadMode>(ReverseRow ? m_rows.value() - row - OffsetRow : row,
1566  ReverseCol ? m_cols.value() - col - OffsetCol : col,
1568  }
1569 
1570  template <int LoadMode, typename PacketType>
1572  enum { PacketSize = unpacket_traits<PacketType>::size };
1573  m_argImpl.template writePacket<LoadMode>(m_rows.value() * m_cols.value() - index - PacketSize, preverse(x));
1574  }
1575 
1576  protected:
1578 
1579  // If we do not reverse rows, then we do not need to know the number of rows; same for columns
1580  // Nonetheless, in this case it is important to set to 1 such that the coeff(index) method works fine for vectors.
1583 };
1584 
1585 // -------------------- Diagonal --------------------
1586 
1587 template <typename ArgType, int DiagIndex>
1588 struct evaluator<Diagonal<ArgType, DiagIndex>> : evaluator_base<Diagonal<ArgType, DiagIndex>> {
1590 
1591  enum {
1593 
1594  Flags =
1596 
1597  Alignment = 0
1598  };
1599 
1601  : m_argImpl(diagonal.nestedExpression()), m_index(diagonal.index()) {}
1602 
1603  typedef typename XprType::Scalar Scalar;
1604  typedef typename XprType::CoeffReturnType CoeffReturnType;
1605 
1607  return m_argImpl.coeff(row + rowOffset(), row + colOffset());
1608  }
1609 
1611  return m_argImpl.coeff(index + rowOffset(), index + colOffset());
1612  }
1613 
1615  return m_argImpl.coeffRef(row + rowOffset(), row + colOffset());
1616  }
1617 
1619  return m_argImpl.coeffRef(index + rowOffset(), index + colOffset());
1620  }
1621 
1622  protected:
1625 
1626  private:
1628  return m_index.value() > 0 ? 0 : -m_index.value();
1629  }
1631  return m_index.value() > 0 ? m_index.value() : 0;
1632  }
1633 };
1634 
1635 //----------------------------------------------------------------------
1636 // deprecated code
1637 //----------------------------------------------------------------------
1638 
1639 // -------------------- EvalToTemp --------------------
1640 
1641 // expression class for evaluating nested expression to a temporary
1642 
1643 template <typename ArgType>
1644 class EvalToTemp;
1645 
1646 template <typename ArgType>
1647 struct traits<EvalToTemp<ArgType>> : public traits<ArgType> {};
1648 
1649 template <typename ArgType>
1650 class EvalToTemp : public dense_xpr_base<EvalToTemp<ArgType>>::type {
1651  public:
1654 
1655  explicit EvalToTemp(const ArgType& arg) : m_arg(arg) {}
1656 
1657  const ArgType& arg() const { return m_arg; }
1658 
1659  EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_arg.rows(); }
1660 
1661  EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_arg.cols(); }
1662 
1663  private:
1664  const ArgType& m_arg;
1665 };
1666 
1667 template <typename ArgType>
1668 struct evaluator<EvalToTemp<ArgType>> : public evaluator<typename ArgType::PlainObject> {
1670  typedef typename ArgType::PlainObject PlainObject;
1672 
1673  EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : m_result(xpr.arg()) {
1674  internal::construct_at<Base>(this, m_result);
1675  }
1676 
1677  // This constructor is used when nesting an EvalTo evaluator in another evaluator
1678  EIGEN_DEVICE_FUNC evaluator(const ArgType& arg) : m_result(arg) { internal::construct_at<Base>(this, m_result); }
1679 
1680  protected:
1682 };
1683 
1684 } // namespace internal
1685 
1686 } // end namespace Eigen
1687 
1688 #endif // EIGEN_COREEVALUATORS_H
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Eigen::Triplet< double > T
Definition: EigenUnitTest.cpp:11
Direction
An enum that indicates the direction in Cartesian coordinates.
Definition: GeneralDefine.h:56
#define EIGEN_PREDICT_TRUE(x)
Definition: Macros.h:1180
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1149
#define eigen_internal_assert(x)
Definition: Macros.h:916
#define EIGEN_NOEXCEPT
Definition: Macros.h:1267
#define EIGEN_CONSTEXPR
Definition: Macros.h:758
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:966
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
int data[]
Definition: Map_placement_new.cpp:1
m col(1)
m row(1)
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
Definition: StaticAssert.h:101
m m block(1, 0, 2, 2)<< 4
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
void replicate(const MatrixType &m)
Definition: array_replicate.cpp:13
void reverse(const MatrixType &m)
Definition: array_reverse.cpp:17
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
Expression of a mathematical vector or matrix as an array object.
Definition: ArrayWrapper.h:43
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:48
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:110
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:64
Generic expression where a coefficient-wise ternary operator is applied to two expressions.
Definition: CwiseTernaryOp.h:86
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:53
Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector.
Definition: CwiseUnaryView.h:135
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Definition: Diagonal.h:68
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
Expression of an array as a mathematical vector or matrix.
Definition: ArrayWrapper.h:122
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Convenience specialization of Stride to specify only an outer stride See class Map for some examples.
Definition: Stride.h:104
Definition: PlainObjectBase.h:121
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
internal::traits< Derived >::Scalar Scalar
Definition: PlainObjectBase.h:127
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:264
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:64
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:65
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition: Select.h:54
Expression of the transpose of a matrix.
Definition: Transpose.h:56
Definition: CoreEvaluators.h:1650
dense_xpr_base< EvalToTemp >::type Base
Definition: CoreEvaluators.h:1652
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: CoreEvaluators.h:1661
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: CoreEvaluators.h:1659
const ArgType & m_arg
Definition: CoreEvaluators.h:1664
const ArgType & arg() const
Definition: CoreEvaluators.h:1657
const Scalar * data
Definition: CoreEvaluators.h:162
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Index outerStride() const
Definition: CoreEvaluators.h:161
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE plainobjectbase_evaluator_data(const Scalar *ptr, Index outerStride)
Definition: CoreEvaluators.h:159
Definition: CoreEvaluators.h:143
const Scalar * data
Definition: CoreEvaluators.h:153
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE plainobjectbase_evaluator_data(const Scalar *ptr, Index outerStride)
Definition: CoreEvaluators.h:145
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index outerStride() const EIGEN_NOEXCEPT
Definition: CoreEvaluators.h:152
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR T value()
Definition: XprHelper.h:161
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR T value()
Definition: XprHelper.h:189
void diagonal(const MatrixType &m)
Definition: diagonal.cpp:13
@ AlignedMask
Definition: Constants.h:241
@ AlignedMax
Definition: Constants.h:254
@ BothDirections
Definition: Constants.h:272
@ Horizontal
Definition: Constants.h:269
@ Vertical
Definition: Constants.h:266
const unsigned int PacketAccessBit
Definition: Constants.h:97
const unsigned int LinearAccessBit
Definition: Constants.h:133
const unsigned int EvalBeforeNestingBit
Definition: Constants.h:74
const unsigned int DirectAccessBit
Definition: Constants.h:159
const unsigned int RowMajorBit
Definition: Constants.h:70
return int(ret)+1
Eigen::DenseIndex ret
Definition: level1_cplx_impl.h:43
int * m
Definition: level2_cplx_impl.h:294
char char char int int * k
Definition: level2_impl.h:374
char char * op
Definition: level2_impl.h:374
constexpr int plain_enum_min(A a, B b)
Definition: Meta.h:649
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
constexpr int plain_enum_max(A a, B b)
Definition: Meta.h:656
constexpr bool check_implication(bool a, bool b)
Definition: Meta.h:740
EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf &a)
Definition: AltiVec/Complex.h:303
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
constexpr bool is_constant_evaluated()
Definition: Meta.h:746
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
const unsigned int ActualPacketAccessBit
Definition: Constants.h:110
squared absolute value
Definition: GlobalFunctions.h:87
const unsigned int HereditaryBits
Definition: Constants.h:198
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int Dynamic
Definition: Constants.h:25
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
Definition: Constants.h:540
Definition: Constants.h:519
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: TensorMeta.h:47
Definition: Constants.h:564
Definition: Constants.h:528
Definition: Constants.h:543
Definition: Constants.h:525
Definition: Constants.h:567
Definition: Constants.h:531
Definition: Constants.h:577
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:920
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:905
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:909
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:914
CwiseBinaryOp< BinaryOp, Lhs, Rhs > XprType
Definition: CoreEvaluators.h:879
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE binary_evaluator(const XprType &xpr)
Definition: CoreEvaluators.h:898
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const BinaryOp & func() const
Definition: CoreEvaluators.h:930
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType &xpr)
Definition: CoreEvaluators.h:928
Definition: CoreEvaluators.h:78
Block< ArgType, BlockRows, BlockCols, InnerPanel > XprType
Definition: CoreEvaluators.h:1176
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE block_evaluator(const XprType &block)
Definition: CoreEvaluators.h:1178
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE block_evaluator(const XprType &block)
Definition: CoreEvaluators.h:1284
Block< ArgType, BlockRows, BlockCols, InnerPanel > XprType
Definition: CoreEvaluators.h:1281
Definition: CoreEvaluators.h:1121
Definition: Meta.h:102
Definition: functors/UnaryFunctors.h:224
Definition: XprHelper.h:558
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE evaluator()=default
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE evaluator(const XprType &m)
Definition: CoreEvaluators.h:268
Array< Scalar, Rows, Cols, Options, MaxRows, MaxCols > XprType
Definition: CoreEvaluators.h:264
Block< ArgType, BlockRows, BlockCols, InnerPanel > XprType
Definition: CoreEvaluators.h:1126
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator(const XprType &block)
Definition: CoreEvaluators.h:1167
block_evaluator< ArgType, BlockRows, BlockCols, InnerPanel > block_evaluator_type
Definition: CoreEvaluators.h:1166
packet_traits< Scalar >::type PacketScalar
Definition: CoreEvaluators.h:1129
binary_evaluator< CwiseBinaryOp< BinaryOp, Lhs, Rhs > > Base
Definition: CoreEvaluators.h:871
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator(const XprType &xpr)
Definition: CoreEvaluators.h:873
CwiseBinaryOp< BinaryOp, Lhs, Rhs > XprType
Definition: CoreEvaluators.h:870
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(IndexType index) const
Definition: CoreEvaluators.h:501
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(IndexType row, IndexType col) const
Definition: CoreEvaluators.h:496
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:483
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(IndexType index) const
Definition: CoreEvaluators.h:491
internal::remove_all_t< PlainObjectType > PlainObjectTypeCleaned
Definition: CoreEvaluators.h:467
CwiseNullaryOp< NullaryOp, PlainObjectType > XprType
Definition: CoreEvaluators.h:466
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(IndexType row, IndexType col) const
Definition: CoreEvaluators.h:486
const NullaryOp m_functor
Definition: CoreEvaluators.h:506
EIGEN_DEVICE_FUNC evaluator(const XprType &n)
Definition: CoreEvaluators.h:479
const internal::nullary_wrapper< CoeffReturnType, NullaryOp > m_wrapper
Definition: CoreEvaluators.h:507
CwiseTernaryOp< TernaryOp, Arg1, Arg2, Arg3 > XprType
Definition: CoreEvaluators.h:768
EIGEN_DEVICE_FUNC evaluator(const XprType &xpr)
Definition: CoreEvaluators.h:771
ternary_evaluator< CwiseTernaryOp< TernaryOp, Arg1, Arg2, Arg3 > > Base
Definition: CoreEvaluators.h:769
const internal::variable_if_dynamicindex< Index, XprType::DiagIndex > m_index
Definition: CoreEvaluators.h:1624
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index colOffset() const
Definition: CoreEvaluators.h:1630
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:1610
XprType::Scalar Scalar
Definition: CoreEvaluators.h:1603
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index)
Definition: CoreEvaluators.h:1614
evaluator< ArgType > m_argImpl
Definition: CoreEvaluators.h:1623
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:1604
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index) const
Definition: CoreEvaluators.h:1606
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rowOffset() const
Definition: CoreEvaluators.h:1627
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:1618
Diagonal< ArgType, DiagIndex > XprType
Definition: CoreEvaluators.h:1589
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator(const XprType &diagonal)
Definition: CoreEvaluators.h:1600
EIGEN_DEVICE_FUNC evaluator(const ArgType &arg)
Definition: CoreEvaluators.h:1678
EvalToTemp< ArgType > XprType
Definition: CoreEvaluators.h:1669
EIGEN_DEVICE_FUNC evaluator(const XprType &xpr)
Definition: CoreEvaluators.h:1673
evaluator< PlainObject > Base
Definition: CoreEvaluators.h:1671
ArgType::PlainObject PlainObject
Definition: CoreEvaluators.h:1670
PlainObject m_result
Definition: CoreEvaluators.h:1681
packet_traits< Scalar >::type PacketScalar
Definition: CoreEvaluators.h:1076
EIGEN_DEVICE_FUNC evaluator(const XprType &map)
Definition: CoreEvaluators.h:1098
Map< PlainObjectType, MapOptions, StrideType > XprType
Definition: CoreEvaluators.h:1073
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE evaluator()=default
Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols > XprType
Definition: CoreEvaluators.h:253
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE evaluator(const XprType &m)
Definition: CoreEvaluators.h:257
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:216
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE evaluator()
Definition: CoreEvaluators.h:191
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:200
PlainObjectType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:172
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType &x)
Definition: CoreEvaluators.h:234
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:207
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE evaluator(const PlainObjectType &m)
Definition: CoreEvaluators.h:195
PlainObjectBase< Derived > PlainObjectType
Definition: CoreEvaluators.h:170
plainobjectbase_evaluator_data< Scalar, OuterStrideAtCompileTime > m_d
Definition: CoreEvaluators.h:247
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Definition: CoreEvaluators.h:209
PlainObjectType::Scalar Scalar
Definition: CoreEvaluators.h:171
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:221
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType &x)
Definition: CoreEvaluators.h:242
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:229
Ref< PlainObjectType, RefOptions, StrideType > XprType
Definition: CoreEvaluators.h:1106
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator(const XprType &ref)
Definition: CoreEvaluators.h:1113
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator(const XprType &select)
Definition: CoreEvaluators.h:1309
evaluator< ConditionMatrixType > m_conditionImpl
Definition: CoreEvaluators.h:1331
Select< ConditionMatrixType, ThenMatrixType, ElseMatrixType > XprType
Definition: CoreEvaluators.h:1299
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:1323
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:1316
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:1314
evaluator< ThenMatrixType > m_thenImpl
Definition: CoreEvaluators.h:1332
evaluator< ElseMatrixType > m_elseImpl
Definition: CoreEvaluators.h:1333
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator(const T &xpr)
Definition: CoreEvaluators.h:112
Definition: CoreEvaluators.h:98
static const bool value
Definition: CoreEvaluators.h:99
Definition: CoreEvaluators.h:118
EIGEN_DEVICE_FUNC evaluator_base(const evaluator_base &)
@ Alignment
Definition: CoreEvaluators.h:123
EIGEN_DEVICE_FUNC const evaluator_base & operator=(const evaluator_base &)
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE evaluator_base()=default
traits< ExpressionType > ExpressionTraits
Definition: CoreEvaluators.h:121
Definition: CoreEvaluators.h:87
storage_kind_to_evaluator_kind< typename traits< T >::StorageKind >::Kind Kind
Definition: CoreEvaluators.h:89
storage_kind_to_shape< typename traits< T >::StorageKind >::Shape Shape
Definition: CoreEvaluators.h:90
Definition: CoreEvaluators.h:95
Definition: CoreEvaluators.h:1417
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType &x)
Definition: CoreEvaluators.h:1456
ArgType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:1428
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator_wrapper_base(const ArgType &arg)
Definition: CoreEvaluators.h:1425
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType &x)
Definition: CoreEvaluators.h:1451
ArgType::Scalar Scalar
Definition: CoreEvaluators.h:1427
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:1441
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:1446
evaluator< ArgType > m_argImpl
Definition: CoreEvaluators.h:1461
remove_all_t< typename XprType::NestedExpressionType > ArgType
Definition: CoreEvaluators.h:1418
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:1438
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:1434
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Definition: CoreEvaluators.h:1436
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:1430
Definition: CoreEvaluators.h:104
unary_evaluator< T > Base
Definition: CoreEvaluators.h:105
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator(const T &xpr)
Definition: CoreEvaluators.h:106
Definition: Meta.h:97
Definition: XprHelper.h:307
typename find_packet_by_size_helper< Size, typename packet_traits< T >::type >::type type
Definition: XprHelper.h:308
Definition: NullaryFunctors.h:209
Definition: XprHelper.h:205
Definition: ForwardDeclarations.h:31
Definition: DenseCoeffsBase.h:546
Definition: Meta.h:205
Definition: CoreEvaluators.h:999
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType &x)
Definition: CoreEvaluators.h:1053
PointerType m_data
Definition: CoreEvaluators.h:1065
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:1025
@ IsRowMajor
Definition: CoreEvaluators.h:1006
@ CoeffReadCost
Definition: CoreEvaluators.h:1008
@ ColsAtCompileTime
Definition: CoreEvaluators.h:1007
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:1036
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:1021
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:1033
XprType::Scalar Scalar
Definition: CoreEvaluators.h:1002
XprType::PointerType PointerType
Definition: CoreEvaluators.h:1001
const internal::variable_if_dynamic< Index, XprType::InnerStrideAtCompileTime > m_innerStride
Definition: CoreEvaluators.h:1066
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:1042
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rowStride() const EIGEN_NOEXCEPT
Definition: CoreEvaluators.h:1058
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:1003
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index colStride() const EIGEN_NOEXCEPT
Definition: CoreEvaluators.h:1061
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE mapbase_evaluator(const XprType &map)
Definition: CoreEvaluators.h:1011
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Definition: CoreEvaluators.h:1029
const internal::variable_if_dynamic< Index, XprType::OuterStrideAtCompileTime > m_outerStride
Definition: CoreEvaluators.h:1067
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType &x)
Definition: CoreEvaluators.h:1047
Derived XprType
Definition: CoreEvaluators.h:1000
std::conditional_t< Evaluate, PlainObject, typename ref_selector< T >::type > type
Definition: XprHelper.h:549
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp &op, IndexType i, IndexType j=0) const
Definition: CoreEvaluators.h:367
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp &op, IndexType i, IndexType j=0) const
Definition: CoreEvaluators.h:371
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp &op, IndexType i) const
Definition: CoreEvaluators.h:393
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp &op, IndexType i, IndexType j) const
Definition: CoreEvaluators.h:387
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp &op, IndexType i, IndexType j) const
Definition: CoreEvaluators.h:382
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp &op, IndexType i) const
Definition: CoreEvaluators.h:397
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp &op, IndexType=0, IndexType=0) const
Definition: CoreEvaluators.h:355
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp &op, IndexType=0, IndexType=0) const
Definition: CoreEvaluators.h:359
Definition: CoreEvaluators.h:332
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp &op, IndexType i) const
Definition: CoreEvaluators.h:347
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp &op, IndexType i, IndexType j) const
Definition: CoreEvaluators.h:343
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp &op, IndexType i, IndexType j) const
Definition: CoreEvaluators.h:334
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp &op, IndexType i) const
Definition: CoreEvaluators.h:338
Definition: DenseCoeffsBase.h:556
Definition: GenericPacketMath.h:108
Definition: Reverse.h:39
Definition: TernaryFunctors.h:23
Template functors for comparison of two scalars.
Definition: BinaryFunctors.h:199
IndexBased Kind
Definition: CoreEvaluators.h:26
DenseShape Shape
Definition: CoreEvaluators.h:36
PermutationShape Shape
Definition: CoreEvaluators.h:44
SolverShape Shape
Definition: CoreEvaluators.h:40
TranspositionsShape Shape
Definition: CoreEvaluators.h:48
Definition: CoreEvaluators.h:32
CwiseTernaryOp< TernaryOp, Arg1, Arg2, Arg3 > XprType
Definition: CoreEvaluators.h:777
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:811
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:823
EIGEN_DEVICE_FUNC ternary_evaluator(const XprType &xpr)
Definition: CoreEvaluators.h:800
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:807
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:816
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TernaryOp & func() const
Definition: CoreEvaluators.h:834
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType &xpr)
Definition: CoreEvaluators.h:832
Definition: CoreEvaluators.h:72
Definition: ForwardDeclarations.h:21
Definition: Meta.h:94
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &wrapper)
Definition: CoreEvaluators.h:1476
ArrayWrapper< TArgType > XprType
Definition: CoreEvaluators.h:1474
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:1228
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType &x)
Definition: CoreEvaluators.h:1236
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &block)
Definition: CoreEvaluators.h:1187
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Definition: CoreEvaluators.h:1214
Block< ArgType, BlockRows, BlockCols, InnerPanel > XprType
Definition: CoreEvaluators.h:1185
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & linear_coeffRef_impl(Index index, internal::false_type)
Definition: CoreEvaluators.h:1263
const variable_if_dynamic< Index, ForwardLinearAccess ? Dynamic :0 > m_linear_offset
Definition: CoreEvaluators.h:1271
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType linear_coeff_impl(Index index, internal::true_type) const
Definition: CoreEvaluators.h:1251
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType &x)
Definition: CoreEvaluators.h:1241
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & linear_coeffRef_impl(Index index, internal::true_type)
Definition: CoreEvaluators.h:1259
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:1218
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:1206
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType linear_coeff_impl(Index index, internal::false_type) const
Definition: CoreEvaluators.h:1255
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:1223
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:1210
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp & func() const
Definition: CoreEvaluators.h:554
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType &xpr)
Definition: CoreEvaluators.h:552
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:535
CwiseUnaryOp< UnaryOp, ArgType > XprType
Definition: CoreEvaluators.h:514
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:540
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:529
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &op)
Definition: CoreEvaluators.h:524
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:545
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:531
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:658
const variable_if_dynamic< Index, XprType::RowsAtCompileTime > m_rows
Definition: CoreEvaluators.h:758
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool check_array_bounds(Index index, Index packetSize) const
Definition: CoreEvaluators.h:611
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType srcPacket(Index row, Index col, Index offset) const
Definition: CoreEvaluators.h:633
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const
Definition: CoreEvaluators.h:754
std::enable_if_t<(unpacket_traits< DstPacketType >::size)==(8 *SrcPacketSize), bool > SrcPacketArgs8
Definition: CoreEvaluators.h:601
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const
Definition: CoreEvaluators.h:753
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType srcPacket(Index index, Index offset) const
Definition: CoreEvaluators.h:641
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const
Definition: CoreEvaluators.h:709
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE SrcType srcCoeff(Index row, Index col, Index offset) const
Definition: CoreEvaluators.h:615
std::enable_if_t<(unpacket_traits< DstPacketType >::size)==(4 *SrcPacketSize), bool > SrcPacketArgs4
Definition: CoreEvaluators.h:599
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:625
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE SrcType srcCoeff(Index index, Index offset) const
Definition: CoreEvaluators.h:620
std::enable_if_t<(find_packet_by_size< SrcType, unpacket_traits< DstPacketType >::size >::value), bool > SrcPacketArgs1
Definition: CoreEvaluators.h:595
constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const
Definition: CoreEvaluators.h:752
std::enable_if_t<(unpacket_traits< DstPacketType >::size< SrcPacketSize &&!find_packet_by_size< SrcType, unpacket_traits< DstPacketType >::size >::value), bool > AltSrcScalarOp
Definition: CoreEvaluators.h:592
std::enable_if_t<(unpacket_traits< DstPacketType >::size)==(2 *SrcPacketSize), bool > SrcPacketArgs2
Definition: CoreEvaluators.h:597
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool check_array_bounds(Index row, Index, Index packetSize) const
Definition: CoreEvaluators.h:608
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool check_array_bounds(Index, Index col, Index packetSize) const
Definition: CoreEvaluators.h:604
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstType coeff(Index index) const
Definition: CoreEvaluators.h:628
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &xpr)
Definition: CoreEvaluators.h:583
const variable_if_dynamic< Index, XprType::ColsAtCompileTime > m_cols
Definition: CoreEvaluators.h:759
typename packet_traits< SrcType >::type SrcPacketType
Definition: CoreEvaluators.h:570
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType &xpr)
Definition: CoreEvaluators.h:981
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp & func() const
Definition: CoreEvaluators.h:983
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:962
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:966
CwiseUnaryView< UnaryOp, ArgType, StrideType > XprType
Definition: CoreEvaluators.h:944
EIGEN_DEVICE_FUNC unary_evaluator(const XprType &op)
Definition: CoreEvaluators.h:954
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Definition: CoreEvaluators.h:970
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:974
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &wrapper)
Definition: CoreEvaluators.h:1468
MatrixWrapper< TArgType > XprType
Definition: CoreEvaluators.h:1466
internal::nested_eval< ArgType, Factor >::type ArgTypeNested
Definition: CoreEvaluators.h:1344
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:1362
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &replicate)
Definition: CoreEvaluators.h:1356
internal::remove_all_t< ArgTypeNested > ArgTypeNestedCleaned
Definition: CoreEvaluators.h:1345
const ArgTypeNested m_arg
Definition: CoreEvaluators.h:1405
Replicate< ArgType, RowFactor, ColFactor > XprType
Definition: CoreEvaluators.h:1341
const variable_if_dynamic< Index, ArgType::ColsAtCompileTime > m_cols
Definition: CoreEvaluators.h:1408
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:1374
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:1384
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:1396
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:1342
evaluator< ArgTypeNestedCleaned > m_argImpl
Definition: CoreEvaluators.h:1406
const variable_if_dynamic< Index, ArgType::RowsAtCompileTime > m_rows
Definition: CoreEvaluators.h:1407
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:1538
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:1525
evaluator< ArgType > m_argImpl
Definition: CoreEvaluators.h:1577
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:1533
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &reverse)
Definition: CoreEvaluators.h:1516
const variable_if_dynamic< Index, ReverseRow ? ArgType::RowsAtCompileTime :1 > m_rows
Definition: CoreEvaluators.h:1581
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:1550
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Definition: CoreEvaluators.h:1529
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType &x)
Definition: CoreEvaluators.h:1571
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:1490
Reverse< ArgType, Direction > XprType
Definition: CoreEvaluators.h:1488
const variable_if_dynamic< Index, ReverseCol ? ArgType::ColsAtCompileTime :1 > m_cols
Definition: CoreEvaluators.h:1582
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:1521
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType &x)
Definition: CoreEvaluators.h:1557
XprType::Scalar Scalar
Definition: CoreEvaluators.h:1489
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const
Definition: CoreEvaluators.h:289
XprType::CoeffReturnType CoeffReturnType
Definition: CoreEvaluators.h:287
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index row, Index col)
Definition: CoreEvaluators.h:295
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType &x)
Definition: CoreEvaluators.h:317
evaluator< ArgType > m_argImpl
Definition: CoreEvaluators.h:322
XprType::Scalar Scalar
Definition: CoreEvaluators.h:286
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
Definition: CoreEvaluators.h:302
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType &x)
Definition: CoreEvaluators.h:312
Transpose< ArgType > XprType
Definition: CoreEvaluators.h:276
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const
Definition: CoreEvaluators.h:307
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE XprType::Scalar & coeffRef(Index index)
Definition: CoreEvaluators.h:297
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE unary_evaluator(const XprType &t)
Definition: CoreEvaluators.h:284
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const
Definition: CoreEvaluators.h:293
Definition: CoreEvaluators.h:82
Definition: GenericPacketMath.h:134
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317