Exemplo n.º 1
0
        public static CMatrix operator *(CMatrix m1, CMatrix m2)
        {
            CMatrix multiplied = new CMatrix(m1.rows, m2.cols);

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

            }
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        public CMatrix Identity()
        {
            CMatrix identity = new CMatrix(rows, rows);

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    if (i == j)
                    {
                        Set(i, j, 1.0f);
                    }
                    else
                    {
                        Set(i, j, 0.0f);
                    }
                }
            }

            return identity;
        }