private Objects.ExcelGroup[][] BuildGroups(double Enclosing) { Objects.ExcelGroup[][] excelGroupsArray = new Objects.ExcelGroup[inputHumen[0].NormalizedRanges.Length][]; for (int column = 0; column < inputHumen[0].NormalizedRanges.Length; column++) { Objects.ExcelGroup[] excelGroups = new Objects.ExcelGroup[analizedTuplesArray[column].analizedGroups.Length]; for (int group = 0; group < analizedTuplesArray[column].analizedGroups.Length; group++) { Objects.AnalizedGroup currentAnalizedGroup = analizedTuplesArray[column].analizedGroups[group]; excelGroups[group] = new Objects.ExcelGroup(currentAnalizedGroup.percent, currentAnalizedGroup.mediana, group); double[] Squares = new double[currentAnalizedGroup.participatns.Length]; double[] Qubes = new double[currentAnalizedGroup.participatns.Length]; for (int part = 0; part < currentAnalizedGroup.participatns.Length; part++) { Squares[part] = Math.Pow(currentAnalizedGroup.participatns[part] - currentAnalizedGroup.mediana, 2); Qubes[part] = Math.Pow(currentAnalizedGroup.participatns[part] - currentAnalizedGroup.mediana, 3); } excelGroups[group].standartDerivation = Math.Sqrt(Squares.Sum() / (Squares.Length - 1)); excelGroups[group].min = currentAnalizedGroup.min; excelGroups[group].max = currentAnalizedGroup.max; excelGroups[group].count = currentAnalizedGroup.count; excelGroups[group].assymetry = Qubes.Sum() / (Squares.Length * Math.Pow(currentAnalizedGroup.dispersia, 3)); excelGroups[group].vars = currentAnalizedGroup.participatns; if (group < analizedTuplesArray[column].analizedGroups.Length - 1) { Objects.AnalizedGroup nextAnalizedGroup = analizedTuplesArray[column].analizedGroups[group + 1]; double Mean1 = currentAnalizedGroup.participatns.Average(); double Mean2 = nextAnalizedGroup.participatns.Average(); double Mediana1 = currentAnalizedGroup.mediana; double Mediana2 = nextAnalizedGroup.mediana; double NormAll = analizedTuplesArray[column].max - analizedTuplesArray[column].min; double Min1 = currentAnalizedGroup.min; double Max1 = currentAnalizedGroup.max; double Min2 = nextAnalizedGroup.min; double Max2 = nextAnalizedGroup.max; excelGroups[group].closingTo = CoeffCounter(Mean1, Mean2, Mediana1, Mediana2, NormAll, Min1, Max1, Min2, Max2); } } excelGroups = Encloser(excelGroups, Enclosing, column); excelGroupsArray[column] = excelGroups; } this.builded = excelGroupsArray; return(excelGroupsArray); }
public Objects.AnalizedTuple DAUResearcher(int column, double Entropy, Objects.AnalizedTuple analizedTuple) { DenseAbsorbsUndense denseAbsorbsUndense = new DenseAbsorbsUndense(); List <Objects.AnalizedGroup> analizedGroupsList = analizedTuple.analizedGroups.ToList(); for (int i = 0; i < analizedTuple.analizedGroups.Length; i++) { if (analizedTuple.analizedGroups[i].dispersia > minDispers) { Objects.AnalizedTuple analizedTupleNew = denseAbsorbsUndense.Worker(analizedTuple.analizedGroups[i].participatns, column, Entropy); analizedGroupsList.Remove(analizedTuple.analizedGroups[i]); analizedGroupsList.AddRange(analizedTupleNew.analizedGroups); } } Objects.AnalizedGroup[] analizedGroupsArray = new Objects.AnalizedGroup[analizedGroupsList.Count]; analizedGroupsArray = analizedGroupsList.OrderBy(x => x.mediana).ToArray(); analizedTuple.groupsCount = analizedGroupsArray.Length; analizedTuple.analizedGroups = analizedGroupsArray; return(analizedTuple); }
public Objects.AnalizedTuple Worker(double[] NonSortedArrayDouble, int col, double Entropy) { int lastrow = NonSortedArrayDouble.GetUpperBound(0) + 1; SortedArrayDouble = new double[lastrow]; var sorted = NonSortedArrayDouble.OrderByDescending(x => x); int i = lastrow - 1; foreach (var dbl in sorted) { SortedArrayDouble[i] = dbl; i--; } double min = SortedArrayDouble[0]; double max = SortedArrayDouble[lastrow - 1]; double meanDensity = 1.00 / SortedArrayDouble.Length; //(max - min) / SortedArrayDouble.Length; List <double> arrayListOfVars = new List <double>(); List <int> arrayListOfTimes = new List <int>(); for (int j = 0; j < SortedArrayDouble.Length; j++) { SortedArrayDouble[j] = (SortedArrayDouble[j] - min) / (max - min); if (j > 0 && SortedArrayDouble[j] == SortedArrayDouble[j - 1]) { arrayListOfTimes[arrayListOfTimes.Count - 1] = arrayListOfTimes[arrayListOfTimes.Count - 1] + 1; } else { arrayListOfVars.Add(SortedArrayDouble[j]); arrayListOfTimes.Add(1); } } SortedArrayDoubleBackup = SortedArrayDouble; SortedArrayDouble = arrayListOfVars.ToArray(); koefficients = arrayListOfTimes.ToArray(); DistributionNumbered = new double[3, SortedArrayDouble.Length]; //legacy method - 0 = Nothing; DistributionCharacteristics = new double[SortedArrayDouble.Length, 5]; // 0 = summOfBiDistances; 1 = Number; 2 = min; 3 = max; 4 = SummOfBistances ^ (-1); TypesOfFunction = new bool[SortedArrayDouble.Length, 4]; Array.Clear(TypesOfFunction, 0, TypesOfFunction.Length); Distances = new double[SortedArrayDouble.Length, 4]; Distances[0, 3] = SortedArrayDouble[1] - SortedArrayDouble[0]; Distances[0, 1] = 0; Distances[SortedArrayDouble.Length - 1, 2] = 0; int distributionNumber = 0; for (int point = 1; point < SortedArrayDouble.Length - 1; point++) { Distances[point, 3] = SortedArrayDouble[point + 1] - SortedArrayDouble[point]; Distances[point, 1] = Distances[point - 1, 3] / 2; Distances[point, 2] = Distances[point, 3] / 2; Distances[point, 0] = Distances[point, 1] + Distances[point, 2]; if (point == 1) { Distances[0, 2] = Distances[point, 1]; Distances[0, 0] = Distances[point, 1]; } else if (point == SortedArrayDouble.Length - 2) { Distances[point + 1, 1] = Distances[point, 2]; Distances[point + 1, 0] = Distances[point, 2]; } } double hyper = 0; for (int biDistance = 0; biDistance < SortedArrayDouble.Length; biDistance++) { if (Distances[biDistance, 0] > meanDensity * 1.5) { if (Distances[biDistance, 1] > Distances[biDistance, 2] * 1.5) { hyper = hyper + Distances[biDistance, 1] - Distances[biDistance, 2] * 1.5; } else if (Distances[biDistance, 2] > Distances[biDistance, 1] * 1.5) { hyper = hyper + Distances[biDistance, 2] - Distances[biDistance, 1] * 1.5; } } } meanDensity = (1 - hyper) / SortedArrayDoubleBackup.Length; for (int point = 1; point < SortedArrayDouble.Length - 1; point++) { if (Distances[point - 1, 0] > Distances[point, 0] && Distances[point, 0] > Distances[point + 1, 0]) { TypesOfFunction[point, 0] = true; } else if (Distances[point - 1, 0] < Distances[point, 0] && Distances[point, 0] < Distances[point + 1, 0]) { TypesOfFunction[point, 1] = true; } else if (Distances[point - 1, 0] >= Distances[point, 0] && Distances[point, 0] < Distances[point + 1, 0]) { TypesOfFunction[point, 2] = true; } else if (Distances[point - 1, 0] > Distances[point, 0] && Distances[point, 0] == Distances[point + 1, 0]) { TypesOfFunction[point, 2] = true; } else if (Distances[point - 1, 0] <= Distances[point, 0] && Distances[point, 0] > Distances[point + 1, 0]) { TypesOfFunction[point, 3] = true; } else if (Distances[point - 1, 0] < Distances[point, 0] && Distances[point, 0] == Distances[point + 1, 0]) { TypesOfFunction[point, 3] = true; } else if (Distances[point - 1, 0] == Distances[point, 0] && Distances[point, 0] == Distances[point + 1, 0]) { TypesOfFunction[point, 2] = true; } } for (int point = 0; point < SortedArrayDouble.Length; point++) { if (TypesOfFunction[point, 3]) { if (Distances[point, 2] > Distances[point, 1]) { DistributionNumbered[2, point] = distributionNumber; distributionNumber++; } else { distributionNumber = Convert.ToInt32(DistributionNumbered[2, point - 1]) + 1; DistributionNumbered[2, point] = distributionNumber; } } else { DistributionNumbered[2, point] = distributionNumber; } DistributionNumbered[1, point] = SortedArrayDouble[point]; } for (int currClass = 0; currClass < distributionNumber + 1; currClass++) { DistributionCharacteristics[currClass, 2] = 0; bool firstWas = false; for (int number = 0; number < SortedArrayDouble.Length; number++) { if (DistributionNumbered[2, number] == currClass) { if (!firstWas && number > 0 && currClass > 0) { DistributionCharacteristics[currClass - 1, 3] = GetRealIndex(number - 1, koefficients); DistributionCharacteristics[currClass, 2] = GetRealIndex(number - 1, koefficients) + 1; firstWas = true; } DistributionCharacteristics[currClass, 0] = DistributionCharacteristics[currClass, 0] + Distances[number, 0]; DistributionCharacteristics[currClass, 4] = DistributionCharacteristics[currClass, 4] + koefficients[number] / Distances[number, 0]; DistributionCharacteristics[currClass, 1] = DistributionCharacteristics[currClass, 1] + koefficients[number]; } if (number == SortedArrayDouble.Length - 2) { DistributionCharacteristics[currClass, 3] = GetRealIndex(number + 1, koefficients); } } } int previousNumberOfGroups = distributionNumber; int thisNumberOfGroups = distributionNumber; do { List <UnityDistribution> unityList = new List <UnityDistribution>(); List <NormalizedDistribution> normalizedList = new List <NormalizedDistribution>(); for (int distribution = 1; distribution < previousNumberOfGroups; distribution++) { double densityLeft = (DistributionCharacteristics[distribution - 1, 0] + DistributionCharacteristics[distribution, 0]) / (DistributionCharacteristics[distribution - 1, 1] + DistributionCharacteristics[distribution, 1]); double densityRight = (DistributionCharacteristics[distribution + 1, 1] + DistributionCharacteristics[distribution, 1]) / (DistributionCharacteristics[distribution + 1, 0] + DistributionCharacteristics[distribution, 0]); UnityDistribution unity = new UnityDistribution { Number = distribution, NumberOfPeople = Convert.ToInt32(DistributionCharacteristics[distribution, 1]) }; if (densityLeft <= densityRight) { if (densityLeft < meanDensity) { unity.LR = densityLeft; unity.Used = false; unity.Up = false; } else { unity.LR = -1000; unity.Used = false; unity.Up = false; } } else if (densityLeft > densityRight) { if (densityRight < meanDensity) { unity.LR = densityRight; unity.Used = false; unity.Up = true; } else { unity.LR = -1000; unity.Used = false; unity.Up = false; } } unity.Size = DistributionCharacteristics[distribution, 0]; unityList.Add(unity); } double densityRightF = (DistributionCharacteristics[1, 0] + DistributionCharacteristics[0, 0]) / (DistributionCharacteristics[1, 1] + DistributionCharacteristics[0, 1]); double densityLeftL = (DistributionCharacteristics[previousNumberOfGroups - 1, 0] + DistributionCharacteristics[previousNumberOfGroups, 0]) / (DistributionCharacteristics[previousNumberOfGroups - 1, 1] + DistributionCharacteristics[previousNumberOfGroups, 1]); densityRightF = densityRightF > meanDensity ? densityRightF : -1000; densityLeftL = densityLeftL > meanDensity ? densityLeftL : -1000; UnityDistribution unity0 = new UnityDistribution { LR = densityRightF, NumberOfPeople = Convert.ToInt32(DistributionCharacteristics[0, 1]), Size = DistributionCharacteristics[0, 0], Up = true, Used = false, Number = 0 }; UnityDistribution unity1 = new UnityDistribution { LR = densityLeftL, NumberOfPeople = Convert.ToInt32(DistributionCharacteristics[previousNumberOfGroups, 1]), Size = DistributionCharacteristics[previousNumberOfGroups, 0], Up = false, Used = false, Number = previousNumberOfGroups }; unityList.Add(unity0); unityList.Add(unity1); UnityDistribution[] unityDistributions = unityList.OrderBy(x => x.LR).ToArray(); for (int distribution = 0; distribution < unityDistributions.Length; distribution++) { NormalizedDistribution normalized = new NormalizedDistribution(); int firstIndex = unityDistributions[distribution].Number; if (!unityDistributions[distribution].Used) { if (unityDistributions[distribution].LR != -1000) { int koeff = unityDistributions[distribution].Up ? 1 : -1; int secondIndex = Array.FindIndex(unityDistributions, (x) => (x.Number == firstIndex + koeff)); if (!unityDistributions[secondIndex].Used) { if (!unityDistributions[distribution].Up) { normalized.SummOfBidistances = DistributionCharacteristics[firstIndex - 1, 0] + DistributionCharacteristics[firstIndex, 0]; normalized.NumberOfPeople = Convert.ToInt32(DistributionCharacteristics[firstIndex - 1, 1] + DistributionCharacteristics[firstIndex, 1]); normalized.Minimum = DistributionCharacteristics[firstIndex - 1, 2]; normalized.Maximum = DistributionCharacteristics[firstIndex, 3]; normalized.AntisummBidistanses = DistributionCharacteristics[firstIndex - 1, 4] + DistributionCharacteristics[firstIndex, 4]; } else { normalized.SummOfBidistances = DistributionCharacteristics[firstIndex + 1, 0] + DistributionCharacteristics[firstIndex, 0]; normalized.NumberOfPeople = Convert.ToInt32(DistributionCharacteristics[firstIndex + 1, 1] + DistributionCharacteristics[firstIndex, 1]); normalized.Minimum = DistributionCharacteristics[firstIndex, 2]; normalized.Maximum = DistributionCharacteristics[firstIndex + 1, 3]; normalized.AntisummBidistanses = DistributionCharacteristics[firstIndex + 1, 4] + DistributionCharacteristics[firstIndex, 4]; } unityDistributions[secondIndex].Used = true; unityDistributions[distribution].Used = true; unityDistributions[secondIndex].WasSeen = false; normalizedList.Add(normalized); } else { unityDistributions[distribution].WasSeen = true; } } else { normalized.SummOfBidistances = DistributionCharacteristics[firstIndex, 0]; normalized.NumberOfPeople = Convert.ToInt32(DistributionCharacteristics[firstIndex, 1]); normalized.Minimum = DistributionCharacteristics[firstIndex, 2]; normalized.Maximum = DistributionCharacteristics[firstIndex, 3]; normalized.AntisummBidistanses = DistributionCharacteristics[firstIndex, 4]; unityDistributions[distribution].Used = true; if (normalized.SummOfBidistances != 0) { normalizedList.Add(normalized); } } } } for (int distribution = 0; distribution < unityDistributions.Length; distribution++) { NormalizedDistribution normalized = new NormalizedDistribution(); int firstIndex = unityDistributions[distribution].Number; if (!unityDistributions[distribution].Used && unityDistributions[distribution].WasSeen) { normalized.SummOfBidistances = DistributionCharacteristics[firstIndex, 0]; normalized.NumberOfPeople = Convert.ToInt32(DistributionCharacteristics[firstIndex, 1]); normalized.Minimum = DistributionCharacteristics[firstIndex, 2]; normalized.Maximum = DistributionCharacteristics[firstIndex, 3]; normalized.AntisummBidistanses = DistributionCharacteristics[firstIndex, 4]; unityDistributions[distribution].Used = true; if (normalized.SummOfBidistances != 0) { normalizedList.Add(normalized); } } } NormalizedDistribution[] normalizedDistributions = normalizedList.OrderBy(x => x.Minimum).ToArray(); DistributionCharacteristics = new double[normalizedDistributions.Length + 1, 5]; for (int j = 0; j < normalizedDistributions.Length; j++) { DistributionCharacteristics[j, 0] = normalizedDistributions[j].SummOfBidistances; DistributionCharacteristics[j, 1] = normalizedDistributions[j].NumberOfPeople; DistributionCharacteristics[j, 2] = normalizedDistributions[j].Minimum; DistributionCharacteristics[j, 3] = normalizedDistributions[j].Maximum; DistributionCharacteristics[j, 4] = normalizedDistributions[j].AntisummBidistanses; if (j == normalizedDistributions.Length - 1) { DistributionCharacteristics[j, 3] = SortedArrayDoubleBackup.Length; } } thisNumberOfGroups = previousNumberOfGroups; previousNumberOfGroups = normalizedDistributions.Length; } while (previousNumberOfGroups < thisNumberOfGroups); List <Objects.AnalizedGroup> analizedGroupsList = new List <Objects.AnalizedGroup>(); for (int finalDistribution = 0; finalDistribution < thisNumberOfGroups; finalDistribution++) { int[] all = GetIndex(Convert.ToInt32(DistributionCharacteristics[finalDistribution, 2]), Convert.ToInt32(DistributionCharacteristics[finalDistribution, 3]), koefficients); int currMin = all[0]; int currMax = all[1]; double mediana = 0; for (int currPat = currMin; currPat < currMax; currPat++) { mediana = mediana + koefficients[currPat] * ((Entropy * SortedArrayDouble[currPat] / DistributionCharacteristics[finalDistribution, 1]) + ((1 - Entropy) * (SortedArrayDouble[currPat] * (1 / Distances[currPat, 0])) / DistributionCharacteristics[finalDistribution, 4])); } mediana = mediana * (max - min) + min; double percent = DistributionCharacteristics[finalDistribution, 1] / SortedArrayDoubleBackup.Length; analizedGroupsList.Add(new Objects.AnalizedGroup(percent, mediana) { min = SortedArrayDouble[currMin] * (max - min) + min, max = SortedArrayDouble[currMax - 1] * (max - min) + min + 0.00001, count = Convert.ToInt32(DistributionCharacteristics[finalDistribution, 1]) }); } Objects.AnalizedGroup[] analizedGroupArray = new Objects.AnalizedGroup[analizedGroupsList.Count]; analizedGroupArray = analizedGroupsList.ToArray(); for (int f = 0; f < analizedGroupArray.Length; f++) { List <double> partList = new List <double>(); double dispersia = 0; for (int g = 0; g < NonSortedArrayDouble.Length; g++) { if (NonSortedArrayDouble[g] >= analizedGroupArray[f].min && NonSortedArrayDouble[g] <= analizedGroupArray[f].max) { partList.Add(NonSortedArrayDouble[g]); dispersia = dispersia + Math.Pow(NonSortedArrayDouble[g] - analizedGroupArray[f].mediana, 2); } } double[] partArray = new double[partList.Count]; partArray = partList.ToArray(); analizedGroupArray[f].dispersia = Math.Sqrt(dispersia / partArray.Length); analizedGroupArray[f].participatns = partArray; } return(new Objects.AnalizedTuple(analizedGroupArray, col, thisNumberOfGroups + 1, min, max, meanDensity, NonSortedArrayDouble, new int[analizedGroupArray.Length], Entropy)); }
public Objects.AnalizedTuple Sorter(Objects.InputHuman[] inputHumenArray, int col, double Upper, double Entropy, bool OneSided) { double[] NonSortedArrayDouble = inputHumenArray.Select(x => x.Normalized.ElementAt(col).ThisDouble).ToArray(); int lastrow = NonSortedArrayDouble.Length; double[] SortedArrayDouble = new double[lastrow]; var sorted = NonSortedArrayDouble.OrderByDescending(x => x); int i = lastrow - 1; foreach (var dbl in sorted) { SortedArrayDouble[i] = dbl; i--; } double HighestPeak = 0; double min = SortedArrayDouble[0]; double max = SortedArrayDouble[lastrow - 1]; int propose = 0; double diffstep; do { propose++; proposedGroups = lastrow / propose; SortedMatrix = new double[3, proposedGroups + 1]; diffstep = (max - min) / Convert.ToDouble(proposedGroups); for (int human = 1; human < lastrow; human++) { for (int diff = 1; diff < proposedGroups + 1; diff++) { if (NonSortedArrayDouble[human - 1] >= min && NonSortedArrayDouble[human - 1] <= min + diffstep && diff == 1) { SortedMatrix[1, 1]++; } else if (NonSortedArrayDouble[human - 1] > min + (diff - 1) * diffstep && NonSortedArrayDouble[human - 1] <= min + diff * diffstep) { SortedMatrix[1, diff]++; } } } HighestPeak = SortedMatrix[1, 1]; for (int l = 1; l < proposedGroups + 1; l++) { if (SortedMatrix[1, l] > HighestPeak) { HighestPeak = SortedMatrix[1, l]; } } } while (HighestPeak < lastrow / Upper); Peaks = new double[proposedGroups]; FakeHumans = new double[proposedGroups + 1, 3]; int secondLevelPeak = 0; for (int k = 0; k < proposedGroups; k++) { if (SortedMatrix[1, k + 1] > HighestPeak / Entropy && !OneSided) { if (SortedMatrix[1, k + 1] > HighestPeak / Entropy * 2 && secondLevelPeak == 0) { secondLevelPeak = 1; } else if (SortedMatrix[1, k + 1] > HighestPeak / Entropy * 2 && secondLevelPeak != 0) { if (SortedMatrix[1, k] < HighestPeak / Entropy * 2) { step = step + 1; } } Peaks[step] = Peaks[step] + SortedMatrix[1, k + 1]; SortedMatrix[2, k + 1] = step; } else if (SortedMatrix[1, k + 1] > HighestPeak / Entropy) { if (SortedMatrix[1, k + 1] > HighestPeak / Entropy && secondLevelPeak == 0) { secondLevelPeak = 1; } Peaks[step] = Peaks[step] + SortedMatrix[1, k + 1]; SortedMatrix[2, k + 1] = step; } else { secondLevelPeak = 0; while (Peaks[step] > 0) { step++; } } } for (int m = 0; m < proposedGroups; m++) { allPeaks = allPeaks + Peaks[m]; } NonModifiedSortedMatrix = (double[, ])SortedMatrix.Clone(); for (int n = 1; n < proposedGroups + 1; n++) { if (SortedMatrix[2, n] > 0) { SortedMatrix[1, n] = (SortedMatrix[1, n] / Peaks[Convert.ToInt32(SortedMatrix[2, n])]) * (diffstep * (n - 0.5)); FakeHumans[Convert.ToInt32(SortedMatrix[2, n]), 1] = FakeHumans[Convert.ToInt32(SortedMatrix[2, n]), 1] + SortedMatrix[1, n]; FakeHumans[Convert.ToInt32(SortedMatrix[2, n]), 2] = Convert.ToDouble(Peaks[Convert.ToInt32(SortedMatrix[2, n])]) / Convert.ToDouble(allPeaks); } } List <Objects.AnalizedGroup> analizedGroupsList = new List <Objects.AnalizedGroup>(); for (int o = 1; o < step + 1; o++) { if (FakeHumans[o, 1] != 0) { analizedGroupsList.Add(new Objects.AnalizedGroup(Math.Round(FakeHumans[o, 2], 2), Math.Round(FakeHumans[o, 1] + min, 2))); } } if (analizedGroupsList.Count == 0) { analizedGroupsList.Add(new Objects.AnalizedGroup(100, Math.Round((max - min) / 2 + min, 2))); } Objects.AnalizedGroup[] analizedGroupArray = new Objects.AnalizedGroup[analizedGroupsList.Count]; analizedGroupArray = analizedGroupsList.ToArray(); for (int j = 0; j < analizedGroupArray.Length; j++) { double localMin = min; double localMax = max; if (j != 0 && j != analizedGroupArray.Length - 1) { localMin = (analizedGroupArray[j].mediana - analizedGroupArray[j - 1].mediana) / 2 + analizedGroupArray[j - 1].mediana; localMax = (analizedGroupArray[j + 1].mediana - analizedGroupArray[j].mediana) / 2 + analizedGroupArray[j].mediana; } else if (j != 0) { localMin = (analizedGroupArray[j].mediana - analizedGroupArray[j - 1].mediana) / 2 + analizedGroupArray[j - 1].mediana; } else if (j != analizedGroupArray.Length - 1) { localMax = (analizedGroupArray[j + 1].mediana - analizedGroupArray[j].mediana) / 2 + analizedGroupArray[j].mediana; } int count = 0; List <double> partList = new List <double>(); double dispersia = 0; for (int g = 0; g < SortedArrayDouble.Length; g++) { if (SortedArrayDouble[g] >= localMin && SortedArrayDouble[g] < localMax) { count++; partList.Add(SortedArrayDouble[g]); dispersia = dispersia + Math.Pow(SortedArrayDouble[g] - analizedGroupArray[j].mediana, 2); } } double[] partArray = new double[partList.Count]; partArray = partList.ToArray(); analizedGroupArray[j].participatns = partArray; analizedGroupArray[j].dispersia = Math.Sqrt(dispersia / partArray.Length); analizedGroupArray[j].max = localMax; analizedGroupArray[j].min = localMin; analizedGroupArray[j].count = count; } analizedGroupArray[analizedGroupArray.Length - 1].count = analizedGroupArray[analizedGroupArray.Length - 1].count + 1; int[] indicesArray = new int[SortedMatrix.GetUpperBound(1) + 1]; for (int p = 0; p < indicesArray.Length; p++) { indicesArray[p] = Convert.ToInt32(SortedMatrix[2, p]); } return(new Objects.AnalizedTuple(analizedGroupArray, col, proposedGroups, min, max, diffstep, NonSortedArrayDouble, indicesArray, Entropy)); }