summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-10 16:15:50 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-10 16:15:50 -0300
commit43accad78a7512fcb6cac0516362e3753c119249 (patch)
tree7728ed49cb817788d5f701bd68a1710258914e0a
parente9f047834b2433fed2ff9aa486d0b430b82d039c (diff)
downloadcode-43accad78a7512fcb6cac0516362e3753c119249.tar.gz
code-43accad78a7512fcb6cac0516362e3753c119249.tar.bz2
code-43accad78a7512fcb6cac0516362e3753c119249.zip
Tweaks
-rw-r--r--log-fourier_integrator.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/log-fourier_integrator.cpp b/log-fourier_integrator.cpp
index 22f63e6..cfac29f 100644
--- a/log-fourier_integrator.cpp
+++ b/log-fourier_integrator.cpp
@@ -147,22 +147,28 @@ int main(int argc, char* argv[]) {
Real C₀ = Cₜ₊₁[0];
- bool trigger = false;
+ bool trigger0 = false;
+ bool trigger1 = false;
for (unsigned i = 0; i < N; i++) {
- if (Cₜ₊₁[i] < 0 || trigger) {
+ if (Cₜ₊₁[i] < 0 || trigger0) {
Cₜ₊₁[i] = 0;
- trigger = true;
+ trigger0 = true;
}
- if (Cₜ₊₁[i] > 1) {
+ if (Cₜ₊₁[i] > 1 || trigger1) {
Cₜ₊₁[i] = 1;
+ trigger1 = true;
}
}
+ trigger0 = false;
+ trigger1 = false;
for (unsigned i = 0; i < N; i++) {
- if (Rₜ₊₁[i] < 0) {
+ if (Rₜ₊₁[i] < 0 || trigger0) {
Rₜ₊₁[i] = 0;
+ trigger0 = true;
}
- if (Rₜ₊₁[i] > 1) {
+ if (Rₜ₊₁[i] > 1 || trigger1) {
Rₜ₊₁[i] = 1;
+ trigger1 = true;
}
}