aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-08-20 16:43:28 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-08-20 16:43:28 +0000
commitff8e98c974b1cb7667a20049e992cd4fd0b1aeec (patch)
treea8638d715bb9a508bfa6ede9662b7b075846b01d /Eigen/src/Core
parentc501c7a4efb78a458c66c1333d52dde429c6e81e (diff)
Fix bugs in Sum.h, add unit-test
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/CMakeLists.txt2
-rw-r--r--Eigen/src/Core/Sum.h7
2 files changed, 4 insertions, 5 deletions
diff --git a/Eigen/src/Core/CMakeLists.txt b/Eigen/src/Core/CMakeLists.txt
index fb745a252..761e8c3f5 100644
--- a/Eigen/src/Core/CMakeLists.txt
+++ b/Eigen/src/Core/CMakeLists.txt
@@ -6,4 +6,4 @@ INSTALL(FILES
)
ADD_SUBDIRECTORY(util)
-ADD_SUBDIRECTORY(arch) \ No newline at end of file
+ADD_SUBDIRECTORY(arch)
diff --git a/Eigen/src/Core/Sum.h b/Eigen/src/Core/Sum.h
index 6c7280800..3b073b95e 100644
--- a/Eigen/src/Core/Sum.h
+++ b/Eigen/src/Core/Sum.h
@@ -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++)