summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--log-fourier.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/log-fourier.cpp b/log-fourier.cpp
index be50260..b4f035b 100644
--- a/log-fourier.cpp
+++ b/log-fourier.cpp
@@ -190,10 +190,10 @@ Real estimateZ(LogarithmicFourierTransform& fft, const std::vector<Real>& C, con
Real energy(const LogarithmicFourierTransform& fft, std::vector<Real>& C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ, Real β) {
unsigned n₀;
for (unsigned n = 0; n < C.size(); n++) {
- if (C[n] > 1) n₀ = n;
+ if (C[n] > 1) n₀ = n % 2 == 0 ? n / 2 : (n + 1) / 2;
}
Real E = fft.t(n₀) * df(λ, p, s, 1);
- for (unsigned n = 0; n < C.size()/2-1; n++) {
+ for (unsigned n = n₀; n < C.size()/2-1; n++) {
Real R₂ₙ = R[2*n];
Real R₂ₙ₊₁ = R[2*n+1];
Real R₂ₙ₊₂ = R[2*n+2];