本文整理汇总了C#中SortedDictionary.Max方法的典型用法代码示例。如果您正苦于以下问题:C# SortedDictionary.Max方法的具体用法?C# SortedDictionary.Max怎么用?C# SortedDictionary.Max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedDictionary
的用法示例。
在下文中一共展示了SortedDictionary.Max方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateAggregate
private List<SortedDictionary<double, double>> CalculateAggregate(SortedDictionary<double, double> input)
{
var ypercentage = 0.0;
var xpoints = input.Count;
var minlist = new SortedDictionary<double, double>();
var avglist = new SortedDictionary<double, double>();
var maxlist = new SortedDictionary<double, double>();
while (ypercentage < 0.95)
{
minlist.Clear();
maxlist.Clear();
avglist.Clear();
var hist = new SortedDictionary<int, List<double>>();
var min = input.Min(k => k.Key);
var max = input.Max(k => k.Key);
xpoints = xpoints/2;
var buckets = ((max - min)/(xpoints));
foreach (var va in input)
{
var bucket = 0;
if (buckets > 0)
{
bucket = (int) ((va.Key - min)/buckets);
if (bucket == xpoints)
bucket--;
}
if (!hist.ContainsKey(bucket))
{
hist[bucket] = new List<double>();
}
hist[bucket].Add(va.Value);
}
var totaldiff = input.Max(k => k.Value) - input.Min(k => k.Value);
var diff = 0.0;
foreach (var val in hist)
{
minlist[min + (val.Key*buckets)] = val.Value.Min();
avglist[min + (val.Key*buckets)] = val.Value.Average();
maxlist[min + (val.Key*buckets)] = val.Value.Max();
diff += (val.Value.Max() - val.Value.Min())/hist.Count;
}
ypercentage = diff/totaldiff;
}
return new List<SortedDictionary<double, double>>() { minlist, avglist, maxlist }; ;
}