# sortShape -- sort the dimensions of a multidimensional matrix

## Synopsis

• Usage:
sortShape M
• Inputs:
• Outputs:
• , the same as permute(M,s), where s is the sorting permutation of the shape of M.

## Description

 i1 : M = genericMultidimensionalMatrix {4,1,3,2} o1 = {{{{a , a }, {a , a }, {a , a }}}, 0,0,0,0 0,0,0,1 0,0,1,0 0,0,1,1 0,0,2,0 0,0,2,1 ------------------------------------------------------------------------ {{{a , a }, {a , a }, {a , a }}}, 1,0,0,0 1,0,0,1 1,0,1,0 1,0,1,1 1,0,2,0 1,0,2,1 ------------------------------------------------------------------------ {{{a , a }, {a , a }, {a , a }}}, 2,0,0,0 2,0,0,1 2,0,1,0 2,0,1,1 2,0,2,0 2,0,2,1 ------------------------------------------------------------------------ {{{a , a }, {a , a }, {a , a }}}} 3,0,0,0 3,0,0,1 3,0,1,0 3,0,1,1 3,0,2,0 3,0,2,1 o1 : 4-dimensional matrix of shape 4 x 1 x 3 x 2 over ZZ[a ..a ] 0,0,0,0 3,0,2,1 i2 : sortShape M o2 = {{{{a , a , a , a }, {a , a , 0,0,0,0 1,0,0,0 2,0,0,0 3,0,0,0 0,0,1,0 1,0,1,0 ------------------------------------------------------------------------ a , a }, {a , a , a , a }}, 2,0,1,0 3,0,1,0 0,0,2,0 1,0,2,0 2,0,2,0 3,0,2,0 ------------------------------------------------------------------------ {{a , a , a , a }, {a , a , 0,0,0,1 1,0,0,1 2,0,0,1 3,0,0,1 0,0,1,1 1,0,1,1 ------------------------------------------------------------------------ a , a }, {a , a , a , a }}}} 2,0,1,1 3,0,1,1 0,0,2,1 1,0,2,1 2,0,2,1 3,0,2,1 o2 : 4-dimensional matrix of shape 1 x 2 x 3 x 4 over ZZ[a ..a ] 0,0,0,0 3,0,2,1 i3 : assert(sortShape M === permute(M,{1,3,2,0}))