mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 03:28:05 +00:00
style patterns
This commit is contained in:
@@ -321,8 +321,15 @@ public class MaeTests
|
||||
var actual = new TSeries();
|
||||
var predicted = new TSeries();
|
||||
|
||||
for (int i = 0; i < 10; i++) actual.Add(DateTime.UtcNow, i);
|
||||
for (int i = 0; i < 5; i++) predicted.Add(DateTime.UtcNow, i);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
actual.Add(DateTime.UtcNow, i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
predicted.Add(DateTime.UtcNow, i);
|
||||
}
|
||||
|
||||
Assert.Throws<ArgumentException>(() => Mae.Calculate(actual, predicted, 3));
|
||||
}
|
||||
@@ -356,4 +363,4 @@ public class MaeTests
|
||||
// After resync, result should still be correct
|
||||
Assert.Equal(10.0, mae.Last.Value, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,10 @@ public sealed class Mae : BiInputIndicatorBase
|
||||
public static void Batch(ReadOnlySpan<double> actual, ReadOnlySpan<double> predicted, Span<double> output, int period)
|
||||
{
|
||||
ValidateBatchInputs(actual, predicted, output, period);
|
||||
if (actual.Length == 0) return;
|
||||
if (actual.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Allocate temporary buffer for absolute errors
|
||||
const int StackAllocThreshold = 256;
|
||||
@@ -86,4 +89,4 @@ public sealed class Mae : BiInputIndicatorBase
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user