private static void CalculateFirstStage() { Parallel.For(0, FirstStageDistance.Length, (i) => { double temp = 0; int index = i * FeatureExtaction.FEATURE_REDUCE_SIZE; for (int j = 0; j < FIRST_STAGE_DIMENSION; j++) { var diff = (FeatureExtaction.Features[j] - QuadraticDiscriminant.MEAN_VECTOR[index]); temp += diff * diff; index++; } FirstStageDistance[i] = (float)temp; ClassIndex[i] = (ushort)i; }); QuickSelect.Start(FirstStageDistance, ClassIndex, 0, FIRST_STAGE_FINAL_INDEX, FIRST_STAGE_NCLASS); }
private static void CalculateSecondStage() { CalculateMDQF(SecondStageDistance, SECOND_STAGE_K_DIMENSION); QuickSelect.Start(SecondStageDistance, ClassIndex, 0, SECOND_STAGE_FINAL_INDEX, SECOND_STAGE_NCLASS); }