File tree Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 1
1
name = " ChainRulesTestUtils"
2
2
uuid = " cdddcdb0-9152-4a09-a978-84456f9df70a"
3
- version = " 0.4.0 "
3
+ version = " 0.4.1 "
4
4
5
5
[deps ]
6
6
ChainRulesCore = " d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Original file line number Diff line number Diff line change 1
1
# Useful for LinearAlgebra tests
2
- function generate_well_conditioned_matrix (rng, N)
3
- A = randn (rng, N, N)
2
+ function generate_well_conditioned_matrix (rng:: AbstractRNG , T , N)
3
+ A = randn (rng, T, N, N)
4
4
return A * A' + I
5
5
end
6
6
7
- generate_well_conditioned_matrix (N) = generate_well_conditioned_matrix (Random. GLOBAL_RNG, N)
7
+ function generate_well_conditioned_matrix (rng:: AbstractRNG , N)
8
+ return generate_well_conditioned_matrix (rng, Float64, N)
9
+ end
10
+
11
+ generate_well_conditioned_matrix (N) = generate_well_conditioned_matrix (Random. GLOBAL_RNG, N)
12
+
13
+ function generate_well_conditioned_matrix (T, N)
14
+ return generate_well_conditioned_matrix (Random. GLOBAL_RNG, T, N)
15
+ end
Original file line number Diff line number Diff line change 2
2
function _is_well_conditioned (matrix)
3
3
@test ! isempty (matrix)
4
4
@test isposdef (matrix)
5
- @assert length (matrix) ≤ 25
5
+ @assert length (matrix) ≤ 25
6
6
@test cond (matrix) < 100
7
7
end
8
8
9
9
10
10
@testset " Generate Well Conditioned Matrix" begin
11
+ rng = MersenneTwister (1 )
11
12
@testset " Pass in RNG" begin
12
- rng = MersenneTwister (1 )
13
13
matrix = generate_well_conditioned_matrix (rng, 5 )
14
-
15
14
_is_well_conditioned (matrix)
15
+ @testset " $T " for T in (Float64, ComplexF64)
16
+ matrix = generate_well_conditioned_matrix (rng, T, 5 )
17
+ _is_well_conditioned (matrix)
18
+ end
16
19
end
17
20
18
21
@testset " Global RNG" begin
19
22
matrix = generate_well_conditioned_matrix (5 )
20
-
21
23
_is_well_conditioned (matrix)
24
+ @testset " $T " for T in (Float64, ComplexF64)
25
+ matrix = generate_well_conditioned_matrix (T, 5 )
26
+ end
22
27
end
23
28
end
24
29
end
You can’t perform that action at this time.
0 commit comments