26 template<
typename Func,
typename Evaluator>
34 ? Evaluator::MaxColsAtCompileTime
35 : Evaluator::MaxRowsAtCompileTime,
37 ? Evaluator::MaxRowsAtCompileTime
38 : Evaluator::MaxColsAtCompileTime,
70 #ifdef EIGEN_DEBUG_ASSIGN 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;
98 template<
typename Func,
typename Evaluator,
int Start,
int Length>
102 HalfLength = Length/2
115 template<
typename Func,
typename Evaluator,
int Start>
119 outer = Start / Evaluator::InnerSizeAtCompileTime,
120 inner = Start % Evaluator::InnerSizeAtCompileTime
128 return eval.coeffByOuterInner(outer, inner);
135 template<
typename Func,
typename Evaluator,
int Start>
145 template<
typename Func,
typename Evaluator,
int Start,
int Length>
148 template<
typename PacketType>
154 HalfLength = Length/2
157 return func.packetOp(
163 template<
typename Func,
typename Evaluator,
int Start>
166 template<
typename PacketType>
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);
185 template<
typename Func,
typename Evaluator,
191 template<
typename Func,
typename Evaluator>
196 template<
typename XprType>
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));
212 template<
typename Func,
typename Evaluator>
218 template<
typename XprType>
226 template<
typename Func,
typename Evaluator>
232 template<
typename XprType>
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);
255 for(
Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*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);
267 for(
Index index = 0; index < alignedStart; ++index)
268 res =
func(res,eval.coeff(index));
270 for(
Index index = alignedEnd; index <
size; ++index)
271 res =
func(res,eval.coeff(index));
277 for(
Index index = 1; index <
size; ++index)
278 res =
func(res,eval.coeff(index));
286 template<
typename Func,
typename Evaluator,
int Unrolling>
292 template<
typename XprType>
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);
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);
312 for(
Index i=packetedInnerSize;
i<innerSize; ++
i)
313 res =
func(res, eval.coeffByOuterInner(
j,
i));
325 template<
typename Func,
typename Evaluator>
333 Size = Evaluator::SizeAtCompileTime,
337 template<
typename XprType>
343 if (VectorizedSize > 0) {
345 if (VectorizedSize != Size)
356 template<
typename _XprType>
370 MaxRowsAtCompileTime = XprType::MaxRowsAtCompileTime,
371 MaxColsAtCompileTime = XprType::MaxColsAtCompileTime,
374 IsRowMajor = XprType::IsRowMajor,
375 SizeAtCompileTime = XprType::SizeAtCompileTime,
376 InnerSizeAtCompileTime = XprType::InnerSizeAtCompileTime
381 {
return Base::coeff(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); }
383 template<
int LoadMode,
typename PacketType>
386 {
return Base::template packet<LoadMode,PacketType>(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); }
406 template<
typename Derived>
407 template<
typename Func>
414 ThisEvaluator thisEval(derived());
428 template<
typename Derived>
429 template<
int NaNPropagation>
443 template<
typename Derived>
444 template<
int NaNPropagation>
457 template<
typename Derived>
461 if(SizeAtCompileTime==0 || (SizeAtCompileTime==
Dynamic &&
size()==0))
470 template<
typename Derived>
474 #ifdef __INTEL_COMPILER 476 #pragma warning ( disable : 2259 ) 479 #ifdef __INTEL_COMPILER 491 template<
typename Derived>
495 if(SizeAtCompileTime==0 || (SizeAtCompileTime==
Dynamic &&
size()==0))
506 template<
typename Derived>
510 return derived().diagonal().sum();
515 #endif // EIGEN_REDUX_H XprType::CoeffReturnType CoeffReturnType
find_best_packet_helper< Size, typename packet_traits< T >::type >::type type
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &func)
XprType::PacketScalar PacketScalar
const unsigned int ActualPacketAccessBit
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &)
redux_traits< Func, Evaluator >::PacketType PacketType
#define EIGEN_DEBUG_VAR(x)
const unsigned int DirectAccessBit
#define EIGEN_PLAIN_ENUM_MAX(a, b)
Namespace containing all symbols from the Eigen library.
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
internal::evaluator< _XprType > Base
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetByOuterInner(Index outer, Index inner) const
EIGEN_DEVICE_FUNC Scalar redux(const BinaryOp &func) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
static constexpr bool debug
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE redux_evaluator(const XprType &xpr)
static Index first_default_aligned(const DenseBase< Derived > &m)
EIGEN_DEVICE_FUNC Scalar trace() const
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
static Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
Generic expression where a coefficient-wise binary operator is applied to two expressions.
EIGEN_DEVICE_FUNC Scalar mean() const
EIGEN_DEVICE_FUNC Scalar prod() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar maxCoeff() const
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar minCoeff() const
static EIGEN_DEVICE_FUNC Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
EIGEN_DEVICE_FUNC Scalar sum() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const
find_best_packet< typename Evaluator::Scalar, Evaluator::SizeAtCompileTime >::type PacketType
EIGEN_CONSTEXPR Index size(const T &x)
#define EIGEN_DEVICE_FUNC
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &)
CwiseBinaryOp< internal::scalar_sum_op< double, double >, const CpyMatrixXd, const CpyMatrixXd > XprType
redux_traits< Func, Evaluator >::PacketType PacketScalar
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &, const Func &)
redux_novec_unroller< Func, Evaluator, 0, Evaluator::SizeAtCompileTime > Base
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func &)
const unsigned int LinearAccessBit
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func &func, const XprType &xpr)
#define EIGEN_UNROLLING_LIMIT
redux_traits< Func, Evaluator >::PacketType PacketType
#define EIGEN_ONLY_USED_FOR_DEBUG(x)