This constructs 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. $$ We construct the hyperdeterminant as the determinant of a certain square matrix derived from $f$. The hyperdeterminant function outputs the hyperdeterminant itself, whereas the hyperdeterminantMatrix function outputs the matrix used to compute the hyperdeterminant. (For background on computing hyperdeterminants, see Section 14.3 of the book ``Discriminants, resultants, and multidimensional determinants '' by Gelfand-Kapranov-Zelevinsky.)
The following constructs the generic hyperdetermiant of format $3\times 2\times 2$, which is a polynomial of degree 6 consisting of 66 monomials.
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 : h=hyperdeterminant f; |
i4 : degree h o4 = {6} o4 : List |
i5 : #terms h o5 = 66 |
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 hyperdeterminant is a method function.