If $F$ is a multilinear form on $\mathbb{P}^{k_1}\times\mathbb{P}^{k_2}\times\cdots\times\mathbb{P}^{k_n}$, then the shape of the corresponding matrix is $(k_1+1)\times(k_2+1)\times\cdots\times(k_n+1)$. You can use permute to rearrange the dimensions.
i1 : R = ZZ[x_1..x_3,y_1..y_4,z_1..z_2,Degrees=>{3:{1,0,0},4:{0,1,0},2:{0,0,1}}]; |
i2 : F = random({1,1,1},R) o2 = 8x y z + 8x y z + 6x y z + 3x y z + 5x y z + 6x y z + 8x y z + 1 1 1 2 1 1 3 1 1 1 2 1 2 2 1 3 2 1 1 3 1 ------------------------------------------------------------------------ 8x y z + 6x y z + 3x y z + 2x y z + 3x y z + x y z + 8x y z + 2 3 1 3 3 1 1 4 1 2 4 1 3 4 1 1 1 2 2 1 2 ------------------------------------------------------------------------ 3x y z + 7x y z + 7x y z + 8x y z + 3x y z + 5x y z + 9x y z + 3 1 2 1 2 2 2 2 2 3 2 2 1 3 2 2 3 2 3 3 2 ------------------------------------------------------------------------ 7x y z + 3x y z + 7x y z 1 4 2 2 4 2 3 4 2 o2 : R |
i3 : M = multidimensionalMatrix F o3 = {{{8, 1}, {3, 7}, {8, 3}, {3, 7}}, {{8, 8}, {5, 7}, {8, 5}, {2, 3}}, ------------------------------------------------------------------------ {{6, 3}, {6, 8}, {6, 9}, {3, 7}}} o3 : 3-dimensional matrix of shape 3 x 4 x 2 over ZZ |
The inverse operation can be obtained using the command "!" as follows:
i4 : F' = M! o4 = 8x0 x1 x2 + 8x0 x1 x2 + 6x0 x1 x2 + 3x0 x1 x2 + 5x0 x1 x2 + 0 0 0 1 0 0 2 0 0 0 1 0 1 1 0 ------------------------------------------------------------------------ 6x0 x1 x2 + 8x0 x1 x2 + 8x0 x1 x2 + 6x0 x1 x2 + 3x0 x1 x2 + 2 1 0 0 2 0 1 2 0 2 2 0 0 3 0 ------------------------------------------------------------------------ 2x0 x1 x2 + 3x0 x1 x2 + x0 x1 x2 + 8x0 x1 x2 + 3x0 x1 x2 + 1 3 0 2 3 0 0 0 1 1 0 1 2 0 1 ------------------------------------------------------------------------ 7x0 x1 x2 + 7x0 x1 x2 + 8x0 x1 x2 + 3x0 x1 x2 + 5x0 x1 x2 + 0 1 1 1 1 1 2 1 1 0 2 1 1 2 1 ------------------------------------------------------------------------ 9x0 x1 x2 + 7x0 x1 x2 + 3x0 x1 x2 + 7x0 x1 x2 2 2 1 0 3 1 1 3 1 2 3 1 o4 : ZZ[x0 ..x0 , x1 ..x1 , x2 ..x2 ] 0 2 0 3 0 1 |
i5 : assert(M === multidimensionalMatrix F') |
i6 : assert(sub(F',vars ring F) === F) |