summaryrefslogtreecommitdiff
path: root/log-fourier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'log-fourier.cpp')
-rw-r--r--log-fourier.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/log-fourier.cpp b/log-fourier.cpp
index 5b5955a..e8404d7 100644
--- a/log-fourier.cpp
+++ b/log-fourier.cpp
@@ -186,6 +186,7 @@ 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 β) {
Real E = fft.t(0) * (df(λ, p, s, 1) + R[0] * df(λ, p, s, C[0])) / 2;
for (unsigned n = 0; n < C.size()/2-1; n++) {
+ if (C[2*n+2] < 0 || R[2*n+2] < 0) break;
Real h₂ₙ = fft.t(2*n+1) - fft.t(2*n);
Real h₂ₙ₊₁ = fft.t(2*n+2) - fft.t(2*n+1);
Real f₂ₙ = R[2*n] * df(λ, p, s, C[2*n]);