Macaulay2 » Documentation
Packages » SparseResultants :: sortShape
next | previous | forward | backward | up | index | toc

sortShape -- sort the dimensions of a multidimensional matrix

Synopsis

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}))

See also

Ways to use sortShape :

For the programmer

The object sortShape is a method function.