feat: Refactor TBar and TValue to record structs; improve readability and performance

fix: Update condition checks in Htit and Mgdi for better numerical stability
refactor: Simplify parameter struct in T3 and enhance Vidya state management
This commit is contained in:
Miha Kralj
2025-12-17 07:27:45 -08:00
parent d277e08056
commit 8cec2fec8d
6 changed files with 20 additions and 100 deletions
+2 -2
View File
@@ -220,7 +220,7 @@ public sealed class Htit : AbstractBase
private double CalculatePeriod(double prevPeriod)
{
double period = 0;
if (_state.Im != 0 && _state.Re != 0)
if (Math.Abs(_state.Im) > 1e-9 && Math.Abs(_state.Re) > 1e-9)
{
period = 2 * Math.PI / Math.Atan(_state.Im / _state.Re);
}
@@ -372,7 +372,7 @@ public sealed class Htit : AbstractBase
// 7. Calculate Period
double period = 0;
if (im != 0 && re != 0)
if (Math.Abs(im) > 1e-9 && Math.Abs(re) > 1e-9)
{
period = 2 * Math.PI / Math.Atan(im / re);
}