Beispiel #1
0
        public static HilbertVector operator ^(HilbertVector a, HilbertVector b)
        {
            if (b.vector.Count != 0)
            {
                throw new DimensionException();
            }
            if (a.vector.Count == 0)
            {
                return(new HilbertVector(a.value ^ b.value));
            }
            if (b.value > (SuperDouble)1000)
            {
                throw new DimensionException("Dimension Exponent Too Large");
            }
            double d = (double)b.value;

            if (Math.Abs(Math.Round(d) - d) * PreCVal > Math.Abs(d))
            {
                throw new DimensionException();
            }
            int bv = (int)d;
            List <UnitPower> np = a.vector.Select((UnitPower arg) => new UnitPower(arg.unit, arg.power * bv)).ToList();
            HilbertVector    hv = new HilbertVector(a.value ^ b.value, np);

            return(hv);
        }
Beispiel #2
0
        public static HilbertVector operator -(HilbertVector a, HilbertVector b)
        {
            foreach (UnitPower up in a.vector)
            {
                if (!b.vector.Contains(up))
                {
                    throw new ArgumentException("Not matching dimension types");
                }
            }
            HilbertVector hv = new HilbertVector(a.value - b.value, a.vector);

            return(hv);
        }