26template<
typename Func,
typename Evaluator>
34 ? Evaluator::MaxColsAtCompileTime
35 : Evaluator::MaxRowsAtCompileTime,
37 ? Evaluator::MaxRowsAtCompileTime
38 : Evaluator::MaxColsAtCompileTime,
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);
76 std::cerr.unsetf(std::ios::hex);
84 std::cerr <<
"Traversal" <<
" = " <<
Traversal <<
" (" << demangle_traversal(
Traversal) <<
")" << std::endl;
86 std::cerr <<
"Unrolling" <<
" = " << Unrolling <<
" (" << demangle_unrolling(Unrolling) <<
")" << std::endl;
87 std::cerr << std::endl;
98template<
typename Func,
typename Evaluator,
int Start,
int Length>
105 typedef typename Evaluator::Scalar
Scalar;
115template<
typename Func,
typename Evaluator,
int Start>
119 outer = Start / Evaluator::InnerSizeAtCompileTime,
120 inner = Start % Evaluator::InnerSizeAtCompileTime
123 typedef typename Evaluator::Scalar
Scalar;
128 return eval.coeffByOuterInner(outer, inner);
135template<
typename Func,
typename Evaluator,
int Start>
138 typedef typename Evaluator::Scalar
Scalar;
145template<
typename Func,
typename Evaluator,
int Start,
int Length>
148 template<
typename PacketType>
154 HalfLength = Length/2
157 return func.packetOp(
163template<
typename Func,
typename Evaluator,
int Start>
166 template<
typename PacketType>
172 index = Start * PacketSize,
173 outer =
index / int(Evaluator::InnerSizeAtCompileTime),
174 inner =
index % int(Evaluator::InnerSizeAtCompileTime),
175 alignment = Evaluator::Alignment
177 return eval.template packetByOuterInner<alignment,PacketType>(outer, inner);
185template<
typename Func,
typename Evaluator,
187 int Unrolling = redux_traits<Func, Evaluator>::Unrolling
191template<
typename Func,
typename Evaluator>
194 typedef typename Evaluator::Scalar
Scalar;
196 template<
typename XprType>
200 eigen_assert(xpr.rows()>0 && xpr.cols()>0 &&
"you are using an empty matrix");
202 res =
eval.coeffByOuterInner(0, 0);
203 for(
Index i = 1; i < xpr.innerSize(); ++i)
204 res = func(res,
eval.coeffByOuterInner(0, i));
205 for(
Index i = 1; i < xpr.outerSize(); ++i)
206 for(
Index j = 0; j < xpr.innerSize(); ++j)
207 res = func(res,
eval.coeffByOuterInner(i, j));
212template<
typename Func,
typename Evaluator>
217 typedef typename Evaluator::Scalar
Scalar;
218 template<
typename XprType>
222 return Base::run(
eval,func);
226template<
typename Func,
typename Evaluator>
229 typedef typename Evaluator::Scalar
Scalar;
232 template<
typename XprType>
233 static Scalar run(
const Evaluator &
eval,
const Func& func,
const XprType& xpr)
244 const Index alignedSize2 = ((
size-alignedStart)/(2*packetSize))*(2*packetSize);
245 const Index alignedSize = ((
size-alignedStart)/(packetSize))*(packetSize);
246 const Index alignedEnd2 = alignedStart + alignedSize2;
247 const Index alignedEnd = alignedStart + alignedSize;
251 PacketScalar packet_res0 =
eval.template packet<alignment,PacketScalar>(alignedStart);
252 if(alignedSize>packetSize)
254 PacketScalar packet_res1 =
eval.template packet<alignment,PacketScalar>(alignedStart+packetSize);
257 packet_res0 = func.packetOp(packet_res0,
eval.template packet<alignment,PacketScalar>(
index));
258 packet_res1 = func.packetOp(packet_res1,
eval.template packet<alignment,PacketScalar>(
index+packetSize));
261 packet_res0 = func.packetOp(packet_res0,packet_res1);
262 if(alignedEnd>alignedEnd2)
263 packet_res0 = func.packetOp(packet_res0,
eval.template packet<alignment,PacketScalar>(alignedEnd2));
265 res = func.predux(packet_res0);
286template<
typename Func,
typename Evaluator,
int Unrolling>
289 typedef typename Evaluator::Scalar
Scalar;
292 template<
typename XprType>
295 eigen_assert(xpr.rows()>0 && xpr.cols()>0 &&
"you are using an empty matrix");
296 const Index innerSize = xpr.innerSize();
297 const Index outerSize = xpr.outerSize();
301 const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize;
303 if(packetedInnerSize)
305 PacketType packet_res =
eval.template packet<Unaligned,PacketType>(0,0);
306 for(
Index j=0; j<outerSize; ++j)
307 for(
Index i=(j==0?packetSize:0); i<packetedInnerSize; i+=
Index(packetSize))
308 packet_res = func.packetOp(packet_res,
eval.template packetByOuterInner<Unaligned,PacketType>(j,i));
310 res = func.predux(packet_res);
311 for(
Index j=0; j<outerSize; ++j)
312 for(
Index i=packetedInnerSize; i<innerSize; ++i)
313 res = func(res, eval.coeffByOuterInner(j,i));
325template<
typename Func,
typename Evaluator>
328 typedef typename Evaluator::Scalar
Scalar;
333 Size = Evaluator::SizeAtCompileTime,
334 VectorizedSize = (int(Size) / int(PacketSize)) *
int(PacketSize)
337 template<
typename XprType>
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>
373 Flags = Base::Flags & ~DirectAccessBit,
383 template<
int LoadMode,
typename PacketType>
386 {
return Base::template packet<LoadMode,PacketType>(
IsRowMajor ? outer : inner,
IsRowMajor ? inner : outer); }
406template<
typename Derived>
407template<
typename Func>
411 eigen_assert(this->rows()>0 && this->cols()>0 &&
"you are using an empty matrix");
414 ThisEvaluator thisEval(derived());
428template<
typename Derived>
429template<
int NaNPropagation>
443template<
typename Derived>
444template<
int NaNPropagation>
457template<
typename Derived>
461 if(SizeAtCompileTime==0 || (SizeAtCompileTime==
Dynamic &&
size()==0))
470template<
typename Derived>
474#ifdef __INTEL_COMPILER
476 #pragma warning ( disable : 2259 )
479#ifdef __INTEL_COMPILER
491template<
typename Derived>
495 if(SizeAtCompileTime==0 || (SizeAtCompileTime==
Dynamic &&
size()==0))
506template<
typename Derived>
510 return derived().diagonal().sum();
#define EIGEN_PLAIN_ENUM_MAX(a, b)
Definition: Macros.h:1299
#define EIGEN_DEBUG_VAR(x)
Definition: Macros.h:908
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:1059
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define EIGEN_UNROLLING_LIMIT
Defines the maximal loop size to enable meta unrolling of loops.
Definition: Settings.h:24
internal::traits< Derived >::Scalar Scalar
The numeric type of the expression' coefficients, e.g.
Definition: DenseBase.h:66
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar minCoeff() const
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar maxCoeff() const
EIGEN_DEVICE_FUNC Scalar prod() const
Definition: Redux.h:493
EIGEN_DEVICE_FUNC Scalar redux(const BinaryOp &func) const
EIGEN_DEVICE_FUNC Scalar sum() const
Definition: Redux.h:459
EIGEN_DEVICE_FUNC Scalar mean() const
Definition: Redux.h:472
EIGEN_DEVICE_FUNC Scalar trace() const
Definition: Redux.h:508
XprType::Scalar Scalar
Definition: Redux.h:365
XprType::CoeffReturnType CoeffReturnType
Definition: Redux.h:366
XprType::PacketScalar PacketScalar
Definition: Redux.h:367
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE redux_evaluator(const XprType &xpr)
Definition: Redux.h:363
@ IsRowMajor
Definition: Redux.h:374
@ InnerSizeAtCompileTime
Definition: Redux.h:376
@ MaxColsAtCompileTime
Definition: Redux.h:371
@ Flags
Definition: Redux.h:373
@ SizeAtCompileTime
Definition: Redux.h:375
@ MaxRowsAtCompileTime
Definition: Redux.h:370
_XprType XprType
Definition: Redux.h:361
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetByOuterInner(Index outer, Index inner) const
Definition: Redux.h:385
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const
Definition: Redux.h:380
@ 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
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
EIGEN_DEVICE_FUNC Index first_default_aligned(const Scalar *array, Index size)
Definition: Memory.h:497
Namespace containing all symbols from the Eigen library.
Definition: MatrixExponential.h:16
const unsigned int ActualPacketAccessBit
Definition: Constants.h:107
const int HugeCost
This value means that the cost to evaluate an expression coefficient is either very expensive or cann...
Definition: Constants.h:44
@ LinearVectorizedTraversal
Definition: Constants.h:285
@ DefaultTraversal
Definition: Constants.h:277
@ SliceVectorizedTraversal
Definition: Constants.h:288
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
@ CompleteUnrolling
Definition: Constants.h:304
@ NoUnrolling
Definition: Constants.h:299
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: Eigen_Colamd.h:50
Definition: XprHelper.h:332
Definition: CoreEvaluators.h:91
find_best_packet_helper< Size, typenamepacket_traits< T >::type >::type type
Definition: XprHelper.h:208
Definition: XprHelper.h:176
Definition: GenericPacketMath.h:107
redux_novec_unroller< Func, Evaluator, 0, Evaluator::SizeAtCompileTime > Base
Definition: Redux.h:216
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &)
Definition: Redux.h:220
Evaluator::Scalar Scalar
Definition: Redux.h:217
Evaluator::Scalar Scalar
Definition: Redux.h:194
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:198
Evaluator::Scalar Scalar
Definition: Redux.h:328
redux_traits< Func, Evaluator >::PacketType PacketType
Definition: Redux.h:330
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:339
redux_traits< Func, Evaluator >::PacketType PacketScalar
Definition: Redux.h:230
static Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:233
Evaluator::Scalar Scalar
Definition: Redux.h:229
static EIGEN_DEVICE_FUNC Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Definition: Redux.h:293
redux_traits< Func, Evaluator >::PacketType PacketType
Definition: Redux.h:290
Evaluator::Scalar Scalar
Definition: Redux.h:289
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &, const Func &)
Definition: Redux.h:140
Evaluator::Scalar Scalar
Definition: Redux.h:138
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &)
Definition: Redux.h:126
Evaluator::Scalar Scalar
Definition: Redux.h:123
@ HalfLength
Definition: Redux.h:102
Evaluator::Scalar Scalar
Definition: Redux.h:105
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func)
Definition: Redux.h:108
@ Traversal
Definition: Redux.h:53
@ SliceVectorizedWork
Definition: Redux.h:39
@ InnerMaxSize
Definition: Redux.h:33
@ PacketSize
Definition: Redux.h:32
@ OuterMaxSize
Definition: Redux.h:36
@ MayLinearVectorize
Definition: Redux.h:47
@ MaySliceVectorize
Definition: Redux.h:48
@ MightVectorize
Definition: Redux.h:45
find_best_packet< typenameEvaluator::Scalar, Evaluator::SizeAtCompileTime >::type PacketType
Definition: Redux.h:30
@ UnrollingLimit
Definition: Redux.h:62
@ Cost
Definition: Redux.h:60
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &)
Definition: Redux.h:168
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &func)
Definition: Redux.h:150
Definition: BinaryFunctors.h:172
Definition: BinaryFunctors.h:139
Definition: BinaryFunctors.h:71
Definition: BinaryFunctors.h:33
Definition: ForwardDeclarations.h:17
Definition: GenericPacketMath.h:133