BotSharp/BotSharp.Algorithm/HiddenMarkovModel/MathUtils/Statistics/CollectionExtensionMethods.cs
2018-09-17 07:31:54 -05:00

19 lines
492 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BotSharp.Algorithm.HiddenMarkovModel.MathUtils.Statistics
{
public static class CollectionExtensionMethods
{
public static double? Average(this IEnumerable<double> values, int precision_point)
{
int count = values.Count();
if (count == 0) return null;
return System.Math.Round(values.Average(), precision_point);
}
}
}