diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-05-09 11:59:52 -0300 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-05-09 11:59:52 -0300 |
commit | 516a9832d1f237396211a4806925d81e64ba7b14 (patch) | |
tree | a025aa6b1419baa4c803e5103d519f02d6426afe | |
parent | 7b87846abcede7c9d16b87e29f9fb0516493706b (diff) | |
download | code-516a9832d1f237396211a4806925d81e64ba7b14.tar.gz code-516a9832d1f237396211a4806925d81e64ba7b14.tar.bz2 code-516a9832d1f237396211a4806925d81e64ba7b14.zip |
Undid energy tweaks, and restored mirror padding
-rw-r--r-- | log-fourier.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/log-fourier.cpp b/log-fourier.cpp index 11edfcb..5d0da17 100644 --- a/log-fourier.cpp +++ b/log-fourier.cpp @@ -64,6 +64,8 @@ std::vector<Complex> LogarithmicFourierTransform::fourier(const std::vector<Real for (unsigned n = 0; n < pad*N; n++) { if (n < N) { a[n] = c[n] * exp((1 - k) * τ(n)); + } else if (n >= (pad - 1) * N) { + a[n] = c[pad*N-n-1] * exp((1 - k) * τ(pad*N-n-1)); } else { a[n] = 0; } @@ -92,6 +94,8 @@ std::vector<Real> LogarithmicFourierTransform::inverse(const std::vector<Complex for (unsigned n = 0; n < pad * N; n++) { if (n < N) { a[n] = (ĉ[n].real() + II * σ * ĉ[n].imag()) * std::exp((1 - k) * ω(n)); + } else if (n >= (pad - 1) * N) { + a[n] = (ĉ[pad*N-n-1].real() + II * σ * ĉ[pad*N-n-1].imag()) * std::exp((1 - k) * ω(pad*N-n-1)); } else { a[n] = 0; } @@ -193,30 +197,6 @@ Real energy(const LogarithmicFourierTransform& fft, std::vector<Real>& C, const Real C₂ₙ₊₁ = C[2*n+1]; Real C₂ₙ₊₂ = C[2*n+2]; - if (R₂ₙ > 1 || R₂ₙ₊₁ > 1 || R₂ₙ₊₂ > 1) { - R₂ₙ = 1; - R₂ₙ₊₁ = 1; - R₂ₙ₊₂ = 1; - } - - if (C₂ₙ > 1 || C₂ₙ₊₁ > 1 || C₂ₙ₊₂ > 1) { - C₂ₙ = 1; - C₂ₙ₊₁ = 1; - C₂ₙ₊₂ = 1; - } - - if (R₂ₙ < 0 || R₂ₙ₊₁ < 0 || R₂ₙ₊₂ < 0) { - R₂ₙ = 0; - R₂ₙ₊₁ = 0; - R₂ₙ₊₂ = 0; - } - - if (C₂ₙ < 0 || C₂ₙ₊₁ < 0 || C₂ₙ₊₂ < 0) { - C₂ₙ = 0; - C₂ₙ₊₁ = 0; - C₂ₙ₊₂ = 0; - } - 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₂ₙ * df(λ, p, s, C₂ₙ); |