Пример #1
0
        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));
        }
Пример #2
0
            protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
            {
                DataT result = math.MinValue();

                foreach (var v in sourceColumn.VisitRows(sourceIndices))
                {
                    result = math.Max(result, v);
                }
                return(result);
            }
Пример #3
0
 protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
 {
     using (Profiling.GetMarker(Profiling.MarkerId.MergeMax).Auto())
     {
         DataT result = math.MinValue();
         foreach (var v in sourceColumn.VisitRows(sourceIndices))
         {
             result = math.Max(result, v);
         }
         return(result);
     }
 }