mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-24 13:38:05 +00:00
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:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user