linopy.expressions.QuadraticExpression.to_matrix#
- QuadraticExpression.to_matrix()#
Return a sparse matrix representation of the expression only including quadratic terms.
Note that the matrix is formulated following the convention of the optimization problem, i.e. the quadratic term is 0.5 x^T Q x. The matrix Q is therefore symmetric and the diagonal terms are doubled.