@@ -104,77 +104,6 @@ function test_dU_from_dQ()
104104 return _test_dU_dQ (U, dU)
105105end
106106
107- function _make_square_bridge (dim)
108- s = MOI. PositiveSemidefiniteConeSquare (dim)
109- return MOI. Bridges. Constraint. SquareBridge{
110- Float64,
111- MOI. VectorAffineFunction{Float64},
112- MOI. ScalarAffineFunction{Float64},
113- MOI. PositiveSemidefiniteConeTriangle,
114- MOI. PositiveSemidefiniteConeSquare,
115- }(
116- s,
117- MOI. ConstraintIndex{
118- MOI. VectorAffineFunction{Float64},
119- MOI. PositiveSemidefiniteConeTriangle,
120- }(
121- 1 ,
122- ),
123- Pair{
124- Tuple{Int,Int},
125- MOI. ConstraintIndex{
126- MOI. ScalarAffineFunction{Float64},
127- MOI. EqualTo{Float64},
128- },
129- }[],
130- )
131- end
132-
133- function test_square_to_triangle_indices ()
134- # 2x2: square col-major [a11, a21, a12, a22] → upper tri [a11, a12, a22]
135- @test DiffOpt. _square_to_triangle_indices (_make_square_bridge (2 )) ==
136- [1 , 3 , 4 ]
137- # 3x3: square col-major [a11,a21,a31, a12,a22,a32, a13,a23,a33]
138- # → upper tri [a11, a12,a22, a13,a23,a33] at indices [1, 4,5, 7,8,9]
139- @test DiffOpt. _square_to_triangle_indices (_make_square_bridge (3 )) ==
140- [1 , 4 , 5 , 7 , 8 , 9 ]
141- # 1x1: trivial
142- @test DiffOpt. _square_to_triangle_indices (_make_square_bridge (1 )) == [1 ]
143- end
144-
145- function _make_rootdet_square_bridge (dim)
146- s = MOI. RootDetConeSquare (dim)
147- return MOI. Bridges. Constraint. SquareBridge{
148- Float64,
149- MOI. VectorAffineFunction{Float64},
150- MOI. ScalarAffineFunction{Float64},
151- MOI. RootDetConeTriangle,
152- MOI. RootDetConeSquare,
153- }(
154- s,
155- MOI. ConstraintIndex{
156- MOI. VectorAffineFunction{Float64},
157- MOI. RootDetConeTriangle,
158- }(
159- 1 ,
160- ),
161- Pair{
162- Tuple{Int,Int},
163- MOI. ConstraintIndex{
164- MOI. ScalarAffineFunction{Float64},
165- MOI. EqualTo{Float64},
166- },
167- }[],
168- )
169- end
170-
171- function test_square_to_triangle_indices_with_offset ()
172- # RootDetConeSquare(2) has 1 offset entry (the rootdet variable t)
173- # Full square: [t, a11, a21, a12, a22] → triangle: [t, a11, a12, a22]
174- bridge = _make_rootdet_square_bridge (2 )
175- @test DiffOpt. _square_to_triangle_indices (bridge) == [1 , 2 , 4 , 5 ]
176- end
177-
178107function test_square_offset ()
179108 @test DiffOpt. _square_offset (MOI. PositiveSemidefiniteConeSquare (2 )) == 0
180109 @test DiffOpt. _square_offset (MOI. RootDetConeSquare (2 )) == 1
@@ -187,27 +116,6 @@ function test_square_offset()
187116 [1 , 2 ]
188117end
189118
190- function test_triangle_to_square_scalars ()
191- # 2x2 PSD: triangle [a11, a12, a22] → square [a11, a12, a12, a22]
192- s = MOI. PositiveSemidefiniteConeSquare (2 )
193- @test DiffOpt. _triangle_to_square_scalars ([1 , 2 , 3 ], s) == [1 , 2 , 2 , 3 ]
194- # 3x3 PSD: triangle [a11, a12, a22, a13, a23, a33]
195- # → square col-major [a11, a12, a13, a12, a22, a23, a13, a23, a33]
196- s3 = MOI. PositiveSemidefiniteConeSquare (3 )
197- @test DiffOpt. _triangle_to_square_scalars ([1 , 2 , 3 , 4 , 5 , 6 ], s3) ==
198- [1 , 2 , 4 , 2 , 3 , 5 , 4 , 5 , 6 ]
199- # RootDetConeSquare(2): triangle [t, a11, a12, a22]
200- # → square [t, a11, a12, a12, a22]
201- sr = MOI. RootDetConeSquare (2 )
202- @test DiffOpt. _triangle_to_square_scalars ([10 , 1 , 2 , 3 ], sr) ==
203- [10 , 1 , 2 , 2 , 3 ]
204- # LogDetConeSquare(2): triangle [u, t, a11, a12, a22]
205- # → square [u, t, a11, a12, a12, a22]
206- sl = MOI. LogDetConeSquare (2 )
207- @test DiffOpt. _triangle_to_square_scalars ([10 , 20 , 1 , 2 , 3 ], sl) ==
208- [10 , 20 , 1 , 2 , 2 , 3 ]
209- end
210-
211119end
212120
213121TestBridges. runtests ()
0 commit comments