mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-22 12:38:06 +00:00
[CodeFactor] Apply fixes to commit 0606491
This commit is contained in:
@@ -516,8 +516,8 @@ public class WaveletTests
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
double signal = 100 + 10 * Math.Sin(2 * Math.PI * i / 40.0);
|
||||
double noise = 2.0 * Math.Sin(17.3 * i) + 1.5 * Math.Cos(31.7 * i);
|
||||
double signal = 100 + (10 * Math.Sin(2 * Math.PI * i / 40.0));
|
||||
double noise = (2.0 * Math.Sin(17.3 * i)) + (1.5 * Math.Cos(31.7 * i));
|
||||
input[i] = signal + noise;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ public class WaveletTests
|
||||
double[] input = new double[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
input[i] = 100 + 10 * Math.Sin(2 * Math.PI * i / 40.0) + 5 * Math.Sin(73.1 * i);
|
||||
input[i] = 100 + (10 * Math.Sin(2 * Math.PI * i / 40.0)) + (5 * Math.Sin(73.1 * i));
|
||||
}
|
||||
|
||||
double[] lowThresh = new double[len];
|
||||
@@ -596,6 +596,6 @@ public class WaveletTests
|
||||
sum2 += data[i] * data[i];
|
||||
}
|
||||
double mean = sum / data.Length;
|
||||
return sum2 / data.Length - mean * mean;
|
||||
return (sum2 / data.Length) - (mean * mean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ public class WaveletValidationTests
|
||||
double[] noisy = new double[T];
|
||||
for (int i = 0; i < T; i++)
|
||||
{
|
||||
clean[i] = 100.0 + 10.0 * Math.Sin(2 * Math.PI * i / 80.0);
|
||||
clean[i] = 100.0 + (10.0 * Math.Sin(2 * Math.PI * i / 80.0));
|
||||
// Alternating noise with amplitude 25 — much larger than signal variation
|
||||
noisy[i] = clean[i] + 25.0 * ((i % 2 == 0) ? 1.0 : -1.0);
|
||||
noisy[i] = clean[i] + (25.0 * ((i % 2 == 0) ? 1.0 : -1.0));
|
||||
}
|
||||
|
||||
double[] denoised = new double[T];
|
||||
@@ -132,7 +132,7 @@ public class WaveletValidationTests
|
||||
double[] output = new double[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
input[i] = 100.0 + 0.5 * i;
|
||||
input[i] = 100.0 + (0.5 * i);
|
||||
}
|
||||
|
||||
Wavelet.Batch(input, output, 3, 1.0);
|
||||
@@ -156,7 +156,7 @@ public class WaveletValidationTests
|
||||
double[] output = new double[len];
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
input[i] = 100 + 10 * Math.Sin(2 * Math.PI * i / 50.0) + 0.5 * Math.Sin(101.1 * i);
|
||||
input[i] = 100 + (10 * Math.Sin(2 * Math.PI * i / 50.0)) + (0.5 * Math.Sin(101.1 * i));
|
||||
}
|
||||
|
||||
Wavelet.Batch(input, output, 4, 1.0);
|
||||
@@ -216,6 +216,6 @@ public class WaveletValidationTests
|
||||
}
|
||||
int n = data.Length - 1;
|
||||
double mean = sum / n;
|
||||
return sum2 / n - mean * mean;
|
||||
return (sum2 / n) - (mean * mean);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user