Implement loop permutation and transposition of storage layout