BlasUtil.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) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
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_BLASUTIL_H
11 #define EIGEN_BLASUTIL_H
12 
13 // This file contains many lightweight helper classes used to
14 // implement and control fast level 2 and level 3 BLAS-like routines.
15 
16 // IWYU pragma: private
17 #include "../InternalHeaderCheck.h"
18 
19 namespace Eigen {
20 
21 namespace internal {
22 
23 // forward declarations
24 template <typename LhsScalar, typename RhsScalar, typename Index, typename DataMapper, int mr, int nr,
25  bool ConjugateLhs = false, bool ConjugateRhs = false>
26 struct gebp_kernel;
27 
28 template <typename Scalar, typename Index, typename DataMapper, int nr, int StorageOrder, bool Conjugate = false,
29  bool PanelMode = false>
31 
32 template <typename Scalar, typename Index, typename DataMapper, int Pack1, int Pack2, typename Packet, int StorageOrder,
33  bool Conjugate = false, bool PanelMode = false>
35 
36 template <typename Index, typename LhsScalar, int LhsStorageOrder, bool ConjugateLhs, typename RhsScalar,
37  int RhsStorageOrder, bool ConjugateRhs, int ResStorageOrder, int ResInnerStride>
39 
40 template <typename Index, typename LhsScalar, typename LhsMapper, int LhsStorageOrder, bool ConjugateLhs,
41  typename RhsScalar, typename RhsMapper, bool ConjugateRhs, int Version = Specialized>
43 
44 template <typename From, typename To>
45 struct get_factor {
46  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE To run(const From& x) { return To(x); }
47 };
48 
49 template <typename Scalar>
50 struct get_factor<Scalar, typename NumTraits<Scalar>::Real> {
52  return numext::real(x);
53  }
54 };
55 
56 template <typename Scalar, typename Index>
58  public:
60 
62  template <typename Packet, int AlignmentType>
64  return ploadt<Packet, AlignmentType>(m_data + i);
65  }
66 
67  template <typename Packet>
69  return (std::uintptr_t(m_data + i) % sizeof(Packet)) == 0;
70  }
71 
72  protected:
74 };
75 
76 template <typename Scalar, typename Index, int AlignmentType, int Incr = 1>
77 class BlasLinearMapper;
78 
79 template <typename Scalar, typename Index, int AlignmentType>
81  public:
84  eigen_assert(incr == 1);
85  }
86 
88 
90 
91  template <typename PacketType>
93  return ploadt<PacketType, AlignmentType>(m_data + i);
94  }
95 
96  template <typename PacketType>
98  return ploadt_partial<PacketType, AlignmentType>(m_data + i, n, offset);
99  }
100 
101  template <typename PacketType, int AlignmentT>
103  return ploadt<PacketType, AlignmentT>(m_data + i);
104  }
105 
106  template <typename PacketType>
108  pstoret<Scalar, PacketType, AlignmentType>(m_data + i, p);
109  }
110 
111  template <typename PacketType>
113  Index offset = 0) const {
114  pstoret_partial<Scalar, PacketType, AlignmentType>(m_data + i, p, n, offset);
115  }
116 
117  protected:
119 };
120 
121 // Lightweight helper class to access matrix coefficients.
122 template <typename Scalar, typename Index, int StorageOrder, int AlignmentType = Unaligned, int Incr = 1>
123 class blas_data_mapper;
124 
125 // TMP to help PacketBlock store implementation.
126 // There's currently no known use case for PacketBlock load.
127 // The default implementation assumes ColMajor order.
128 // It always store each packet sequentially one `stride` apart.
129 template <typename Index, typename Scalar, typename Packet, int n, int idx, int StorageOrder>
131  PacketBlockManagement<Index, Scalar, Packet, n, idx - 1, StorageOrder> pbm;
133  const PacketBlock<Packet, n>& block) const {
134  pbm.store(to, stride, i, j, block);
135  pstoreu<Scalar>(to + i + (j + idx) * stride, block.packet[idx]);
136  }
137 };
138 
139 // PacketBlockManagement specialization to take care of RowMajor order without ifs.
140 template <typename Index, typename Scalar, typename Packet, int n, int idx>
144  const PacketBlock<Packet, n>& block) const {
145  pbm.store(to, stride, i, j, block);
146  pstoreu<Scalar>(to + j + (i + idx) * stride, block.packet[idx]);
147  }
148 };
149 
150 template <typename Index, typename Scalar, typename Packet, int n, int StorageOrder>
151 struct PacketBlockManagement<Index, Scalar, Packet, n, -1, StorageOrder> {
153  const PacketBlock<Packet, n>& block) const {
155  EIGEN_UNUSED_VARIABLE(stride);
159  }
160 };
161 
162 template <typename Index, typename Scalar, typename Packet, int n>
165  const PacketBlock<Packet, n>& block) const {
167  EIGEN_UNUSED_VARIABLE(stride);
171  }
172 };
173 
174 template <typename Scalar, typename Index, int StorageOrder, int AlignmentType>
175 class blas_data_mapper<Scalar, Index, StorageOrder, AlignmentType, 1> {
176  public:
180 
182  : m_data(data), m_stride(stride) {
184  eigen_assert(incr == 1);
185  }
186 
188  return SubMapper(&operator()(i, j), m_stride);
189  }
190 
192  return LinearMapper(&operator()(i, j));
193  }
194 
196  return VectorMapper(&operator()(i, j));
197  }
198 
200 
202  return m_data[StorageOrder == RowMajor ? j + i * m_stride : i + j * m_stride];
203  }
204 
205  template <typename PacketType>
207  return ploadt<PacketType, AlignmentType>(&operator()(i, j));
208  }
209 
210  template <typename PacketType>
212  Index offset = 0) const {
213  return ploadt_partial<PacketType, AlignmentType>(&operator()(i, j), n, offset);
214  }
215 
216  template <typename PacketT, int AlignmentT>
218  return ploadt<PacketT, AlignmentT>(&operator()(i, j));
219  }
220 
221  template <typename PacketType>
223  pstoret<Scalar, PacketType, AlignmentType>(&operator()(i, j), p);
224  }
225 
226  template <typename PacketType>
228  Index offset = 0) const {
229  pstoret_partial<Scalar, PacketType, AlignmentType>(&operator()(i, j), p, n, offset);
230  }
231 
232  template <typename SubPacket>
234  pscatter<Scalar, SubPacket>(&operator()(i, j), p, m_stride);
235  }
236 
237  template <typename SubPacket>
239  return pgather<Scalar, SubPacket>(&operator()(i, j), m_stride);
240  }
241 
242  EIGEN_DEVICE_FUNC const Index stride() const { return m_stride; }
243  EIGEN_DEVICE_FUNC const Index incr() const { return 1; }
244  EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_data; }
245 
247  if (std::uintptr_t(m_data) % sizeof(Scalar)) {
248  return -1;
249  }
251  }
252 
253  template <typename SubPacket, int n>
255  const PacketBlock<SubPacket, n>& block) const {
256  PacketBlockManagement<Index, Scalar, SubPacket, n, n - 1, StorageOrder> pbm;
257  pbm.store(m_data, m_stride, i, j, block);
258  }
259 
260  protected:
263 };
264 
265 // Implementation of non-natural increment (i.e. inner-stride != 1)
266 // The exposed API is not complete yet compared to the Incr==1 case
267 // because some features makes less sense in this case.
268 template <typename Scalar, typename Index, int AlignmentType, int Incr>
270  public:
272 
274 
276 
277  template <typename PacketType>
279  return pgather<Scalar, PacketType>(m_data + i * m_incr.value(), m_incr.value());
280  }
281 
282  template <typename PacketType>
284  return pgather_partial<Scalar, PacketType>(m_data + i * m_incr.value(), m_incr.value(), n);
285  }
286 
287  template <typename PacketType>
289  pscatter<Scalar, PacketType>(m_data + i * m_incr.value(), p, m_incr.value());
290  }
291 
292  template <typename PacketType>
294  Index /*offset*/ = 0) const {
295  pscatter_partial<Scalar, PacketType>(m_data + i * m_incr.value(), p, m_incr.value(), n);
296  }
297 
298  protected:
301 };
302 
303 template <typename Scalar, typename Index, int StorageOrder, int AlignmentType, int Incr>
305  public:
308 
311 
313  return SubMapper(&operator()(i, j), m_stride, m_incr.value());
314  }
315 
317  return LinearMapper(&operator()(i, j), m_incr.value());
318  }
319 
321 
323  return m_data[StorageOrder == RowMajor ? j * m_incr.value() + i * m_stride : i * m_incr.value() + j * m_stride];
324  }
325 
326  template <typename PacketType>
328  return pgather<Scalar, PacketType>(&operator()(i, j), m_incr.value());
329  }
330 
331  template <typename PacketType>
333  Index /*offset*/ = 0) const {
334  return pgather_partial<Scalar, PacketType>(&operator()(i, j), m_incr.value(), n);
335  }
336 
337  template <typename PacketT, int AlignmentT>
339  return pgather<Scalar, PacketT>(&operator()(i, j), m_incr.value());
340  }
341 
342  template <typename PacketType>
344  pscatter<Scalar, PacketType>(&operator()(i, j), p, m_incr.value());
345  }
346 
347  template <typename PacketType>
349  Index /*offset*/ = 0) const {
350  pscatter_partial<Scalar, PacketType>(&operator()(i, j), p, m_incr.value(), n);
351  }
352 
353  template <typename SubPacket>
355  pscatter<Scalar, SubPacket>(&operator()(i, j), p, m_stride);
356  }
357 
358  template <typename SubPacket>
360  return pgather<Scalar, SubPacket>(&operator()(i, j), m_stride);
361  }
362 
363  // storePacketBlock_helper defines a way to access values inside the PacketBlock, this is essentially required by the
364  // Complex types.
365  template <typename SubPacket, typename Scalar_, int n, int idx>
367  storePacketBlock_helper<SubPacket, Scalar_, n, idx - 1> spbh;
370  const PacketBlock<SubPacket, n>& block) const {
371  spbh.store(sup, i, j, block);
372  sup->template storePacket<SubPacket>(i, j + idx, block.packet[idx]);
373  }
374  };
375 
376  template <typename SubPacket, int n, int idx>
377  struct storePacketBlock_helper<SubPacket, std::complex<float>, n, idx> {
381  const PacketBlock<SubPacket, n>& block) const {
382  spbh.store(sup, i, j, block);
383  sup->template storePacket<SubPacket>(i, j + idx, block.packet[idx]);
384  }
385  };
386 
387  template <typename SubPacket, int n, int idx>
388  struct storePacketBlock_helper<SubPacket, std::complex<double>, n, idx> {
392  const PacketBlock<SubPacket, n>& block) const {
393  spbh.store(sup, i, j, block);
394  for (int l = 0; l < unpacket_traits<SubPacket>::size; l++) {
395  std::complex<double>* v = &sup->operator()(i + l, j + idx);
396  v->real(block.packet[idx].v[2 * l + 0]);
397  v->imag(block.packet[idx].v[2 * l + 1]);
398  }
399  }
400  };
401 
402  template <typename SubPacket, typename Scalar_, int n>
403  struct storePacketBlock_helper<SubPacket, Scalar_, n, -1> {
406  const PacketBlock<SubPacket, n>&) const {}
407  };
408 
409  template <typename SubPacket, int n>
410  struct storePacketBlock_helper<SubPacket, std::complex<float>, n, -1> {
413  const PacketBlock<SubPacket, n>&) const {}
414  };
415 
416  template <typename SubPacket, int n>
417  struct storePacketBlock_helper<SubPacket, std::complex<double>, n, -1> {
420  const PacketBlock<SubPacket, n>&) const {}
421  };
422  // This function stores a PacketBlock on m_data, this approach is really quite slow compare to Incr=1 and should be
423  // avoided when possible.
424  template <typename SubPacket, int n>
426  const PacketBlock<SubPacket, n>& block) const {
427  storePacketBlock_helper<SubPacket, Scalar, n, n - 1> spb;
428  spb.store(this, i, j, block);
429  }
430 
431  EIGEN_DEVICE_FUNC const Index stride() const { return m_stride; }
432  EIGEN_DEVICE_FUNC const Index incr() const { return m_incr.value(); }
433  EIGEN_DEVICE_FUNC constexpr Scalar* data() const { return m_data; }
434 
435  protected:
439 };
440 
441 // lightweight helper class to access matrix coefficients (const version)
442 template <typename Scalar, typename Index, int StorageOrder>
443 class const_blas_data_mapper : public blas_data_mapper<const Scalar, Index, StorageOrder> {
444  public:
446 
448  : blas_data_mapper<const Scalar, Index, StorageOrder>(data, stride) {}
449 
451  return SubMapper(&(this->operator()(i, j)), this->m_stride);
452  }
453 };
454 
455 /* Helper class to analyze the factors of a Product expression.
456  * In particular it allows to pop out operator-, scalar multiples,
457  * and conjugate */
458 template <typename XprType>
459 struct blas_traits {
460  typedef typename traits<XprType>::Scalar Scalar;
461  typedef const XprType& ExtractType;
463  enum {
465  IsTransposed = false,
468  ((int(XprType::Flags) & DirectAccessBit) &&
469  (bool(XprType::IsVectorAtCompileTime) || int(inner_stride_at_compile_time<XprType>::ret) == 1))
470  ? 1
471  : 0,
472  HasScalarFactor = false
473  };
474  typedef std::conditional_t<bool(HasUsableDirectAccess), ExtractType, typename ExtractType_::PlainObject>
478  return Scalar(1);
479  }
480 };
481 
482 // pop conjugate
483 template <typename Scalar, typename NestedXpr>
484 struct blas_traits<CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> > : blas_traits<NestedXpr> {
487  typedef typename Base::ExtractType ExtractType;
488 
489  enum { IsComplex = NumTraits<Scalar>::IsComplex, NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex };
490  EIGEN_DEVICE_FUNC static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
492  return conj(Base::extractScalarFactor(x.nestedExpression()));
493  }
494 };
495 
496 // pop scalar multiple
497 template <typename Scalar, typename NestedXpr, typename Plain>
498 struct blas_traits<
500  : blas_traits<NestedXpr> {
501  enum { HasScalarFactor = true };
505  typedef typename Base::ExtractType ExtractType;
507  return Base::extract(x.rhs());
508  }
510  return x.lhs().functor().m_other * Base::extractScalarFactor(x.rhs());
511  }
512 };
513 template <typename Scalar, typename NestedXpr, typename Plain>
514 struct blas_traits<
516  : blas_traits<NestedXpr> {
517  enum { HasScalarFactor = true };
521  typedef typename Base::ExtractType ExtractType;
522  EIGEN_DEVICE_FUNC static inline ExtractType extract(const XprType& x) { return Base::extract(x.lhs()); }
524  return Base::extractScalarFactor(x.lhs()) * x.rhs().functor().m_other;
525  }
526 };
527 template <typename Scalar, typename Plain1, typename Plain2>
529  const CwiseNullaryOp<scalar_constant_op<Scalar>, Plain2> > >
530  : blas_traits<CwiseNullaryOp<scalar_constant_op<Scalar>, Plain1> > {};
531 
532 // pop opposite
533 template <typename Scalar, typename NestedXpr>
534 struct blas_traits<CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> > : blas_traits<NestedXpr> {
535  enum { HasScalarFactor = true };
538  typedef typename Base::ExtractType ExtractType;
539  EIGEN_DEVICE_FUNC static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
541  return -Base::extractScalarFactor(x.nestedExpression());
542  }
543 };
544 
545 // pop/push transpose
546 template <typename NestedXpr>
547 struct blas_traits<Transpose<NestedXpr> > : blas_traits<NestedXpr> {
548  typedef typename NestedXpr::Scalar Scalar;
552  ExtractType; // const to get rid of a compile error; anyway blas traits are only used on the RHS
554  typedef std::conditional_t<bool(Base::HasUsableDirectAccess), ExtractType, typename ExtractType::PlainObject>
556  enum { IsTransposed = Base::IsTransposed ? 0 : 1 };
558  return ExtractType(Base::extract(x.nestedExpression()));
559  }
561  return Base::extractScalarFactor(x.nestedExpression());
562  }
563 };
564 
565 template <typename T>
566 struct blas_traits<const T> : blas_traits<T> {};
567 
568 template <typename T, bool HasUsableDirectAccess = blas_traits<T>::HasUsableDirectAccess>
570  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE static const typename T::Scalar* run(const T& m) {
571  return blas_traits<T>::extract(m).data();
572  }
573 };
574 
575 template <typename T>
576 struct extract_data_selector<T, false> {
577  EIGEN_DEVICE_FUNC static typename T::Scalar* run(const T&) { return 0; }
578 };
579 
580 template <typename T>
583 }
584 
589 template <typename ResScalar, typename Lhs, typename Rhs>
591  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE static ResScalar run(const Lhs& lhs, const Rhs& rhs) {
593  }
594  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE static ResScalar run(const ResScalar& alpha, const Lhs& lhs, const Rhs& rhs) {
596  }
597 };
598 template <typename Lhs, typename Rhs>
600  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE static bool run(const Lhs& lhs, const Rhs& rhs) {
602  }
603  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE static bool run(const bool& alpha, const Lhs& lhs, const Rhs& rhs) {
605  }
606 };
607 
608 template <typename ResScalar, typename Lhs, typename Rhs>
610  const Rhs& rhs) {
612 }
613 template <typename ResScalar, typename Lhs, typename Rhs>
616 }
617 
618 } // end namespace internal
619 
620 } // end namespace Eigen
621 
622 #endif // EIGEN_BLASUTIL_H
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
#define EIGEN_RESTRICT
Definition: Macros.h:1067
#define EIGEN_ALWAYS_INLINE
Definition: Macros.h:845
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:966
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:922
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
int data[]
Definition: Map_placement_new.cpp:1
float * p
Definition: Tutorial_Map_using.cpp:9
m m block(1, 0, 2, 2)<< 4
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
internal::packet_traits< Scalar >::type Packet
Definition: benchmark-blocking-sizes.cpp:54
boost::multiprecision::number< boost::multiprecision::cpp_dec_float< 100 >, boost::multiprecision::et_on > Real
Definition: boostmultiprec.cpp:77
Definition: ForwardDeclarations.h:102
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 unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:53
Expression of the transpose of a matrix.
Definition: Transpose.h:56
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar & operator()(Index i) const
Definition: BlasUtil.h:89
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacket(Index i, const PacketType &p) const
Definition: BlasUtil.h:107
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacketPartial(Index i, const PacketType &p, Index n, Index offset=0) const
Definition: BlasUtil.h:112
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasLinearMapper(Scalar *data, Index incr=1)
Definition: BlasUtil.h:82
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType load(Index i) const
Definition: BlasUtil.h:102
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(Index i) const
Definition: BlasUtil.h:92
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacketPartial(Index i, Index n, Index offset=0) const
Definition: BlasUtil.h:97
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void prefetch(Index i) const
Definition: BlasUtil.h:87
Definition: BlasUtil.h:269
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacketPartial(Index i, const PacketType &p, Index n, Index=0) const
Definition: BlasUtil.h:293
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacketPartial(Index i, Index n, Index=0) const
Definition: BlasUtil.h:283
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void prefetch(int i) const
Definition: BlasUtil.h:273
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(Index i) const
Definition: BlasUtil.h:278
const internal::variable_if_dynamic< Index, Incr > m_incr
Definition: BlasUtil.h:300
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar & operator()(Index i) const
Definition: BlasUtil.h:275
Scalar * m_data
Definition: BlasUtil.h:299
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacket(Index i, const PacketType &p) const
Definition: BlasUtil.h:288
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasLinearMapper(Scalar *data, Index incr)
Definition: BlasUtil.h:271
Definition: BlasUtil.h:57
Scalar * m_data
Definition: BlasUtil.h:73
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet load(Index i) const
Definition: BlasUtil.h:63
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar operator()(Index i) const
Definition: BlasUtil.h:61
EIGEN_DEVICE_FUNC bool aligned(Index i) const
Definition: BlasUtil.h:68
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE BlasVectorMapper(Scalar *data)
Definition: BlasUtil.h:59
BlasVectorMapper< Scalar, Index > VectorMapper
Definition: BlasUtil.h:179
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE LinearMapper getLinearMapper(Index i, Index j) const
Definition: BlasUtil.h:191
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(Index i, Index j) const
Definition: BlasUtil.h:206
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacketBlock(Index i, Index j, const PacketBlock< SubPacket, n > &block) const
Definition: BlasUtil.h:254
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubMapper getSubMapper(Index i, Index j) const
Definition: BlasUtil.h:187
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar & operator()(Index i, Index j) const
Definition: BlasUtil.h:201
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacketPartial(Index i, Index j, const PacketType &p, Index n, Index offset=0) const
Definition: BlasUtil.h:227
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubPacket gatherPacket(Index i, Index j) const
Definition: BlasUtil.h:238
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacket(Index i, Index j, const PacketType &p) const
Definition: BlasUtil.h:222
blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType > SubMapper
Definition: BlasUtil.h:178
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper(Scalar *data, Index stride, Index incr=1)
Definition: BlasUtil.h:181
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacketPartial(Index i, Index j, Index n, Index offset=0) const
Definition: BlasUtil.h:211
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE VectorMapper getVectorMapper(Index i, Index j) const
Definition: BlasUtil.h:195
EIGEN_DEVICE_FUNC const Index incr() const
Definition: BlasUtil.h:243
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void scatterPacket(Index i, Index j, const SubPacket &p) const
Definition: BlasUtil.h:233
EIGEN_DEVICE_FUNC Index firstAligned(Index size) const
Definition: BlasUtil.h:246
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void prefetch(Index i, Index j) const
Definition: BlasUtil.h:199
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketT load(Index i, Index j) const
Definition: BlasUtil.h:217
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: BlasUtil.h:244
EIGEN_DEVICE_FUNC const Index stride() const
Definition: BlasUtil.h:242
BlasLinearMapper< Scalar, Index, AlignmentType > LinearMapper
Definition: BlasUtil.h:177
Definition: BlasUtil.h:304
BlasLinearMapper< Scalar, Index, AlignmentType, Incr > LinearMapper
Definition: BlasUtil.h:306
const internal::variable_if_dynamic< Index, Incr > m_incr
Definition: BlasUtil.h:438
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacket(Index i, Index j) const
Definition: BlasUtil.h:327
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubMapper getSubMapper(Index i, Index j) const
Definition: BlasUtil.h:312
blas_data_mapper SubMapper
Definition: BlasUtil.h:307
Scalar *EIGEN_RESTRICT m_data
Definition: BlasUtil.h:436
constexpr EIGEN_DEVICE_FUNC Scalar * data() const
Definition: BlasUtil.h:433
const Index m_stride
Definition: BlasUtil.h:437
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE LinearMapper getLinearMapper(Index i, Index j) const
Definition: BlasUtil.h:316
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacket(Index i, Index j, const PacketType &p) const
Definition: BlasUtil.h:343
EIGEN_DEVICE_FUNC const Index stride() const
Definition: BlasUtil.h:431
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketType loadPacketPartial(Index i, Index j, Index n, Index=0) const
Definition: BlasUtil.h:332
EIGEN_DEVICE_FUNC const Index incr() const
Definition: BlasUtil.h:432
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketT load(Index i, Index j) const
Definition: BlasUtil.h:338
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Scalar & operator()(Index i, Index j) const
Definition: BlasUtil.h:322
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE blas_data_mapper(Scalar *data, Index stride, Index incr)
Definition: BlasUtil.h:309
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacketBlock(Index i, Index j, const PacketBlock< SubPacket, n > &block) const
Definition: BlasUtil.h:425
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void storePacketPartial(Index i, Index j, const PacketType &p, Index n, Index=0) const
Definition: BlasUtil.h:348
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE SubPacket gatherPacket(Index i, Index j) const
Definition: BlasUtil.h:359
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void prefetch(Index i, Index j) const
Definition: BlasUtil.h:320
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void scatterPacket(Index i, Index j, const SubPacket &p) const
Definition: BlasUtil.h:354
Definition: BlasUtil.h:443
EIGEN_ALWAYS_INLINE const_blas_data_mapper(const Scalar *data, Index stride)
Definition: BlasUtil.h:447
const_blas_data_mapper< Scalar, Index, StorageOrder > SubMapper
Definition: BlasUtil.h:445
EIGEN_ALWAYS_INLINE SubMapper getSubMapper(Index i, Index j) const
Definition: BlasUtil.h:450
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR T value()
Definition: XprHelper.h:161
float real
Definition: datatypes.h:10
AlignmentType
Definition: Constants.h:234
@ Specialized
Definition: Constants.h:311
@ RowMajor
Definition: Constants.h:320
const unsigned int DirectAccessBit
Definition: Constants.h:159
return int(ret)+1
RealScalar alpha
Definition: level1_cplx_impl.h:151
int * m
Definition: level2_cplx_impl.h:294
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE ResScalar combine_scalar_factors(const ResScalar &alpha, const Lhs &lhs, const Rhs &rhs)
Definition: BlasUtil.h:609
EIGEN_DEVICE_FUNC void prefetch(const Scalar *addr)
Definition: GenericPacketMath.h:967
static Index first_default_aligned(const DenseBase< Derived > &m)
Definition: DenseCoeffsBase.h:539
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE const T::Scalar * extract_data(const T &m)
Definition: BlasUtil.h:581
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
Definition: AutoDiffScalar.h:482
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
CwiseBinaryOp< internal::scalar_sum_op< double, double >, const CpyMatrixXd, const CpyMatrixXd > XprType
Definition: nestbyvalue.cpp:15
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: TensorMeta.h:47
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(Scalar *to, const Index stride, Index i, Index j, const PacketBlock< Packet, n > &block) const
Definition: BlasUtil.h:164
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(Scalar *to, const Index stride, Index i, Index j, const PacketBlock< Packet, n > &block) const
Definition: BlasUtil.h:152
PacketBlockManagement< Index, Scalar, Packet, n, idx - 1, RowMajor > pbm
Definition: BlasUtil.h:142
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(Scalar *to, const Index stride, Index i, Index j, const PacketBlock< Packet, n > &block) const
Definition: BlasUtil.h:143
Definition: BlasUtil.h:130
PacketBlockManagement< Index, Scalar, Packet, n, idx - 1, StorageOrder > pbm
Definition: BlasUtil.h:131
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(Scalar *to, const Index stride, Index i, Index j, const PacketBlock< Packet, n > &block) const
Definition: BlasUtil.h:132
Definition: GenericPacketMath.h:1407
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(const blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType, Incr > *, Index, Index, const PacketBlock< SubPacket, n > &) const
Definition: BlasUtil.h:404
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(const blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType, Incr > *, Index, Index, const PacketBlock< SubPacket, n > &) const
Definition: BlasUtil.h:418
storePacketBlock_helper< SubPacket, std::complex< float >, n, idx - 1 > spbh
Definition: BlasUtil.h:378
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(const blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType, Incr > *sup, Index i, Index j, const PacketBlock< SubPacket, n > &block) const
Definition: BlasUtil.h:379
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(const blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType, Incr > *, Index, Index, const PacketBlock< SubPacket, n > &) const
Definition: BlasUtil.h:411
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(const blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType, Incr > *sup, Index i, Index j, const PacketBlock< SubPacket, n > &block) const
Definition: BlasUtil.h:390
storePacketBlock_helper< SubPacket, std::complex< double >, n, idx - 1 > spbh
Definition: BlasUtil.h:389
storePacketBlock_helper< SubPacket, Scalar_, n, idx - 1 > spbh
Definition: BlasUtil.h:367
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void store(const blas_data_mapper< Scalar, Index, StorageOrder, AlignmentType, Incr > *sup, Index i, Index j, const PacketBlock< SubPacket, n > &block) const
Definition: BlasUtil.h:368
static EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC ExtractType extract(const XprType &x)
Definition: BlasUtil.h:506
CwiseBinaryOp< scalar_product_op< Scalar >, const CwiseNullaryOp< scalar_constant_op< Scalar >, Plain >, NestedXpr > XprType
Definition: BlasUtil.h:504
static EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC Scalar extractScalarFactor(const XprType &x)
Definition: BlasUtil.h:509
CwiseBinaryOp< scalar_product_op< Scalar >, NestedXpr, const CwiseNullaryOp< scalar_constant_op< Scalar >, Plain > > XprType
Definition: BlasUtil.h:520
static EIGEN_DEVICE_FUNC ExtractType extract(const XprType &x)
Definition: BlasUtil.h:490
CwiseUnaryOp< scalar_conjugate_op< Scalar >, NestedXpr > XprType
Definition: BlasUtil.h:486
static EIGEN_DEVICE_FUNC Scalar extractScalarFactor(const XprType &x)
Definition: BlasUtil.h:491
static EIGEN_DEVICE_FUNC Scalar extractScalarFactor(const XprType &x)
Definition: BlasUtil.h:540
static EIGEN_DEVICE_FUNC ExtractType extract(const XprType &x)
Definition: BlasUtil.h:539
CwiseUnaryOp< scalar_opposite_op< Scalar >, NestedXpr > XprType
Definition: BlasUtil.h:537
Transpose< const typename Base::ExtractType_ > ExtractType_
Definition: BlasUtil.h:553
static EIGEN_DEVICE_FUNC Scalar extractScalarFactor(const XprType &x)
Definition: BlasUtil.h:560
static EIGEN_DEVICE_FUNC ExtractType extract(const XprType &x)
Definition: BlasUtil.h:557
Transpose< NestedXpr > XprType
Definition: BlasUtil.h:550
blas_traits< NestedXpr > Base
Definition: BlasUtil.h:549
Transpose< const typename Base::ExtractType_ > ExtractType
Definition: BlasUtil.h:552
NestedXpr::Scalar Scalar
Definition: BlasUtil.h:548
std::conditional_t< bool(Base::HasUsableDirectAccess), ExtractType, typename ExtractType::PlainObject > DirectLinearAccessType
Definition: BlasUtil.h:555
Definition: BlasUtil.h:459
static EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC ExtractType extract(const XprType &x)
Definition: BlasUtil.h:476
@ HasUsableDirectAccess
Definition: BlasUtil.h:467
@ NeedToConjugate
Definition: BlasUtil.h:466
@ HasScalarFactor
Definition: BlasUtil.h:472
@ IsComplex
Definition: BlasUtil.h:464
@ IsTransposed
Definition: BlasUtil.h:465
const XprType & ExtractType
Definition: BlasUtil.h:461
XprType ExtractType_
Definition: BlasUtil.h:462
std::conditional_t< bool(HasUsableDirectAccess), ExtractType, typename ExtractType_::PlainObject > DirectLinearAccessType
Definition: BlasUtil.h:475
traits< XprType >::Scalar Scalar
Definition: BlasUtil.h:460
static EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC const Scalar extractScalarFactor(const XprType &)
Definition: BlasUtil.h:477
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run(const Lhs &lhs, const Rhs &rhs)
Definition: BlasUtil.h:600
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run(const bool &alpha, const Lhs &lhs, const Rhs &rhs)
Definition: BlasUtil.h:603
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE ResScalar run(const Lhs &lhs, const Rhs &rhs)
Definition: BlasUtil.h:591
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE ResScalar run(const ResScalar &alpha, const Lhs &lhs, const Rhs &rhs)
Definition: BlasUtil.h:594
static EIGEN_DEVICE_FUNC T::Scalar * run(const T &)
Definition: BlasUtil.h:577
Definition: BlasUtil.h:569
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE const T::Scalar * run(const T &m)
Definition: BlasUtil.h:570
Definition: BlasUtil.h:34
Definition: BlasUtil.h:30
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NumTraits< Scalar >::Real run(const Scalar &x)
Definition: BlasUtil.h:51
Definition: BlasUtil.h:45
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE To run(const From &x)
Definition: BlasUtil.h:46
Definition: DenseCoeffsBase.h:546
Template functor to compute the conjugate of a complex value.
Definition: functors/UnaryFunctors.h:132
Definition: NullaryFunctors.h:21
Template functor to compute the opposite of a scalar.
Definition: functors/UnaryFunctors.h:26
Template functor to compute the product of two scalars.
Definition: BinaryFunctors.h:73
Definition: ForwardDeclarations.h:21
Definition: datatypes.h:12
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
Definition: ZVector/PacketMath.h:50