Ejemplo n.º 1
0
        public static CMatrix operator -(CMatrix m)
        {
            CMatrix negative = new CMatrix(m.rows, m.cols);

            for (int i = 0; i < m.rows; i++)
            {
                for (int j = 0; j < m.cols; j++)
                {
                    negative.Set(i, j, -m.Get(i, j));
                }
            }

            return negative;
        }
Ejemplo n.º 2
0
        public static CMatrix operator +(CMatrix m1, CMatrix m2)
        {
            CMatrix added = new CMatrix(m1.rows, m1.cols);

            for (int i = 0; i < m1.rows; i++)
            {
                for (int j = 0; j < m1.cols; j++)
                {
                    added.Set(i, j, m1.Get(i, j) + m2.Get(i, j));
                }
            }

            return added;
        }
Ejemplo n.º 3
0
        public static CMatrix operator -(CMatrix m1, CMatrix m2)
        {
            CMatrix subbed = new CMatrix(m1.rows, m1.cols);

            for (int i = 0; i < m1.rows; i++)
            {
                for (int j = 0; j < m1.cols; j++)
                {
                    subbed.Set(i, j, m1.Get(i, j) - m2.Get(i, j));
                }
            }

            return subbed;
        }