summaryrefslogtreecommitdiff
path: root/log-fourier.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-10 10:43:43 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-10 10:43:43 -0300
commit8e65ee1528e8b655d06e5b262d95495f0f127d99 (patch)
tree47eaf567c94ff575700cb299621f821d9718ae7a /log-fourier.cpp
parent90e7dcd17f264e22dc4f2e9f53ba82d3c292e42a (diff)
downloadcode-8e65ee1528e8b655d06e5b262d95495f0f127d99.tar.gz
code-8e65ee1528e8b655d06e5b262d95495f0f127d99.tar.bz2
code-8e65ee1528e8b655d06e5b262d95495f0f127d99.zip
Tweak to energy
Diffstat (limited to 'log-fourier.cpp')
-rw-r--r--log-fourier.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/log-fourier.cpp b/log-fourier.cpp
index e8404d7..afb7e55 100644
--- a/log-fourier.cpp
+++ b/log-fourier.cpp
@@ -184,8 +184,12 @@ 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++) {
+ unsigned n₀;
+ for (unsigned n = 0; n < C.size(); n++) {
+ if (C[n] > 1) n₀ = n;
+ }
+ Real E = fft.t(n₀) * df(λ, p, s, 1);
+ for (unsigned n = n₀ / 2; 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);