Ask Your Question

Revision history [back]

There is a simpler explanation, which is that the quadratic form

[ 2 -1 ]
[ *  2 ]

Maps to the matrix

[ 2 -1 ]
[ 0  2 ]

Which is equivalent to the symmetric matrix

[2    -1/2]
[-1/2    2]

Which can be gotten with A.Gram_matrix().

The A.matrix() function listed in the answer above is the Hessian, which is double the Gram matrix.

The documentation for Gram matrix gives as an example a Quadratic form with diagonal matrix. Should probably be updated to include off-diagonal terms to make this clearer.