/// <summary> /// Initializes a new instance of the <see cref="RunningStats{TTKernel}"/> class. /// </summary> public RunningStats() { if (!SupportTypes.TryGetValue(typeof(TKernel), out var type)) { throw new NotSupportedException($"{typeof(TKernel).Name} does not support"); } this._RunningStatsType = type.ToRunningStatsType(); this.NativePtr = NativeMethods.running_stats_new(this._RunningStatsType); if (this.NativePtr == IntPtr.Zero) { throw new ArgumentException($"{type} is not supported."); } this._Type = type; switch (this._Type) { case RunningStatsType.Float: this._Imp = new RunningStatsFloatImp(this, this._RunningStatsType) as RunningStatsImp <TKernel>; break; case RunningStatsType.Double: this._Imp = new RunningStatsDoubleImp(this, this._RunningStatsType) as RunningStatsImp <TKernel>; break; } }
internal static NativeMethods.RunningStatsType ToRunningStatsType(this RunningStatsType type) { switch (type) { case RunningStatsType.Float: return(NativeMethods.RunningStatsType.Float); case RunningStatsType.Double: return(NativeMethods.RunningStatsType.Double); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public static extern IntPtr running_stats_operator_add(RunningStatsType type, IntPtr left, IntPtr right);
public static extern void running_stats_delete(RunningStatsType type, IntPtr stats);
public static extern ErrorType running_stats_variance(RunningStatsType type, IntPtr stats, out double variance);
public static extern ErrorType running_stats_stddev(RunningStatsType type, IntPtr stats, out double stddev);
public static extern ErrorType running_stats_skewness(RunningStatsType type, IntPtr stats, out double skewness);
public static extern ErrorType running_stats_scale(RunningStatsType type, IntPtr stats, ref double scale, out double ret);
public static extern ErrorType running_stats_scale(RunningStatsType type, IntPtr stats, ref float scale, out float ret);
public static extern ErrorType running_stats_min(RunningStatsType type, IntPtr stats, out double min);
public static extern ErrorType running_stats_mean(RunningStatsType type, IntPtr stats, out float mean);
public static extern ErrorType running_stats_ex_kurtosis(RunningStatsType type, IntPtr stats, out double ex_kurtosis);
public static extern ErrorType running_stats_current_n(RunningStatsType type, IntPtr stats, out double n);
public static extern ErrorType running_stats_clear(RunningStatsType type, IntPtr stats);
public static extern ErrorType running_stats_add(RunningStatsType type, IntPtr stats, ref double val);
public static extern IntPtr running_stats_new(RunningStatsType type);