예제 #1
0
        public static NumberListType operator +(NumberListType l, NumberListType r)
        {
            if (l.Length != r.Length)
                throw new Exception("Lists must have same size.");
            NumberListType ret = new NumberListType(l.Numbers);
            for (int i = 0; i < l.Length; i++)
                ret[i] += r[i];

            return ret;       
        }
예제 #2
0
        public static NumberListType operator /(NumberListType l, NumberListType r)
        {
            if (l.Length == 1 && r.Length != 1)
            {
                var t = r;
                r = l;
                l = t;
            }

            if (l.Length != r.Length && r.Length != 1)
                throw new Exception("Lists must have same size.");
            NumberListType ret = new NumberListType(l.Numbers);
            for (int i = 0; i < l.Length; i++)
                ret[i] /= r[r.Length == 1 ? 0 : i];

            return ret;
        }