public HilbertVector(Unit u, int power) { value = (SuperDouble)1.0; vector = new List <UnitPower> () { new UnitPower(u, power) }; while (vector.Any((UnitPower arg) => arg.unit is CompositeUnit | arg.unit.baseUnit != null)) { int j = vector.FindIndex((UnitPower obj) => obj.unit is CompositeUnit | obj.unit.baseUnit != null); if (vector[j].unit is CompositeUnit) { CompositeUnit comu = vector[j].unit as CompositeUnit; int pw = vector[j].power; vector.RemoveAt(j); foreach (UnitPower z in comu.Factors) { vector.Add(new UnitPower(z.unit, z.power * pw)); } } else { value *= ((SuperDouble)vector[j].unit.baseMultiplier) ^ (SuperDouble)vector[j].power; vector[j] = new UnitPower(vector[j].unit.baseUnit, vector[j].power); } } }
public override bool Equals(object obj) { if (!(obj is SuperDouble)) { return(false); } SuperDouble num = (SuperDouble)obj; return(num == this || (double.IsNaN(num.val) && double.IsNaN(val))); }
// // Methods // public int CompareTo(SuperDouble value) { if (this < value) { return(-1); } if (this > value) { return(1); } if (this == value) { return(0); } if (!double.IsNaN(val)) { return(1); } if (!double.IsNaN(value.val)) { return(-1); } return(0); }
public static bool IsPositiveInfinity(SuperDouble d) { return(d.val == double.PositiveInfinity); }
internal static bool IsNegative(SuperDouble d) { return(d.val < 0); }
public static bool IsNaN(SuperDouble d) { return(double.IsNaN(d.val)); }
public static bool IsInfinity(SuperDouble d) { return(double.IsInfinity(d.val)); }
public bool Equals(SuperDouble obj) { return(obj == this || (double.IsNaN(obj.val) && double.IsNaN(val))); }
public HilbertVector(SuperDouble sd, List <UnitPower> power) { value = sd; vector = power; }
public HilbertVector(SuperDouble sd) { value = sd; vector = new List <UnitPower> (); }