1
- using Test, LinearAlgebra, SparseArrays, Clarabel, Random
1
+ using Test, LinearAlgebra, SparseArrays, Clarabel, StableRNGs
2
2
3
- rng = Random . MersenneTwister (242713 )
3
+ rng = StableRNGs . StableRNG (242713 )
4
4
5
5
FloatT = Float64
6
6
@@ -17,8 +17,8 @@ FloatT = Float64
17
17
18
18
@testset " test_coneops_scaled_unit_shift" begin
19
19
20
- n = 5
21
- s = randn (n)
20
+ n = 5
21
+ s = randn (rng, n)
22
22
s[1 ] = - 1.
23
23
K = Clarabel. SecondOrderCone (5 )
24
24
(m,_) = Clarabel. margins (K,s,Clarabel. PrimalCone)
@@ -32,8 +32,8 @@ FloatT = Float64
32
32
33
33
n = 5 # must be > 4 to avoid dense representation
34
34
K = Clarabel. SecondOrderCone (n)
35
- s = randn (n)
36
- z = randn (n)
35
+ s = randn (rng, n)
36
+ z = randn (rng, n)
37
37
(mz,_) = Clarabel. margins (K,z,Clarabel. DualCone)
38
38
corz = mz > 0. ? 0. : 1. - mz
39
39
(ms,_) = Clarabel. margins (K,s,Clarabel. PrimalCone)
@@ -59,7 +59,7 @@ FloatT = Float64
59
59
# this should be W^TW
60
60
W2_A = η^ 2 .* (D + u* u' - v* v' )
61
61
62
- # W^TW should agree with Hinv
62
+ # W^TW should agree with Hinv
63
63
J = - I (n).* 1. ; J[1 ,1 ] = 1.
64
64
Hinv = η^ 2 .* (2 * w* w' - J)
65
65
@@ -80,14 +80,14 @@ FloatT = Float64
80
80
# W_B should be symmetric
81
81
@test norm (W_B- W_B' ) ≈ 0 atol = 1e-14
82
82
83
- # matrix and its inverse should agree
83
+ # matrix and its inverse should agree
84
84
@test norm (W_B* W_Binv - I (n)) ≈ 0 atol = 1e-14
85
85
86
86
# square should agree with the directly constructed one
87
87
W2_B = W_B* W_B
88
88
@test norm (W2_B- W2_A) ≈ 0 atol = 1e-12
89
89
90
-
90
+
91
91
end
92
92
93
93
0 commit comments