diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-05-10 16:05:42 -0300 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-05-10 16:05:42 -0300 |
commit | c57e3fee38f36fdaf03e2b9c21be635594a1f704 (patch) | |
tree | 9047db1da6104436b875d26f1699bd5a853cd3b9 /log-fourier_integrator.cpp | |
parent | c7e75dcad3787ff56c5ee33fc59d437ca84dbb92 (diff) | |
download | code-c57e3fee38f36fdaf03e2b9c21be635594a1f704.tar.gz code-c57e3fee38f36fdaf03e2b9c21be635594a1f704.tar.bz2 code-c57e3fee38f36fdaf03e2b9c21be635594a1f704.zip |
Remove sub-zero and super-one values in the iteration
Diffstat (limited to 'log-fourier_integrator.cpp')
-rw-r--r-- | log-fourier_integrator.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/log-fourier_integrator.cpp b/log-fourier_integrator.cpp index 2d7d1f9..e4564c6 100644 --- a/log-fourier_integrator.cpp +++ b/log-fourier_integrator.cpp @@ -145,23 +145,25 @@ int main(int argc, char* argv[]) { std::vector<Real> Rₜ₊₁ = fft.inverse(Ȓₜ₊₁); std::vector<Real> Cₜ₊₁ = fft.inverse(Ĉₜ₊₁); - Real Cmin = Cₜ₊₁[N-1]; + Real C₀ = Cₜ₊₁[0]; + for (unsigned i = 0; i < N; i++) { - if (Cₜ₊₁[N-1-i] > Cmin) { - Cmin = Cₜ₊₁[N-1-i]; + if (Cₜ₊₁[i] < 0) { + Cₜ₊₁[i] = 0; + } + if (Cₜ₊₁[i] > 1) { + Cₜ₊₁[i] = 1; } - Cₜ₊₁[N-1-i] = Cmin; } - Real Rmin = Rₜ₊₁[N-1]; for (unsigned i = 0; i < N; i++) { - if (Rₜ₊₁[N-1-i] > Rmin) { - Rmin = Rₜ₊₁[N-1-i]; + if (Rₜ₊₁[i] < 0) { + Rₜ₊₁[i] = 0; + } + if (Rₜ₊₁[i] > 1) { + Rₜ₊₁[i] = 1; } - Rₜ₊₁[N-1-i] = Rmin; } - Real C₀ = Cₜ₊₁[0]; - μₜ *= pow(tanh(C₀-1)+1, x); ΔCₜ = 0; |