style patterns

This commit is contained in:
Miha Kralj
2026-01-25 16:01:45 -08:00
parent 2836f253c4
commit e59665c8f0
399 changed files with 6892 additions and 1323 deletions
+7 -1
View File
@@ -29,7 +29,9 @@ public sealed class Rma : AbstractBase
public Rma(int period)
{
if (period <= 0)
{
throw new ArgumentException("Period must be greater than 0", nameof(period));
}
_ema = new Ema(1.0 / period);
Name = $"Rma({period})";
@@ -118,10 +120,14 @@ public sealed class Rma : AbstractBase
public static void Batch(ReadOnlySpan<double> source, Span<double> output, int period)
{
if (period <= 0)
{
throw new ArgumentException("Period must be greater than 0", nameof(period));
}
if (output.Length < source.Length)
{
throw new ArgumentException("Output span must be at least as long as source span", nameof(output));
}
double alpha = 1.0 / period;
Ema.Batch(source, output, alpha);
@@ -150,4 +156,4 @@ public sealed class Rma : AbstractBase
_ema.Reset();
Last = default;
}
}
}