def permute(x, indices=(0, 0), rows=0, cols=1):
    """Swap two columns and (or) two rows of 'x', whose indices are specified
    in indices=[i,j].
    Note: permutations are done in-place. You'll lose your original matrix"""
    [i, j] = indices
    if rows:
        x[(i), :], x[(j), :] = x[(j), :], x[(i), :] + 0
    if cols:
        x[:, (i)], x[:, (j)] = x[:, (j)], x[:, (i)] + 0
