26template<
typename Func,
typename Evaluator>
30 typedef typename find_best_packet<typename Evaluator::Scalar,Evaluator::SizeAtCompileTime>::type PacketType;
33 InnerMaxSize = int(Evaluator::IsRowMajor)
34 ? Evaluator::MaxColsAtCompileTime
35 : Evaluator::MaxRowsAtCompileTime,
36 OuterMaxSize = int(Evaluator::IsRowMajor)
37 ? Evaluator::MaxRowsAtCompileTime
38 : Evaluator::MaxColsAtCompileTime,
40 : int(OuterMaxSize)==
Dynamic ? (int(InnerMaxSize)>=int(PacketSize) ?
Dynamic : 0)
41 : (int(InnerMaxSize)/int(PacketSize)) *
int(OuterMaxSize)
45 MightVectorize = (int(Evaluator::Flags)&ActualPacketAccessBit)
47 MayLinearVectorize = bool(MightVectorize) && (int(Evaluator::Flags)&
LinearAccessBit),
48 MaySliceVectorize =
bool(MightVectorize) && (int(SliceVectorizedWork)==
Dynamic || int(SliceVectorizedWork)>=3)
53 Traversal = int(MayLinearVectorize) ? int(LinearVectorizedTraversal)
54 : int(MaySliceVectorize) ? int(SliceVectorizedTraversal)
55 : int(DefaultTraversal)
61 : int(Evaluator::SizeAtCompileTime) * int(Evaluator::CoeffReadCost) + (Evaluator::SizeAtCompileTime-1) *
functor_traits<Func>::Cost,
62 UnrollingLimit = EIGEN_UNROLLING_LIMIT * (
int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize))
67 Unrolling = Cost <= UnrollingLimit ? CompleteUnrolling : NoUnrolling
70#ifdef EIGEN_DEBUG_ASSIGN
73 std::cerr <<
"Xpr: " <<
typeid(
typename Evaluator::XprType).name() << std::endl;
74 std::cerr.setf(std::ios::hex, std::ios::basefield);
75 EIGEN_DEBUG_VAR(Evaluator::Flags)
76 std::cerr.unsetf(std::ios::hex);
77 EIGEN_DEBUG_VAR(InnerMaxSize)
78 EIGEN_DEBUG_VAR(OuterMaxSize)
79 EIGEN_DEBUG_VAR(SliceVectorizedWork)
80 EIGEN_DEBUG_VAR(PacketSize)
81 EIGEN_DEBUG_VAR(MightVectorize)
82 EIGEN_DEBUG_VAR(MayLinearVectorize)
83 EIGEN_DEBUG_VAR(MaySliceVectorize)
84 std::cerr <<
"Traversal" <<
" = " << Traversal <<
" (" <<
demangle_traversal(Traversal) <<
")" << std::endl;
85 EIGEN_DEBUG_VAR(UnrollingLimit)
86 std::cerr <<
"Unrolling" <<
" = " << Unrolling <<
" (" <<
demangle_unrolling(Unrolling) <<
")" << std::endl;
87 std::cerr << std::endl;
98template<
typename Func,
typename Evaluator,
int Start,
int Length>
102 HalfLength = Length/2
105 typedef typename Evaluator::Scalar Scalar;
108 static EIGEN_STRONG_INLINE Scalar run(
const Evaluator &
eval,
const Func& func)
115template<
typename Func,
typename Evaluator,
int Start>
119 outer = Start / Evaluator::InnerSizeAtCompileTime,
120 inner = Start % Evaluator::InnerSizeAtCompileTime
123 typedef typename Evaluator::Scalar Scalar;
126 static EIGEN_STRONG_INLINE Scalar run(
const Evaluator &
eval,
const Func&)
128 return eval.coeffByOuterInner(outer, inner);
135template<
typename Func,
typename Evaluator,
int Start>
138 typedef typename Evaluator::Scalar Scalar;
140 static EIGEN_STRONG_INLINE Scalar run(
const Evaluator&,
const Func&) {
return Scalar(); }
145template<
typename Func,
typename Evaluator,
int Start,
int Length>
148 template<
typename PacketType>
150 static EIGEN_STRONG_INLINE PacketType run(
const Evaluator &
eval,
const Func& func)
154 HalfLength = Length/2
157 return func.packetOp(
163template<
typename Func,
typename Evaluator,
int Start>
166 template<
typename PacketType>
168 static EIGEN_STRONG_INLINE PacketType run(
const Evaluator &
eval,
const Func&)
172 index = Start * PacketSize,
173 outer = index / int(Evaluator::InnerSizeAtCompileTime),
174 inner = index % int(Evaluator::InnerSizeAtCompileTime),
175 alignment = Evaluator::Alignment
185template<
typename Func,
typename Evaluator,
191template<
typename Func,
typename Evaluator>
192struct redux_impl<Func, Evaluator, DefaultTraversal, NoUnrolling>
194 typedef typename Evaluator::Scalar Scalar;
196 template<
typename XprType>
197 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE
198 Scalar run(
const Evaluator &
eval,
const Func& func,
const XprType&
xpr)
200 eigen_assert(
xpr.rows()>0 &&
xpr.cols()>0 &&
"you are using an empty matrix");
202 res =
eval.coeffByOuterInner(0, 0);
204 res = func(res,
eval.coeffByOuterInner(0, i));
207 res = func(res,
eval.coeffByOuterInner(i, j));
212template<
typename Func,
typename Evaluator>
213struct redux_impl<Func,Evaluator, DefaultTraversal, CompleteUnrolling>
217 typedef typename Evaluator::Scalar Scalar;
218 template<
typename XprType>
219 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE
220 Scalar run(
const Evaluator &
eval,
const Func& func,
const XprType& )
222 return Base::run(
eval,func);
226template<
typename Func,
typename Evaluator>
227struct redux_impl<Func, Evaluator, LinearVectorizedTraversal, NoUnrolling>
229 typedef typename Evaluator::Scalar Scalar;
230 typedef typename redux_traits<Func, Evaluator>::PacketType PacketScalar;
232 template<
typename XprType>
233 static Scalar run(
const Evaluator &
eval,
const Func& func,
const XprType&
xpr)
241 alignment = EIGEN_PLAIN_ENUM_MAX(
alignment0, Evaluator::Alignment)
268 res = func(res,
eval.coeff(index));
271 res = func(res,
eval.coeff(index));
277 for(
Index index = 1; index < size; ++index)
278 res = func(res,
eval.coeff(index));
286template<
typename Func,
typename Evaluator,
int Unrolling>
287struct redux_impl<Func, Evaluator, SliceVectorizedTraversal, Unrolling>
289 typedef typename Evaluator::Scalar Scalar;
290 typedef typename redux_traits<Func, Evaluator>::PacketType PacketType;
292 template<
typename XprType>
293 EIGEN_DEVICE_FUNC
static Scalar run(
const Evaluator &
eval,
const Func& func,
const XprType&
xpr)
295 eigen_assert(
xpr.rows()>0 &&
xpr.cols()>0 &&
"you are using an empty matrix");
306 for(
Index j=0; j<outerSize; ++j)
311 for(
Index j=0; j<outerSize; ++j)
313 res = func(res, eval.coeffByOuterInner(j,i));
318 res = redux_impl<Func, Evaluator, DefaultTraversal, NoUnrolling>::run(eval, func,
xpr);
325template<
typename Func,
typename Evaluator>
326struct redux_impl<Func, Evaluator, LinearVectorizedTraversal, CompleteUnrolling>
328 typedef typename Evaluator::Scalar Scalar;
330 typedef typename redux_traits<Func, Evaluator>::PacketType PacketType;
333 Size = Evaluator::SizeAtCompileTime,
334 VectorizedSize = (int(Size) / int(PacketSize)) *
int(PacketSize)
337 template<
typename XprType>
338 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE
339 Scalar run(
const Evaluator &
eval,
const Func& func,
const XprType &
xpr)
341 EIGEN_ONLY_USED_FOR_DEBUG(
xpr)
342 eigen_assert(
xpr.rows()>0 &&
xpr.cols()>0 &&
"you are using an empty matrix");
343 if (VectorizedSize > 0) {
345 if (VectorizedSize != Size)
356template<
typename _XprType>
362 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
365 typedef typename XprType::Scalar Scalar;
366 typedef typename XprType::CoeffReturnType CoeffReturnType;
367 typedef typename XprType::PacketScalar PacketScalar;
373 Flags = Base::Flags & ~DirectAccessBit,
376 InnerSizeAtCompileTime = XprType::InnerSizeAtCompileTime
379 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
380 CoeffReturnType coeffByOuterInner(
Index outer,
Index inner)
const
381 {
return Base::coeff(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); }
383 template<
int LoadMode,
typename PacketType>
384 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
385 PacketType packetByOuterInner(
Index outer,
Index inner)
const
406template<
typename Derived>
407template<
typename Func>
411 eigen_assert(this->rows()>0 && this->cols()>0 &&
"you are using an empty matrix");
428template<
typename Derived>
429template<
int NaNPropagation>
443template<
typename Derived>
444template<
int NaNPropagation>
457template<
typename Derived>
470template<
typename Derived>
474#ifdef __INTEL_COMPILER
476 #pragma warning ( disable : 2259 )
479#ifdef __INTEL_COMPILER
491template<
typename Derived>
506template<
typename Derived>
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:47
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const
Definition DenseBase.h:235
@ IsRowMajor
True if this expression has row-major storage order.
Definition DenseBase.h:170
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const
Definition DenseBase.h:223
internal::traits< Derived >::Scalar Scalar
The numeric type of the expression' coefficients, e.g.
Definition DenseBase.h:66
EIGEN_DEVICE_FUNC Scalar sum() const
Definition Redux.h:459
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
@ SizeAtCompileTime
This is equal to the number of coefficients, i.e.
Definition DenseBase.h:113
@ MaxColsAtCompileTime
This value is equal to the maximum possible number of columns that this expression might have.
Definition DenseBase.h:130
@ MaxRowsAtCompileTime
This value is equal to the maximum possible number of rows that this expression might have.
Definition DenseBase.h:119
EIGEN_DEVICE_FUNC DiagonalReturnType diagonal()
Definition Diagonal.h:187
@ Unaligned
Data pointer has no specific alignment.
Definition Constants.h:233
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition Constants.h:130
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array.
Definition Constants.h:155
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
const int HugeCost
This value means that the cost to evaluate an expression coefficient is either very expensive or cann...
Definition Constants.h:44
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22
Definition XprHelper.h:332
Definition CoreEvaluators.h:91
Definition XprHelper.h:176
Definition GenericPacketMath.h:107
Definition BinaryFunctors.h:172
Definition BinaryFunctors.h:139
Definition BinaryFunctors.h:71
Definition BinaryFunctors.h:33
Definition ForwardDeclarations.h:17
Definition GenericPacketMath.h:133