def permute(self, idx):
        """Permutes the columns of the factor matrices inplace
        """

        # Check that input is a true permutation
        if set(idx) != set(range(self.rank)):
            raise ValueError('Invalid permutation specified.')

        # Update factors
        self.factors = [f[:, idx] for f in self.factors]
        return self.factors
Permutes the columns of the factor matrices inplace