def gaussDemo(A, tol=0.01):
    """Gauss Elimination
A: matrix of full rank
exmaple:
>>> import mymat
>>> A=mymat.MyMat('1,1,1,6;0,4,-1,5;2,-2,1,1')
>>> GaussDemo(A)  # get the echelon form of A
"""
    r, c = A.shape
    m = min(r, c)
    print('Consider matrix:')
    print(A)
    print('------------------Elimination Process-------------------')
    k = l = 1
    cols = []
    while k <= r and l < c:
        if all(A[k:r, (l)] == 0):
            l += 1
            continue
        for index, p in enumerate(A[k:r, (l)].T.tolist()):
            if p != 0:
                ind = index
                break
        if abs(p) < tol:
            raise Exception('the pivot is too small!')
        else:
            if ind != 0:
                t = ind + k
                A[(k), l:c], A[(t), l:c] = A[(t), l:c].copy(), A[(k), l:c
                    ].copy()
                print('-------------Gauss1: row%d <-> row%d' % (k, t))
                print(A)
            if A(k, l) != 1:
                if l < c:
                    print(
                        '------------Gauss2: row{0} * 1/A({0},{0}), A({0},{0})={1}'
                        .format(k, A[k, k]))
                    A[(k), l + 1:c] /= A[k, l]
                    A[k, l] = 1
                print(A)
            if k < r:
                for s in range(k + 1, r + 1):
                    print(
                        '------------Gauss3: row{1} -A({1},{0})*row{0}, A({1},{0})={2}'
                        .format(k, s, A[s, k]))
                A[k + 1:r, l + 1:c] -= A[k + 1:r, (l)] * A[(k), l + 1:c]
                A[k + 1:r, (l)] = 0
                print(A)
            cols.append(l)
            k += 1
            l += 1
    print(
        '-----------------------Back Substitution Process--------------------')
    R = len(cols)
    for l in cols[-1:0:-1]:
        for k, a in enumerate(A[1:R - 1, (l)].T.tolist(), 1):
            if a != 0:
                print(
                    '------------Gauss3: row{1} - A({1},{2})*row{0}, A({1},{0})={3}'
                    .format(R, k, l, a))
                if l < c:
                    A[(k), l + 1:c] -= a * A[(R), l + 1:c]
        A[1:R - 1, (l)] = 0
        print(A)
        R -= 1
    """for i in range(r-1, 0, -1):                                            # [a beta C] __\\ [a 0 C-beta*B]
        if A[i,i] != 0:                                                    # [0 E    B] --/ [0 E B       ]
            A[i,i:c] = (A[i,i:c]-A[i,i+1:r]*A[i+1:r,i:c])/A[i,i]
            print('---------------Gauss2nd/3rd: calculus row %d'%i)        # print rule (elementary transform)
            print(A)   """
