/// <summary>A Vector extension method that correlations.</summary> /// <param name="x">The x to act on.</param> /// <param name="y">The Vector to process.</param> /// <returns>A double.</returns> public static double Correlation(this Vector x, Vector y) { var s = x.StdDev() * y.StdDev(); if (s == 0) { return(double.NaN); } return(x.Covariance(y) / s); }