Choosing between Symmetric and Hermitian programmatically in JuMP

You can do:

julia> model = Model();

julia> a = SymmetricMatrixSpace()
SymmetricMatrixSpace()

julia> @variable(model, x[1:2,1:2], set=a)
2×2 LinearAlgebra.Symmetric{VariableRef, Matrix{VariableRef}}:
 x[1,1]  x[1,2]
 x[1,2]  x[2,2]

where it’s HermitianMatrixSpace() for Hermitian matrices. The docs mention set= in this section and SymmetricMatrixSpace here, but I don’t see anywhere they mention using it for programmatic construction, maybe that would be useful to add to the docs.

4 Likes