summaryrefslogtreecommitdiff
path: root/log-fourier.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-13 17:21:51 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-13 17:21:51 -0300
commit7ea7b097f558475fa8f12cef2decd9edc5eb33be (patch)
treed73b31d4915a01eb10e693e59e445d11772bc9f1 /log-fourier.cpp
parent1fc4ab6990ddb93e65a4a76d5d378d282c84d901 (diff)
downloadcode-7ea7b097f558475fa8f12cef2decd9edc5eb33be.tar.gz
code-7ea7b097f558475fa8f12cef2decd9edc5eb33be.tar.bz2
code-7ea7b097f558475fa8f12cef2decd9edc5eb33be.zip
Adjust μ continuously
Diffstat (limited to 'log-fourier.cpp')
-rw-r--r--log-fourier.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/log-fourier.cpp b/log-fourier.cpp
index d5ac17d..345e490 100644
--- a/log-fourier.cpp
+++ b/log-fourier.cpp
@@ -190,7 +190,7 @@ Real estimateZ(LogarithmicFourierTransform& fft, const std::vector<Real>& C, con
return ((2 * Γ₀ * std::conj(Rt[0]) + std::pow(β, 2) * (RddfCt[0] * Ct[0] + dfCt[0] * std::conj(Rt[0]))) / Ct[0]).real();
}
-Real energy(const LogarithmicFourierTransform& fft, std::vector<Real>& C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ, Real β) {
+Real energy(const LogarithmicFourierTransform& fft, const std::vector<Real>& C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ, Real β) {
unsigned n₀ = 0;
for (unsigned n = 0; n < C.size(); n++) {
if (C[n] > 1 || R[n] > 1) n₀ = n % 2 == 0 ? n / 2 : (n + 1) / 2;
@@ -221,3 +221,25 @@ Real energy(const LogarithmicFourierTransform& fft, std::vector<Real>& C, const
return β * E;
}
+Real C0(const LogarithmicFourierTransform& fft, const std::vector<Complex>& Ĉ) {
+ Real C = 0;
+ for (unsigned n = 0; n < Ĉ.size()/2-1; n++) {
+ Real Ĉ₂ₙ = Ĉ[2*n].real();
+ Real Ĉ₂ₙ₊₁ = Ĉ[2*n+1].real();
+ Real Ĉ₂ₙ₊₂ = Ĉ[2*n+2].real();
+
+ 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₂ₙ = Ĉ₂ₙ;
+ Real f₂ₙ₊₁ = Ĉ₂ₙ₊₁;
+ Real f₂ₙ₊₂ = Ĉ₂ₙ₊₂;
+
+ C += (h₂ₙ + h₂ₙ₊₁) / 6 * (
+ (2 - h₂ₙ₊₁ / h₂ₙ) * f₂ₙ
+ + std::pow(h₂ₙ + h₂ₙ₊₁, 2) / (h₂ₙ * h₂ₙ₊₁) * f₂ₙ₊₁
+ + (2 - h₂ₙ / h₂ₙ₊₁) * f₂ₙ₊₂
+ );
+ }
+ return C / M_PI;
+}
+