feat(rsi, alma, bilateral, blma, butter, ema, htit, kama, lsma, pwma, rma, trima, vidya, wma): enhance calculations with NaN handling and edge case management; improve performance and stability across multiple classes

This commit is contained in:
Miha Kralj
2025-12-25 22:16:07 -08:00
parent 0d077c24d8
commit 86e2934f1b
17 changed files with 203 additions and 71 deletions
@@ -170,7 +170,7 @@ public class BilateralValidationTests : IDisposable
sumWeightedSrc += weight * valI;
}
return sumWeights == 0.0 ? centerVal : sumWeightedSrc / sumWeights;
return sumWeights < 1e-10 ? centerVal : sumWeightedSrc / sumWeights;
}
private static double CalculateStDev(List<double> values)
+2 -2
View File
@@ -239,7 +239,7 @@ public sealed class Bilateral : AbstractBase
sumWeightedSrc += weight * val;
}
return sumWeights == 0.0 ? centerVal : sumWeightedSrc / sumWeights;
return sumWeights < 1e-10 ? centerVal : sumWeightedSrc / sumWeights;
}
private void PrecalculateSpatialWeights()
@@ -362,7 +362,7 @@ public sealed class Bilateral : AbstractBase
sumWeightedSrc += weight * wVal;
}
destination[i] = sumWeights == 0.0 ? centerVal : sumWeightedSrc / sumWeights;
destination[i] = sumWeights < 1e-10 ? centerVal : sumWeightedSrc / sumWeights;
}
}
}