mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 18:18:04 +00:00
[CodeFactor] Apply fixes to commit 4a01f03
This commit is contained in:
@@ -53,7 +53,7 @@ public class FftValidationTests
|
||||
|
||||
for (int i = 0; i < windowSize * 3; i++)
|
||||
{
|
||||
double signal = 50.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod);
|
||||
double signal = 50.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod));
|
||||
indicator.Update(new TValue(time.AddMinutes(i), signal), true);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class FftValidationTests
|
||||
|
||||
for (int i = 0; i < windowSize * 4; i++)
|
||||
{
|
||||
double signal = 50.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod);
|
||||
double signal = 50.0 + (10.0 * Math.Sin(2.0 * Math.PI * i / targetPeriod));
|
||||
indicator.Update(new TValue(time.AddMinutes(i), signal), true);
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ public class FftValidationTests
|
||||
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + 10.0 * Math.Sin(2 * Math.PI * i / 8.0)));
|
||||
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + (10.0 * Math.Sin(2 * Math.PI * i / 8.0))));
|
||||
}
|
||||
|
||||
var anchorTime = t0.AddSeconds(50);
|
||||
|
||||
@@ -84,7 +84,7 @@ public sealed class Fft : AbstractBase
|
||||
_hanning = new double[windowSize];
|
||||
for (int n = 0; n < windowSize; n++)
|
||||
{
|
||||
_hanning[n] = 0.5 - 0.5 * Math.Cos(twoPiOverN * n);
|
||||
_hanning[n] = 0.5 - (0.5 * Math.Cos(twoPiOverN * n));
|
||||
}
|
||||
|
||||
// Precompute bit-reversal permutation table
|
||||
@@ -262,7 +262,7 @@ public sealed class Fft : AbstractBase
|
||||
}
|
||||
|
||||
// Parabolic interpolation: shift = 0.5*(a-c)/(a - 2b + c)
|
||||
double denom = a - 2.0 * b + c;
|
||||
double denom = a - (2.0 * b) + c;
|
||||
double shift = Math.Abs(denom) > 0.0 ? 0.5 * (a - c) / denom : 0.0;
|
||||
double dominantPeriod = (double)_windowSize / (bestK + shift);
|
||||
|
||||
@@ -417,7 +417,7 @@ public sealed class Fft : AbstractBase
|
||||
{
|
||||
for (int n = 0; n < windowSize; n++)
|
||||
{
|
||||
hanning[n] = 0.5 - 0.5 * Math.Cos(twoPiOverN * n);
|
||||
hanning[n] = 0.5 - (0.5 * Math.Cos(twoPiOverN * n));
|
||||
bitRev[n] = BitReverse(n, log2N);
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ public sealed class Fft : AbstractBase
|
||||
workIm[bestK + 1] * workIm[bestK + 1])
|
||||
: bestMag;
|
||||
|
||||
double denom = a - 2.0 * bestMag + c;
|
||||
double denom = a - (2.0 * bestMag) + c;
|
||||
double shift = Math.Abs(denom) > 0.0 ? 0.5 * (a - c) / denom : 0.0;
|
||||
double dominant = (double)windowSize / (bestK + shift);
|
||||
double clamped = Math.Clamp(dominant, minPeriod, maxPeriod);
|
||||
|
||||
Reference in New Issue
Block a user