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,
187 int Unrolling = redux_traits<Func, Evaluator>::Unrolling
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)
205 for(
Index i = 1;
i < xpr.outerSize(); ++
i)
206 for(
Index j = 0;
j < xpr.innerSize(); ++
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)
270 for(
Index index = alignedEnd; index <
size; ++index)
277 for(
Index index = 1; index <
size; ++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));
312 for(
Index i=packetedInnerSize;
i<innerSize; ++
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