public MyMatrix Inverted()
        {
            if (!IsSquare)
            {
                throw new InvalidOperationException("Matrix is not square!");
            }
            MyMatrix tmp = new MyMatrix(n, n * 2);

            tmp.Set(this);
            for (int i = 0; i < n; i++)
            {
                tmp[i, i + n] = 1;
            }
            if (tmp.Gauss(n) == 0)
            {
                throw new DivideByZeroException("Determinant zero!");
            }
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    tmp[i, j] = tmp[i, j + n];
                }
            }
            tmp.M = n;
            //if (!(tmp * this).Equals(Id))
            //    throw new ArithmeticException("Cannot find inverse matrix!");
            return(tmp);
        }
        public string InverseLaTeX()
        {
            if (!IsSquare)
            {
                throw new InvalidOperationException("Matrix is not square!");
            }
            if (Determinant == 0)
            {
                throw new DivideByZeroException("Determinant zero!");
            }
            MyMatrix tmp = new MyMatrix(n, n * 2);

            tmp.Set(this);
            for (int i = 0; i < n; i++)
            {
                tmp[i, i + n] = 1;
            }
            string output = tmp.GaussLaTeX(n);

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    tmp[i, j] = tmp[i, j + n];
                }
            }
            tmp.M = n;

            /*try
             * {
             *  if (!(tmp * this).Equals(Id))
             *      throw new Exception();
             * }
             * catch { throw new ArithmeticException("Cannot find inverse matrix!"); }*/
            values = tmp.values;
            return(output);
        }