mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-26 06:18:05 +00:00
normalization of methods
This commit is contained in:
@@ -101,7 +101,7 @@ public class Cheby2Tests
|
||||
|
||||
// Span
|
||||
var spanResults = new double[count];
|
||||
Cheby2.Calculate(values, spanResults, period, 5.0);
|
||||
Cheby2.Batch(values, spanResults, period, 5.0);
|
||||
|
||||
// Compare
|
||||
for (int i = 0; i < count; i++)
|
||||
|
||||
@@ -136,7 +136,7 @@ public sealed class Cheby2 : AbstractBase
|
||||
double[] values = source.Values.ToArray();
|
||||
double[] results = new double[values.Length];
|
||||
|
||||
Calculate(values, results, Period, Attenuation);
|
||||
Batch(values, results, Period, Attenuation);
|
||||
|
||||
TSeries output = [];
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
@@ -217,8 +217,14 @@ public sealed class Cheby2 : AbstractBase
|
||||
Last = default;
|
||||
}
|
||||
|
||||
public static TSeries Batch(TSeries source, int period, double attenuation = 5.0)
|
||||
{
|
||||
var indicator = new Cheby2(period, attenuation);
|
||||
return indicator.Update(source);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Calculate(ReadOnlySpan<double> source, Span<double> output, int period, double attenuation = 5.0)
|
||||
public static void Batch(ReadOnlySpan<double> source, Span<double> output, int period, double attenuation = 5.0)
|
||||
{
|
||||
if (source.Length != output.Length)
|
||||
{
|
||||
@@ -322,6 +328,12 @@ public sealed class Cheby2 : AbstractBase
|
||||
filt1 = filt;
|
||||
}
|
||||
}
|
||||
public static (TSeries Results, Cheby2 Indicator) Calculate(TSeries source, int period, double attenuation = 5.0)
|
||||
{
|
||||
var indicator = new Cheby2(period, attenuation);
|
||||
TSeries results = indicator.Update(source);
|
||||
return (results, indicator);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscribes from the source publisher if one was provided during construction.
|
||||
@@ -334,4 +346,4 @@ public sealed class Cheby2 : AbstractBase
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user