This constructs a matrix whose determinant equals the hyperdeterminant of a tensor of boundary format, where we say that a $a\times b_1\times \dots \times b_n$ has boundary format if $$ a-\sum_{i=1}^n (b_i-1)=1. $$ The entries of the output matrix correspond to entries of the input tensor.
i1 : f=flattenedGenericTensor({3,2,2},QQ); 4 3 o1 : Matrix (QQ[x ..x ]) <--- (QQ[x ..x ]) 0,0,0 2,1,1 0,0,0 2,1,1 |
i2 : S=ring f; |
i3 : M=hyperdeterminantMatrix f o3 = | x_(0,0,0) 0 x_(1,0,0) 0 x_(2,0,0) 0 | | x_(0,0,1) x_(0,0,0) x_(1,0,1) x_(1,0,0) x_(2,0,1) x_(2,0,0) | | 0 x_(0,0,1) 0 x_(1,0,1) 0 x_(2,0,1) | | x_(0,1,0) 0 x_(1,1,0) 0 x_(2,1,0) 0 | | x_(0,1,1) x_(0,1,0) x_(1,1,1) x_(1,1,0) x_(2,1,1) x_(2,1,0) | | 0 x_(0,1,1) 0 x_(1,1,1) 0 x_(2,1,1) | 6 6 o3 : Matrix S <--- S |
i4 : det(M)==hyperdeterminant f o4 = true |
There is bug involving the graded structure of the output. Namely, the code assumes that all entries of f have degree 1, and gives the wrong graded structure if this is not the case. If ring f is not graded, then the code gives an error.
The object hyperdeterminantMatrix is a method function.