CanvasCommon.DensityClusteringModel.GaussianLocalDensity C# (CSharp) Метод

GaussianLocalDensity() публичный Метод

public GaussianLocalDensity ( double distanceThreshold ) : void
distanceThreshold double
Результат void
        public void GaussianLocalDensity(double distanceThreshold)
        {
            int distanceLength = this.Distance.Count;
            List<double> half = new List<double>(distanceLength);
            for (int index = 0; index < distanceLength; index++)
                half.Add(0);
            for (int index = 0; index < distanceLength; index++)
            {
                if (this.Distance[index].HasValue)
                {
                    double combOver = (double)this.Distance[index] / distanceThreshold;
                    double negSq = Math.Pow(combOver, 2) * -1;
                    half[index] = Math.Exp(negSq);
                }
            }

            int ncol = this.Segments.Count;
            int nrow = this.Segments.Count;
            this.Rho = new List<double>(nrow);
            for (int iRho = 0; iRho < nrow; iRho++)
                this.Rho.Add(0);
            int i = 0;
            for (int col = 0; col < ncol; col++)
            {
                for (int row = col + 1; row < nrow; row++)
                {
                    double temp = half[i];
                    this.Rho[row] += temp;
                    this.Rho[col] += temp;
                    i++;
                }
            }
        }