Skip to content

Commit c40206f

Browse files
mtfishmanclaude
andcommitted
Use a fresh StableRNG(1234) per array setup
Each independent `a` (or `a, a′`) construction gets its own `rng = StableRNG(1234)` so individual blocks are self-contained and reproducible in isolation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0f6b46b commit c40206f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test/test_abstract_blocktype.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ arrayts = (Array, JLArray)
1515
@testset "Abstract block type (arraytype=$arrayt, eltype=$elt)" for arrayt in arrayts,
1616
elt in elts
1717

18-
rng = StableRNG(1)
1918
dev = adapt(arrayt)
2019

2120
a = BlockSparseMatrix{elt, AbstractMatrix{elt}}(undef, [2, 3], [2, 3])
2221
@test sprint(show, MIME"text/plain"(), a) isa String
2322
@test iszero(storedlength(a))
2423
@test iszero(blockstoredlength(a))
2524

25+
rng = StableRNG(1234)
2626
a = BlockSparseMatrix{elt, AbstractMatrix{elt}}(undef, [2, 3], [2, 3])
2727
a[Block(1, 1)] = dev(randn(rng, elt, 2, 2))
2828
@test !iszero(a[Block(1, 1)])
@@ -34,6 +34,7 @@ arrayts = (Array, JLArray)
3434
@test iszero(a[Block(1, 2)])
3535
@test a[Block(1, 2)] isa Matrix{elt}
3636

37+
rng = StableRNG(1234)
3738
a = BlockSparseMatrix{elt, AbstractMatrix{elt}}(undef, [2, 3], [2, 3])
3839
a[Block(1, 1)] = dev(randn(rng, elt, 2, 2))
3940
a′ = BlockSparseMatrix{elt, AbstractMatrix{elt}}(undef, [2, 3], [2, 3])
@@ -55,6 +56,7 @@ arrayts = (Array, JLArray)
5556
@test Array(b) Array(a) * Array(a′)
5657
@test norm(b) 0
5758

59+
rng = StableRNG(1234)
5860
a = BlockSparseMatrix{elt, AbstractMatrix{elt}}(undef, [2, 3], [2, 3])
5961
a[Block(1, 1)] = dev(randn(rng, elt, 2, 2))
6062
for f in (eig_full, eig_trunc)
@@ -72,6 +74,7 @@ arrayts = (Array, JLArray)
7274
@test_broken eig_vals(a)
7375
end
7476

77+
rng = StableRNG(1234)
7578
a = BlockSparseMatrix{elt, AbstractMatrix{elt}}(undef, [2, 3], [2, 3])
7679
a[Block(1, 1)] = dev(parent(hermitianpart(randn(rng, elt, 2, 2))))
7780
for f in (eigh_full, eigh_trunc)
@@ -89,6 +92,7 @@ arrayts = (Array, JLArray)
8992
@test_broken eigh_vals(a)
9093
end
9194

95+
rng = StableRNG(1234)
9296
a = BlockSparseMatrix{elt, AbstractMatrix{elt}}(undef, [2, 3], [2, 3])
9397
a[Block(1, 1)] = dev(randn(rng, elt, 2, 2))
9498
for f in (left_orth, left_polar, qr_compact, qr_full)

0 commit comments

Comments
 (0)