From ac6ff5efd698584d24541250530e94a37482a161 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 8 Oct 2007 07:24:00 +0000 Subject: [PATCH] reverse certain inner loops. Now the benchmark runs in 3.5s instead of 5.5s before! --- src/Core/Dot.h | 2 +- src/Core/MatrixOps.h | 2 +- src/Core/Trace.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Core/Dot.h b/src/Core/Dot.h index 2e0f3958b..175c3e57d 100644 --- a/src/Core/Dot.h +++ b/src/Core/Dot.h @@ -32,11 +32,11 @@ struct EiDotUnroller static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { const int i = Index - 1; + EiDotUnroller::run(v1, v2, dot); if(i == Size - 1) dot = v1[i] * EiConj(v2[i]); else dot += v1[i] * EiConj(v2[i]); - EiDotUnroller::run(v1, v2, dot); } }; diff --git a/src/Core/MatrixOps.h b/src/Core/MatrixOps.h index 167296527..eb1682ab0 100644 --- a/src/Core/MatrixOps.h +++ b/src/Core/MatrixOps.h @@ -112,11 +112,11 @@ struct EiMatrixProductUnroller typename Lhs::Scalar &res) { const int i = Index - 1; + EiMatrixProductUnroller::run(row, col, lhs, rhs, res); if(i == Size - 1) res = lhs.read(row, i) * rhs.read(i, col); else res += lhs.read(row, i) * rhs.read(i, col); - EiMatrixProductUnroller::run(row, col, lhs, rhs, res); } }; diff --git a/src/Core/Trace.h b/src/Core/Trace.h index e78618ebe..df62118e1 100644 --- a/src/Core/Trace.h +++ b/src/Core/Trace.h @@ -31,11 +31,11 @@ template struct EiTraceUnroller static void run(const Derived &mat, typename Derived::Scalar &trace) { const int i = Index - 1; + EiTraceUnroller::run(mat, trace); if(i == Rows - 1) trace = mat(i, i); else trace += mat(i, i); - EiTraceUnroller::run(mat, trace); } };