1
public static double PrazenWindowDensity(double [][] Xn, double x, double sigma2)
{
double gauss = 0;
foreach(double [] arr in Xn)
{
foreach (double item in arr)
{
double xx = GausianFunction(item, x, sigma2);
gauss += xx;
}
}
return gauss/Xn.Length; //this is surely incorrect. Isn't it?
}
我可以在這裏寫什麼?尋找2D鋸齒陣列中元素數量的標準方法是什麼?
return gauss/Xn.Length;
正如你已經在做一個循環,不知道LINQ是更快或只加內的foreach內'計數++'。 http://stackoverflow.com/questions/262934/is-it-costly-to-do-array-length-or-list-count-in-a-loop – Eric
@Eric,嗯......正確的你! – anonymous