private static MATRIX Multiply(MATRIX matrix1, MATRIX matrix2) { if (matrix1.Cols != matrix2.Rows) { throw new MatrixException("Operation not possible"); } MATRIX result = MATRIX.NullMatrix(matrix1.Rows, matrix2.Cols); for (int i = 0; i < result.Rows; i++) { for (int j = 0; j < result.Cols; j++) { for (int k = 0; k < matrix1.Cols; k++) { result[i, j] += matrix1[i, k] * matrix2[k, j]; } } } return(result); }