public static double[] GetVeryfied(this double[] array, ComparisonKind comparisonKind, double comparisonConstant) { var corrects = new List <double>(); corrects.AddRange(array.Where(element => comparisonKind.Check(element, comparisonConstant))); return(corrects.ToArray()); }
public static double[][] CutRowByColumnValue(this double[][] inputs, int columnIndex, ComparisonKind comparisonKind, double conditionConstance) { int corrects = inputs.GetColumn(columnIndex).Count(colVal => comparisonKind.Check(colVal, conditionConstance)); var outputMatrix = new double[corrects][]; for (int inputRowIndex = 0, copyRowIndex = 0; inputRowIndex < inputs.GetColumn(0).Length; inputRowIndex++) { if (comparisonKind.Check(inputs[inputRowIndex][columnIndex], conditionConstance)) { outputMatrix[copyRowIndex] = new double[inputs[inputRowIndex].Length]; for (int copyColumnIndex = 0; copyColumnIndex < inputs[inputRowIndex].Length; copyColumnIndex++) { outputMatrix[copyRowIndex][copyColumnIndex] = inputs[inputRowIndex][copyColumnIndex]; } copyRowIndex++; } } return(outputMatrix); }
public static int GetVeryfiedCount(this double[] inputs, ComparisonKind comparisonKind, double comparisonConstant) { return(inputs.Count(input => comparisonKind.Check(input, comparisonConstant))); }