using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Core; using HeuristicLab.Optimization; using HeuristicLab.Data; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Common; using HeuristicLab.Common.Resources; using HeuristicLab.Analysis.FitnessLandscape.DataTables; using System.Drawing; using HeuristicLab.Analysis.FitnessLandscape.Analysis; namespace HeuristicLab.Analysis.FitnessLandscape { public class DistributionAnalyzer { private double[] values; public DistributionAnalyzer(IEnumerable values) { this.values = values.ToArray(); } public double Mean { get { try { double mean = 0; double variance = 0; double skewness = 0; double kurtosis = 0; alglib.basestat.samplemoments(values, values.Length, ref mean, ref variance, ref skewness, ref kurtosis); return mean; } catch (Exception) { return 0; } } } public double this[double quantile] { get { try { double v = 0; alglib.basestat.samplepercentile(values, values.Length, quantile, ref v); return v; } catch (Exception) { return 0; } } } } }