summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-08 17:43:46 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-08 17:43:46 -0300
commit21a99431f02e799de9a811f9f02ad006fe27df6d (patch)
tree12c66352f4ec73fb252d00759042160974faf8bb
parente151b804071d69a41beef04a73c12c42b12bd775 (diff)
downloadcode-21a99431f02e799de9a811f9f02ad006fe27df6d.tar.gz
code-21a99431f02e799de9a811f9f02ad006fe27df6d.tar.bz2
code-21a99431f02e799de9a811f9f02ad006fe27df6d.zip
Actually solved problems with log-Fourier
-rw-r--r--log-fourier.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/log-fourier.cpp b/log-fourier.cpp
index 9ae70be..2e93e87 100644
--- a/log-fourier.cpp
+++ b/log-fourier.cpp
@@ -78,6 +78,10 @@ std::vector<Complex> LogarithmicFourierTransform::fourier(const std::vector<Real
}
}
+ for (unsigned n = 0; n < N; n++) {
+ ĉ[n] -= ĉ[N - 1];
+ }
+
return ĉ;
}
@@ -87,11 +91,7 @@ std::vector<Real> LogarithmicFourierTransform::inverse(const std::vector<Complex
for (Real σ : σs) {
for (unsigned n = 0; n < pad * N; n++) {
if (n < N) {
- if (σ < 0) {
- a[n] = std::conj(ĉ[n]) * std::exp((1 - k) * ω(n));
- } else {
- a[n] = ĉ[n] * std::exp((1 - k) * ω(n));
- }
+ a[n] = (ĉ[n].real() + II * σ * ĉ[n].imag()) * std::exp((1 - k) * ω(n));
} else {
a[n] = 0;
}
@@ -106,6 +106,10 @@ std::vector<Real> LogarithmicFourierTransform::inverse(const std::vector<Complex
}
}
+ for (unsigned n = 0; n < N; n++) {
+ c[n] -= c[N - 1];
+ }
+
return c;
}