Пример #1
0
        public static AbstrSquareMatrix operator *(AbstrSquareMatrix m1, AbstrSquareMatrix m2)
        {
            if (m1.N != m2.N)
            {
                throw new SizeException(m1.N, m2.N);
            }

            AbstrSquareMatrix matrixC = m1.Create(m1.N);

            for (var i = 0; i < m1.N; i++)
            {
                for (var j = 0; j < m2.N; j++)
                {
                    matrixC.Get(i, j) = 0;

                    for (var k = 0; k < m1.N; k++)
                    {
                        matrixC.Get(i, j) += m1.Get(i, k) * m2.Get(k, j);
                    }
                }
            }

            return(matrixC);
        }
Пример #2
0
 public JaggedMatrix InverseMatrix()
 {
     return(new JaggedMatrix(MatrixConverter.ToJaggedArray(AbstrSquareMatrix.GaussInverse(MatrixConverter.ToOrdinaryArray(matrix)))));
 }