Пример #1
0
 public Density(IDictionary <M, RF> dict, G baseStructure, IRealField <RF> realField, string name = null)
 {
     BaseStructure = baseStructure;
     RealField     = realField;
     // TODO: We should use the equalitycomparer and comparer from the algebraic structure!!!
     _densityDict = dict;
     Name         = name ?? DefaultName;
 }
Пример #2
0
 public static int Round <R>(this IRealField <R> F, R r)
 {
     return((int)Math.Round(F.EmbedToReal(r)));
 }
Пример #3
0
        public static R ScalarPow <R>(this IRealField <R> F, R r, R pow)
        {
            var f = F.FromRealBinaryOp(Math.Pow);

            return(f(r, pow));
        }
Пример #4
0
 public static R Abs <R>(this IRealField <R> F, R r)
 {
     return(F.Compare(r, F.Zero()) >= 0
         ? r
         : F.Negate(r));
 }
Пример #5
0
        public static R Sqrt <R>(this IRealField <R> F, R r)
        {
            var f = F.FromRealOp(Math.Sqrt);

            return(f(r));
        }
Пример #6
0
 public static Func <PType, PType, PType> ToRealBinaryOp <R>(this IRealField <R> F, Func <R, R, R> f)
 {
     return((r, s) => F.EmbedToReal(f(F.EmbedFromReal(r), F.EmbedFromReal(s))));
 }
Пример #7
0
 public static Func <PType, PType> ToRealOp <R>(this IRealField <R> F, Func <R, R> f)
 {
     return(r => F.EmbedToReal(f(F.EmbedFromReal(r))));
 }