21 template<
int BlockRows>
inline
25 for(
Index k=0; k<i; k++)
26 for(
Index w=0; w<BlockRows; w++)
27 blockA[count++] = lhs(i+w,k);
30 for(
Index k=i; k<i+BlockRows; k++)
32 for(
Index w=0; w<h; w++)
33 blockA[count++] = numext::conj(lhs(k, i+w));
35 blockA[count++] = numext::real(lhs(k,k));
37 for(
Index w=h+1; w<BlockRows; w++)
38 blockA[count++] = lhs(i+w, k);
42 for(
Index k=i+BlockRows; k<cols; k++)
43 for(
Index w=0; w<BlockRows; w++)
44 blockA[count++] = numext::conj(lhs(k, i+w));
46 void operator()(Scalar* blockA,
const Scalar* _lhs,
Index lhsStride,
Index cols,
Index rows)
53 HasHalf = (int)HalfPacketSize < (
int)PacketSize,
54 HasQuarter = (int)QuarterPacketSize < (
int)HalfPacketSize};
60 const Index peeled_mc3 = Pack1>=3*PacketSize ? (rows/(3*PacketSize))*(3*PacketSize) : 0;
61 const Index peeled_mc2 = Pack1>=2*PacketSize ? peeled_mc3+((rows-peeled_mc3)/(2*PacketSize))*(2*PacketSize) : 0;
62 const Index peeled_mc1 = Pack1>=1*PacketSize ? peeled_mc2+((rows-peeled_mc2)/(1*PacketSize))*(1*PacketSize) : 0;
63 const Index peeled_mc_half = Pack1>=HalfPacketSize ? peeled_mc1+((rows-peeled_mc1)/(HalfPacketSize))*(HalfPacketSize) : 0;
64 const Index peeled_mc_quarter = Pack1>=QuarterPacketSize ? peeled_mc_half+((rows-peeled_mc_half)/(QuarterPacketSize))*(QuarterPacketSize) : 0;
66 if(Pack1>=3*PacketSize)
67 for(
Index i=0; i<peeled_mc3; i+=3*PacketSize)
68 pack<3*PacketSize>(blockA, lhs, cols, i, count);
70 if(Pack1>=2*PacketSize)
71 for(
Index i=peeled_mc3; i<peeled_mc2; i+=2*PacketSize)
72 pack<2*PacketSize>(blockA, lhs, cols, i, count);
74 if(Pack1>=1*PacketSize)
75 for(
Index i=peeled_mc2; i<peeled_mc1; i+=1*PacketSize)
76 pack<1*PacketSize>(blockA, lhs, cols, i, count);
78 if(HasHalf && Pack1>=HalfPacketSize)
79 for(
Index i=peeled_mc1; i<peeled_mc_half; i+=HalfPacketSize)
80 pack<HalfPacketSize>(blockA, lhs, cols, i, count);
82 if(HasQuarter && Pack1>=QuarterPacketSize)
83 for(
Index i=peeled_mc_half; i<peeled_mc_quarter; i+=QuarterPacketSize)
84 pack<QuarterPacketSize>(blockA, lhs, cols, i, count);
87 for(
Index i=peeled_mc_quarter; i<rows; i++)
89 for(
Index k=0; k<i; k++)
90 blockA[count++] = lhs(i, k);
92 blockA[count++] = numext::real(lhs(i, i));
94 for(
Index k=i+1; k<cols; k++)
95 blockA[count++] = numext::conj(lhs(k, i));
104 void operator()(Scalar* blockB,
const Scalar* _rhs,
Index rhsStride,
Index rows,
Index cols,
Index k2)
106 Index end_k = k2 + rows;
109 Index packet_cols8 = nr>=8 ? (cols/8) * 8 : 0;
110 Index packet_cols4 = nr>=4 ? (cols/4) * 4 : 0;
113 for(
Index j2=0; j2<k2; j2+=nr)
115 for(
Index k=k2; k<end_k; k++)
117 blockB[count+0] = rhs(k,j2+0);
118 blockB[count+1] = rhs(k,j2+1);
121 blockB[count+2] = rhs(k,j2+2);
122 blockB[count+3] = rhs(k,j2+3);
126 blockB[count+4] = rhs(k,j2+4);
127 blockB[count+5] = rhs(k,j2+5);
128 blockB[count+6] = rhs(k,j2+6);
129 blockB[count+7] = rhs(k,j2+7);
136 Index end8 = nr>=8 ? (std::min)(k2+rows,packet_cols8) : k2;
139 for(
Index j2=k2; j2<end8; j2+=8)
143 for(
Index k=k2; k<j2; k++)
145 blockB[count+0] = numext::conj(rhs(j2+0,k));
146 blockB[count+1] = numext::conj(rhs(j2+1,k));
147 blockB[count+2] = numext::conj(rhs(j2+2,k));
148 blockB[count+3] = numext::conj(rhs(j2+3,k));
149 blockB[count+4] = numext::conj(rhs(j2+4,k));
150 blockB[count+5] = numext::conj(rhs(j2+5,k));
151 blockB[count+6] = numext::conj(rhs(j2+6,k));
152 blockB[count+7] = numext::conj(rhs(j2+7,k));
157 for(
Index k=j2; k<j2+8; k++)
160 for (
Index w=0 ; w<h; ++w)
161 blockB[count+w] = rhs(k,j2+w);
163 blockB[count+h] = numext::real(rhs(k,k));
166 for (
Index w=h+1 ; w<8; ++w)
167 blockB[count+w] = numext::conj(rhs(j2+w,k));
172 for(
Index k=j2+8; k<end_k; k++)
174 blockB[count+0] = rhs(k,j2+0);
175 blockB[count+1] = rhs(k,j2+1);
176 blockB[count+2] = rhs(k,j2+2);
177 blockB[count+3] = rhs(k,j2+3);
178 blockB[count+4] = rhs(k,j2+4);
179 blockB[count+5] = rhs(k,j2+5);
180 blockB[count+6] = rhs(k,j2+6);
181 blockB[count+7] = rhs(k,j2+7);
188 for(
Index j2=end8; j2<(std::min)(k2+rows,packet_cols4); j2+=4)
192 for(
Index k=k2; k<j2; k++)
194 blockB[count+0] = numext::conj(rhs(j2+0,k));
195 blockB[count+1] = numext::conj(rhs(j2+1,k));
196 blockB[count+2] = numext::conj(rhs(j2+2,k));
197 blockB[count+3] = numext::conj(rhs(j2+3,k));
202 for(
Index k=j2; k<j2+4; k++)
205 for (
Index w=0 ; w<h; ++w)
206 blockB[count+w] = rhs(k,j2+w);
208 blockB[count+h] = numext::real(rhs(k,k));
211 for (
Index w=h+1 ; w<4; ++w)
212 blockB[count+w] = numext::conj(rhs(j2+w,k));
217 for(
Index k=j2+4; k<end_k; k++)
219 blockB[count+0] = rhs(k,j2+0);
220 blockB[count+1] = rhs(k,j2+1);
221 blockB[count+2] = rhs(k,j2+2);
222 blockB[count+3] = rhs(k,j2+3);
231 for(
Index j2=k2+rows; j2<packet_cols8; j2+=8)
233 for(
Index k=k2; k<end_k; k++)
235 blockB[count+0] = numext::conj(rhs(j2+0,k));
236 blockB[count+1] = numext::conj(rhs(j2+1,k));
237 blockB[count+2] = numext::conj(rhs(j2+2,k));
238 blockB[count+3] = numext::conj(rhs(j2+3,k));
239 blockB[count+4] = numext::conj(rhs(j2+4,k));
240 blockB[count+5] = numext::conj(rhs(j2+5,k));
241 blockB[count+6] = numext::conj(rhs(j2+6,k));
242 blockB[count+7] = numext::conj(rhs(j2+7,k));
249 for(
Index j2=(std::max)(packet_cols8,k2+rows); j2<packet_cols4; j2+=4)
251 for(
Index k=k2; k<end_k; k++)
253 blockB[count+0] = numext::conj(rhs(j2+0,k));
254 blockB[count+1] = numext::conj(rhs(j2+1,k));
255 blockB[count+2] = numext::conj(rhs(j2+2,k));
256 blockB[count+3] = numext::conj(rhs(j2+3,k));
263 for(
Index j2=packet_cols4; j2<cols; ++j2)
269 blockB[count] = numext::conj(rhs(j2,k));
275 blockB[count] = numext::real(rhs(j2,j2));
284 blockB[count] = rhs(k,j2);
507 template<
typename Dest>
508 static void run(Dest &dst,
const Lhs &a_lhs,
const Rhs &a_rhs,
const Scalar& alpha)
510 eigen_assert(dst.rows()==a_lhs.rows() && dst.cols()==a_rhs.cols());
512 typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(a_lhs);
513 typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(a_rhs);
515 Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(a_lhs)
516 * RhsBlasTraits::extractScalarFactor(a_rhs);
519 Lhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxColsAtCompileTime,1> BlockingType;
521 BlockingType blocking(lhs.rows(), rhs.cols(), lhs.cols(), 1,
false);
529 Dest::InnerStrideAtCompileTime>
531 lhs.rows(), rhs.cols(),
532 &lhs.coeffRef(0,0), lhs.outerStride(),
533 &rhs.coeffRef(0,0), rhs.outerStride(),
534 &dst.coeffRef(0,0), dst.innerStride(), dst.outerStride(),
535 actualAlpha, blocking