Ejemplo n.º 1
0
 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);
         }
     }
 }
Ejemplo n.º 2
0
        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)));
        }
Ejemplo n.º 3
0
 //
 // 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);
 }
Ejemplo n.º 4
0
 public static bool IsPositiveInfinity(SuperDouble d)
 {
     return(d.val == double.PositiveInfinity);
 }
Ejemplo n.º 5
0
 internal static bool IsNegative(SuperDouble d)
 {
     return(d.val < 0);
 }
Ejemplo n.º 6
0
 public static bool IsNaN(SuperDouble d)
 {
     return(double.IsNaN(d.val));
 }
Ejemplo n.º 7
0
 public static bool IsInfinity(SuperDouble d)
 {
     return(double.IsInfinity(d.val));
 }
Ejemplo n.º 8
0
 public bool Equals(SuperDouble obj)
 {
     return(obj == this || (double.IsNaN(obj.val) && double.IsNaN(val)));
 }
Ejemplo n.º 9
0
 public HilbertVector(SuperDouble sd, List <UnitPower> power)
 {
     value  = sd;
     vector = power;
 }
Ejemplo n.º 10
0
 public HilbertVector(SuperDouble sd)
 {
     value  = sd;
     vector = new List <UnitPower> ();
 }