diff --git a/test/test_complex.jl b/test/test_complex.jl index 7b64c027f20..7fcab52dfe1 100644 --- a/test/test_complex.jl +++ b/test/test_complex.jl @@ -257,6 +257,23 @@ function test_complex_hermitian_constraint() return end +function test_complex_hermitian_inequality_constraint() + model = Model() + @variable(model, x[1:2, 1:2]) + H = LinearAlgebra.Hermitian(x) + @test vectorize(H, HermitianMatrixShape(2)) == + [x[1, 1], x[1, 2], x[2, 2], 0.0] + @constraint(model, c, H >= 0, HermitianPSDCone()) + @test constraint_object(c).func == [x[1, 1], x[1, 2], x[2, 2], 0.0] + @test function_string(MIME("text/plain"), constraint_object(c)) == + "[x[1,1] x[1,2];\n x[1,2] x[2,2]]" + @constraint(model, c2, 0 <= H, HermitianPSDCone()) + @test constraint_object(c2).func == [x[1, 1], x[1, 2], x[2, 2], 0.0] + @test function_string(MIME("text/plain"), constraint_object(c2)) == + "[x[1,1] x[1,2];\n x[1,2] x[2,2]]" + return +end + function test_isreal() model = Model() @variable(model, x[1:2])