private static T GreatestCommonDivisor <T>(T one, T two, IArithmetic <T> arithmetic) { T big = arithmetic.Max(arithmetic.Abs(one), arithmetic.Abs(two)); T small = arithmetic.Min(arithmetic.Abs(one), arithmetic.Abs(two)); T remainder = arithmetic.Modulo(big, small); return(arithmetic.Equals(remainder, arithmetic.Zero) ? small : AdvancedMath.GreatestCommonDivisor(small, remainder, arithmetic)); }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { DataT result = math.MaxValue(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { result = math.Min(result, v); } return(result); }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { using (Profiling.GetMarker(Profiling.MarkerId.MergeMin).Auto()) { DataT result = math.MaxValue(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { result = math.Min(result, v); } return(result); } }