Rev | Line | |
---|
[7315] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 |
|
---|
| 6 | namespace VRPProblemAnalyzer {
|
---|
| 7 | public static class EnumerableExtensions {
|
---|
| 8 | public static double StandardDeviation(this IEnumerable<double> data) {
|
---|
| 9 | var dataList = data.ToList();
|
---|
| 10 | double average = dataList.Average();
|
---|
| 11 | var individualDeviations = dataList.Select(num => Math.Pow(num - average, 2.0));
|
---|
| 12 | return Math.Sqrt(individualDeviations.Average());
|
---|
| 13 | }
|
---|
| 14 | }
|
---|
| 15 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.