mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix bugs in Sum.h, add unit-test
This commit is contained in:
@@ -6,4 +6,4 @@ INSTALL(FILES
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(util)
|
||||
ADD_SUBDIRECTORY(arch)
|
||||
ADD_SUBDIRECTORY(arch)
|
||||
|
||||
@@ -201,12 +201,11 @@ struct ei_sum_impl<Derived, LinearVectorization, NoUnrolling>
|
||||
const int alignedEnd = alignedStart + alignedSize;
|
||||
Scalar res;
|
||||
|
||||
if(Derived::SizeAtCompileTime>=2*packetSize && alignedSize >= 2*packetSize)
|
||||
if(alignedSize)
|
||||
{
|
||||
PacketScalar packet_res = mat.template packet<alignment>(alignedStart, alignedStart);
|
||||
PacketScalar packet_res = mat.template packet<alignment>(alignedStart);
|
||||
for(int index = alignedStart + packetSize; index < alignedEnd; index += packetSize)
|
||||
packet_res = ei_padd(packet_res, mat.template packet<alignment>(index));
|
||||
|
||||
res = ei_predux(packet_res);
|
||||
}
|
||||
else // too small to vectorize anything.
|
||||
@@ -215,7 +214,7 @@ struct ei_sum_impl<Derived, LinearVectorization, NoUnrolling>
|
||||
res = Scalar(0);
|
||||
}
|
||||
|
||||
for(int index = alignedEnd; index < size; index++)
|
||||
for(int index = 0; index < alignedStart; index++)
|
||||
res += mat.coeff(index);
|
||||
|
||||
for(int index = alignedEnd; index < size; index++)
|
||||
|
||||
Reference in New Issue
Block a user