@@ -654,15 +654,18 @@ function test_value_symmetric()
654654 model = direct_model (inner)
655655 @variable (model, x[i in 1 : 2 , j in 1 : 2 ], Symmetric, start = i + j)
656656 Y = LinearAlgebra. Symmetric (1.0 .* x)
657+ Z = LinearAlgebra. I - Y # element Z.data[2, 1] is #undef
657658 @test_throws OptimizeNotCalled value (x)
658659 @test_throws OptimizeNotCalled value (Y)
659660 @test value (start_value, x) == LinearAlgebra. Symmetric ([2 3 ; 3 4 ])
660661 @test value (start_value, Y) == LinearAlgebra. Symmetric ([2 3 ; 3 4 ])
662+ @test value (start_value, Z) == LinearAlgebra. Symmetric ([- 1 - 3 ; - 3 - 3 ])
661663 optimize! (model)
662664 MOI. set (inner, MOI. TerminationStatus (), MOI. OPTIMAL)
663665 MOI. set .(inner, MOI. VariablePrimal (), index .(x), [3 4 ; 4 5 ])
664666 @test value (x) == LinearAlgebra. Symmetric ([3 4 ; 4 5 ])
665667 @test value (Y) == LinearAlgebra. Symmetric ([3 4 ; 4 5 ])
668+ @test value (Z) == LinearAlgebra. Symmetric ([- 2 - 4 ; - 4 - 4 ])
666669 @test_throws MOI. ResultIndexBoundsError value (x; result = 2 )
667670 @test_throws MOI. ResultIndexBoundsError value (Y; result = 2 )
668671 return
@@ -675,13 +678,16 @@ function test_value_hermitian()
675678 model = direct_model (inner)
676679 H = [1 2 + 3im ; 2 - 3im 4 ]
677680 @variable (model, x[i in 1 : 2 , j in 1 : 2 ], Hermitian, start = H[i, j])
681+ Z = LinearAlgebra. I - x
678682 @test_throws OptimizeNotCalled value (x)
679683 @test value (start_value, x) == LinearAlgebra. Hermitian (H)
684+ @test value (start_value, Z) == LinearAlgebra. Hermitian (LinearAlgebra. I - H)
680685 optimize! (model)
681686 MOI. set (inner, MOI. TerminationStatus (), MOI. OPTIMAL)
682687 y = index .(all_variables (model))
683688 MOI. set .(inner, MOI. VariablePrimal (), y, [3 , 4 , 5 , 6 ])
684689 @test value (x) == LinearAlgebra. Hermitian ([3 4 + 6im ; 4 - 6im 5 ])
690+ @test value (Z) == LinearAlgebra. Hermitian ([- 2 - 4 - 6im ; 4 + 6im - 4 ])
685691 @test_throws MOI. ResultIndexBoundsError value (x; result = 2 )
686692 return
687693end
0 commit comments