diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-04-02 22:55:42 -0300 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-04-02 22:55:42 -0300 |
commit | 0e2e87c3a2aab5c1b6f937c8a4b0d6a87f234194 (patch) | |
tree | 8f06f80be5329a9f87c977a32f1ab40595d14c6e | |
parent | 08536853054f2aa9e165b6b6bfb0862b71e54834 (diff) | |
download | code-0e2e87c3a2aab5c1b6f937c8a4b0d6a87f234194.tar.gz code-0e2e87c3a2aab5c1b6f937c8a4b0d6a87f234194.tar.bz2 code-0e2e87c3a2aab5c1b6f937c8a4b0d6a87f234194.zip |
Fixed large bug, small optimizations
-rw-r--r-- | fourier_integrator.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/fourier_integrator.cpp b/fourier_integrator.cpp index 7fc8ab4..829a074 100644 --- a/fourier_integrator.cpp +++ b/fourier_integrator.cpp @@ -152,21 +152,18 @@ int main(int argc, char* argv[]) { } std::vector<Complex> dfCt = fft.fourier(dfC); - std::vector<Complex> Ctnew(Ct.size()); - std::vector<Complex> Rtnew(Rt.size()); - for (unsigned i = 0; i < Rt.size(); i++) { Real ω = i * Δω; - Rtnew[i] = (1.0 + pow(y, 2) * RddfCt[i] * Rt[i]) / (z + 1i * ω); + Rt[i] = (1.0 + pow(y, 2) * RddfCt[i] * Rt[i]) / (z + 1i * ω); } - for (unsigned i = 0; i < Rt.size(); i++) { + for (unsigned i = 0; i < Ct.size(); i++) { Real ω = i * Δω; - Ctnew[i] = (Γ₀ * std::conj(Rt[i]) / (1 + pow(τ₀ * ω, 2)) + pow(y, 2) * (RddfCt[i] * Ct[i] + dfCt[i] * std::conj(Rt[i]))) / (z + 1i * ω); + Ct[i] = (Γ₀ * std::conj(Rt[i]) / (1 + pow(τ₀ * ω, 2)) + pow(y, 2) * (RddfCt[i] * Ct[i] + dfCt[i] * std::conj(Rt[i]))) / (z + 1i * ω); } - std::vector<Real> Cnew = fft.inverse(Ctnew); - std::vector<Real> Rnew = fft.inverse(Rtnew); + std::vector<Real> Cnew = fft.inverse(Ct); + std::vector<Real> Rnew = fft.inverse(Rt); ΔC = 0; for (unsigned i = 0; i < Cnew.size(); i++) { @@ -174,7 +171,6 @@ int main(int argc, char* argv[]) { ΔC += pow(Rnew[i] - R[i], 2); } - /* for (unsigned i = 0; i < Cnew.size(); i++) { C[i] += γ * (Cnew[i] - C[i]); } @@ -182,10 +178,6 @@ int main(int argc, char* argv[]) { for (unsigned i = 0; i < Rnew.size(); i++) { R[i] += γ * (Rnew[i] - R[i]); } - */ - - C = Cnew; - R = Rnew; z *= Cnew[0]; |