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; }
public static int Round <R>(this IRealField <R> F, R r) { return((int)Math.Round(F.EmbedToReal(r))); }
public static R ScalarPow <R>(this IRealField <R> F, R r, R pow) { var f = F.FromRealBinaryOp(Math.Pow); return(f(r, pow)); }
public static R Abs <R>(this IRealField <R> F, R r) { return(F.Compare(r, F.Zero()) >= 0 ? r : F.Negate(r)); }
public static R Sqrt <R>(this IRealField <R> F, R r) { var f = F.FromRealOp(Math.Sqrt); return(f(r)); }
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)))); }
public static Func <PType, PType> ToRealOp <R>(this IRealField <R> F, Func <R, R> f) { return(r => F.EmbedToReal(f(F.EmbedFromReal(r)))); }