Improved permute, roll, and transpose