【发布时间】:2016-11-04 01:19:56
【问题描述】:
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?
}
我可以在这里写什么?
return gauss / Xn.Length;
【问题讨论】:
-
因为你已经在做一个循环,所以不知道 linq 是否更快或者只是在内部 foreach 中添加
count++。 stackoverflow.com/questions/262934/… -
@Eric,嗯……没错!
标签: c# arrays multidimensional-array jagged-arrays