normalization of methods

This commit is contained in:
Miha Kralj
2026-02-10 21:33:16 -08:00
parent 915d7a007b
commit 6d6259a47d
527 changed files with 10525 additions and 2123 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ public class BlmaTests
var tValues = series.Values.ToArray();
var spanInput = new ReadOnlySpan<double>(tValues);
var spanOutput = new double[tValues.Length];
Blma.Calculate(spanInput, spanOutput, period);
Blma.Batch(spanInput, spanOutput, period);
double spanResult = spanOutput[^1];
// 3. Streaming Mode
+11 -11
View File
@@ -151,7 +151,7 @@ public sealed class Blma : AbstractBase
try
{
Calculate(source.Values, output, _period);
BatchCore(source.Values, output, _period);
for (int i = 0; i < len; i++)
{
@@ -243,17 +243,11 @@ public sealed class Blma : AbstractBase
/// <summary>
/// Calculates BLMA values for a TSeries and returns both results and a primed indicator.
/// </summary>
public static (TSeries Results, Blma Indicator) Calculate(TSeries source, int period)
{
var indicator = new Blma(period);
var results = indicator.Update(source);
return (results, indicator);
}
/// <summary>
/// Calculates BLMA values using spans (high-performance batch API).
/// Core batch calculation of BLMA values using spans (high-performance batch API).
/// </summary>
public static void Calculate(ReadOnlySpan<double> source, Span<double> destination, int period)
private static void BatchCore(ReadOnlySpan<double> source, Span<double> destination, int period)
{
if (period < 1)
{
@@ -377,6 +371,12 @@ public sealed class Blma : AbstractBase
/// </summary>
public static void Batch(ReadOnlySpan<double> source, Span<double> destination, int period)
{
Calculate(source, destination, period);
BatchCore(source, destination, period);
}
}
public static (TSeries Results, Blma Indicator) Calculate(TSeries source, int period)
{
var indicator = new Blma(period);
var results = indicator.Update(source);
return (results, indicator);
}
}