From 4f3a9a4f6dcc6ffff9c821181fa9ab670c5ecc36 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sat, 16 Nov 2013 17:45:39 +0100 Subject: [PATCH] Statistics: comment in Correlation.Person on robustness --- src/Numerics/Statistics/Correlation.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Numerics/Statistics/Correlation.cs b/src/Numerics/Statistics/Correlation.cs index 1faf845f..397dd24d 100644 --- a/src/Numerics/Statistics/Correlation.cs +++ b/src/Numerics/Statistics/Correlation.cs @@ -57,6 +57,9 @@ namespace MathNet.Numerics.Statistics double varA = 0; double varB = 0; + // WARNING: do not try to "optimize" by summing up products instead of using differences. + // It would indeed be faster, but numerically much less robust if large mean + low variance. + using (IEnumerator ieA = dataA.GetEnumerator()) using (IEnumerator ieB = dataB.GetEnumerator()) {