Skip to content

Commit

Permalink
Update test_complex.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Mar 9, 2024
1 parent e9c3394 commit cbb681b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit cbb681b

Please sign in to comment.