xml doc rewrite

This commit is contained in:
Miha
2024-10-27 09:38:53 -07:00
parent c21b96152c
commit b2fcdda785
71 changed files with 2607 additions and 1102 deletions
+36 -1
View File
@@ -1,9 +1,37 @@
using System;
namespace QuanTAlib;
/// <summary>
/// SINEMA: Sine-weighted Exponential Moving Average
/// A moving average that uses sine function-based weights to create a natural
/// distribution of importance across the period. The weights follow a sine curve,
/// providing smooth transitions and natural emphasis on different parts of the data.
/// </summary>
/// <remarks>
/// The SINEMA calculation process:
/// 1. Generates weights using sine function over the period
/// 2. Normalizes weights to sum to 1
/// 3. Applies weights through convolution
/// 4. Produces smooth output with natural weight distribution
///
/// Key characteristics:
/// - Sine-based weight distribution
/// - Natural smoothing through trigonometric weights
/// - No sharp transitions in weight values
/// - Balanced emphasis across the period
/// - Implemented using efficient convolution operations
///
/// Implementation:
/// Based on sine function principles for weight generation
/// Uses convolution for efficient calculation
/// </remarks>
public class Sinema : AbstractBase
{
private readonly Convolution _convolution;
/// <param name="period">The number of data points used in the SINEMA calculation.</param>
/// <exception cref="ArgumentException">Thrown when period is less than 1.</exception>
public Sinema(int period)
{
if (period < 1)
@@ -16,6 +44,8 @@ public class Sinema : AbstractBase
Init();
}
/// <param name="source">The data source object that publishes updates.</param>
/// <param name="period">The number of data points used in the SINEMA calculation.</param>
public Sinema(object source, int period) : this(period)
{
var pubEvent = source.GetType().GetEvent("Pub");
@@ -50,6 +80,11 @@ public class Sinema : AbstractBase
return result;
}
/// <summary>
/// Generates the sine-based convolution kernel for the SINEMA calculation.
/// </summary>
/// <param name="period">The period for which to generate the kernel.</param>
/// <returns>An array of normalized sine-based weights for the convolution operation.</returns>
public static double[] GenerateKernel(int period)
{
double[] kernel = new double[period];
@@ -70,4 +105,4 @@ public class Sinema : AbstractBase
return kernel;
}
}
}