@@ -356,9 +356,7 @@ function test_semidefinite_cholesky_fail()
356356end
357357
358358function test_compute_sparse_sqrt_edge_cases ()
359- f = zero (MOI. ScalarQuadraticFunction{Float64})
360- s = MOI. GreaterThan (0.0 )
361- for A in [
359+ for A in Any[
362360 # Trivial Cholesky
363361 [1.0 0.0 ; 0.0 2.0 ],
364362 # Cholesky works, with pivoting
@@ -371,20 +369,29 @@ function test_compute_sparse_sqrt_edge_cases()
371369 [2.0 0.0 ; 0.0 0.0 ],
372370 ]
373371 B = SparseArrays. sparse (A)
372+ f = zero (MOI. ScalarQuadraticFunction{eltype (A)})
373+ s = MOI. GreaterThan (zero (eltype (A)))
374374 I, J, V = MOI. Bridges. Constraint. compute_sparse_sqrt (B, f, s)
375- U = zeros (size (A))
375+ U = zeros (eltype (A), size (A))
376376 for (i, j, v) in zip (I, J, V)
377377 U[i, j] += v
378378 end
379379 @test isapprox (A, U' * U; atol = 1e-10 )
380380 end
381381 # Test failures
382- for A in [
382+ for A in Any [
383383 [- 1.0 0.0 ; 0.0 1.0 ],
384384 # Found from test_quadratic_nonconvex_constraint_basic
385385 [0.0 - 1.0 ; - 1.0 0.0 ],
386+ # Different element type. We could potentially make this work in future,
387+ # but it first requires https://github.com/JuliaSmoothOptimizers/LDLFactorizations.jl/pull/142
388+ BigFloat[- 1.0 0.0 ; 0.0 1.0 ],
389+ BigFloat[1.0 0.0 ; 0.0 2.0 ],
390+ BigFloat[1.0 1.0 ; 1.0 1.0 ],
386391 ]
387392 B = SparseArrays. sparse (A)
393+ f = zero (MOI. ScalarQuadraticFunction{eltype (A)})
394+ s = MOI. GreaterThan (zero (eltype (A)))
388395 @test_throws (
389396 MOI. UnsupportedConstraint{typeof (f),typeof (s)},
390397 MOI. Bridges. Constraint. compute_sparse_sqrt (B, f, s),
0 commit comments