summaryrefslogtreecommitdiff
path: root/fourier.cpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-04-03 17:54:00 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-04-03 17:54:00 -0300
commita446c8ae813ae5e1c33d377dabd85d3d362b1878 (patch)
tree757a8f74f1c8cb2be42e03a337a6bf26d4ae5f2b /fourier.cpp
parent0120bef06d4e537703ee7f0852ad31eceb43abf3 (diff)
downloadcode-a446c8ae813ae5e1c33d377dabd85d3d362b1878.tar.gz
code-a446c8ae813ae5e1c33d377dabd85d3d362b1878.tar.bz2
code-a446c8ae813ae5e1c33d377dabd85d3d362b1878.zip
Removed some more duplicate code.
Diffstat (limited to 'fourier.cpp')
-rw-r--r--fourier.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/fourier.cpp b/fourier.cpp
index 7808989..8943521 100644
--- a/fourier.cpp
+++ b/fourier.cpp
@@ -71,7 +71,7 @@ Real energy(const std::vector<Real>& C, const std::vector<Real>& R, unsigned p,
std::tuple<std::vector<Complex>, std::vector<Complex>> RddfCtdfCt(FourierTransform& fft, const std::vector<Real>& C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ) {
std::vector<Real> RddfC(C.size());
- for (unsigned i = 0; i < C.size(); i++) {
+ for (unsigned i = 0; i < C.size() / 2; i++) {
RddfC[i] = R[i] * ddf(λ, p, s, C[i]);
}
std::vector<Complex> RddfCt = fft.fourier(RddfC);
@@ -84,3 +84,9 @@ std::tuple<std::vector<Complex>, std::vector<Complex>> RddfCtdfCt(FourierTransfo
return {RddfCt, dfCt};
}
+
+Real estimateZ(FourierTransform& fft, const std::vector<Real>& C, const std::vector<Complex>& Ct, const std::vector<Real>& R, const std::vector<Complex>& Rt, unsigned p, unsigned s, Real λ, Real y) {
+ auto [RddfCt, dfCt] = RddfCtdfCt(fft, C, R, p, s, λ);
+
+ return ((std::conj(Rt[0]) + pow(y, 2) * (RddfCt[0] * Ct[0] + dfCt[0] * std::conj(Rt[0]))) / Ct[0]).real();
+}