mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
normalization of methods
This commit is contained in:
@@ -231,7 +231,7 @@ public class SsfTests
|
||||
var tseriesResult = Ssf.Calculate(series, 10).Results;
|
||||
|
||||
// Calculate with Span API
|
||||
Ssf.Calculate(source.AsSpan(), output.AsSpan(), 10);
|
||||
Ssf.Batch(source.AsSpan(), output.AsSpan(), 10);
|
||||
|
||||
// Compare results
|
||||
for (int i = 0; i < 100; i++)
|
||||
@@ -257,7 +257,7 @@ public class SsfTests
|
||||
var tValues = series.Values.ToArray();
|
||||
var spanInput = new ReadOnlySpan<double>(tValues);
|
||||
var spanOutput = new double[tValues.Length];
|
||||
Ssf.Calculate(spanInput, spanOutput, period);
|
||||
Ssf.Batch(spanInput, spanOutput, period);
|
||||
double spanResult = spanOutput[^1];
|
||||
|
||||
// 3. Streaming Mode
|
||||
|
||||
@@ -315,15 +315,8 @@ public sealed class Ssf : AbstractBase
|
||||
}
|
||||
}
|
||||
|
||||
public static (TSeries Results, Ssf Indicator) Calculate(TSeries source, int period)
|
||||
{
|
||||
var ssf = new Ssf(period);
|
||||
TSeries results = ssf.Update(source);
|
||||
return (results, ssf);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Calculate(ReadOnlySpan<double> source, Span<double> output, int period)
|
||||
public static void Batch(ReadOnlySpan<double> source, Span<double> output, int period)
|
||||
{
|
||||
if (period <= 0)
|
||||
{
|
||||
@@ -353,6 +346,13 @@ public sealed class Ssf : AbstractBase
|
||||
CalculateCore(source, output, c1, c2, c3, period, ref state);
|
||||
}
|
||||
|
||||
public static (TSeries Results, Ssf Indicator) Calculate(TSeries source, int period)
|
||||
{
|
||||
var ssf = new Ssf(period);
|
||||
TSeries results = ssf.Update(source);
|
||||
return (results, ssf);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
_state = State.New();
|
||||
@@ -371,4 +371,4 @@ public sealed class Ssf : AbstractBase
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user