コード例 #1
0
        public static SpinResolved_DoubleVector operator +(SpinResolved_DoubleVector vec_1, SpinResolved_DoubleVector vec_2)
        {
            // check if lengths are the same
            if (vec_1.Nx != vec_2.Nx)
            {
                throw new ArrayTypeMismatchException();
            }

            SpinResolved_DoubleVector result = new SpinResolved_DoubleVector(vec_1.Nx);

            result.Spin_Up   = vec_1.Spin_Up + vec_2.Spin_Up;
            result.Spin_Down = vec_1.Spin_Down + vec_2.Spin_Down;

            return(result);
        }
コード例 #2
0
        public static SpinResolved_DoubleVector operator -(SpinResolved_DoubleVector vec_1, SpinResolved_DoubleVector vec_2)
        {
            // check if lengths are the same
            if (vec_1.Nx != vec_2.Nx)
                throw new ArrayTypeMismatchException();

            SpinResolved_DoubleVector result = new SpinResolved_DoubleVector(vec_1.Nx);
            result.Spin_Up = vec_1.Spin_Up - vec_2.Spin_Up;
            result.Spin_Down = vec_1.Spin_Down - vec_2.Spin_Down;

            return result;
        }