'Permute columns with complicated elements as
far right as they can go.  Since the `sympy` row reduction
algorithms start on the left, having complexity right-shifted
speeds things up.
Returns a tuple (mat, perm) where perm is a permutation
of the columns to perform to shift the complex columns right, and mat
is the permuted matrix.'

def _permute_complexity_right(self, iszerofunc):

    def complexity(i):
        return sum(((1 if (iszerofunc(e) is None) else 0) for e in self[:, i]))
    complex = [(complexity(i), i) for i in range(self.cols)]
    perm = [j for (i, j) in sorted(complex)]
    return (self.permute(perm, orientation='cols'), perm)
