Skip to content

Commit 501493b

Browse files
committed
fix test seeds
1 parent 5c5f40b commit 501493b

File tree

9 files changed

+31
-30
lines changed

9 files changed

+31
-30
lines changed

doc/src/devdocs/subarrays.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ julia> A = rand(2,3,4);
1919
2020
julia> S1 = view(A, :, 1, 2:3)
2121
2×2 view(::Array{Float64, 3}, :, 1, 2:3) with eltype Float64:
22-
0.762657 0.545403
23-
0.66338 0.866199
22+
0.98627 0.991588
23+
0.523355 0.105192
2424
2525
julia> S2 = view(A, 1, :, 2:3)
2626
3×2 view(::Array{Float64, 3}, 1, :, 2:3) with eltype Float64:
27-
0.762657 0.545403
28-
0.704125 0.0802701
29-
0.886174 0.535537
27+
0.98627 0.991588
28+
0.0890391 0.904316
29+
0.134982 0.299203
3030
```
3131
```@meta
3232
DocTestSetup = nothing

doc/src/manual/performance-tips.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ julia> function sum_global()
7777
end;
7878
7979
julia> @time sum_global()
80-
0.011001 seconds (9.30 k allocations: 417.044 KiB, 98.77% compilation time)
81-
503.4466694614652
80+
0.026328 seconds (9.30 k allocations: 416.747 KiB, 36.50% gc time, 99.48% compilation time)
81+
508.39048990953665
8282
8383
julia> @time sum_global()
8484
0.000075 seconds (3.49 k allocations: 70.156 KiB)
85-
503.4466694614652
85+
508.39048990953665
8686
```
8787

8888
On the first call (`@time sum_global()`) the function gets compiled. (If you've not yet used [`@time`](@ref)
@@ -113,12 +113,12 @@ julia> function sum_arg(x)
113113
end;
114114
115115
julia> @time sum_arg(x)
116-
0.007258 seconds (4.24 k allocations: 226.052 KiB, 99.74% compilation time)
117-
503.4466694614652
116+
0.010298 seconds (4.23 k allocations: 226.021 KiB, 99.81% compilation time)
117+
508.39048990953665
118118
119119
julia> @time sum_arg(x)
120120
0.000005 seconds (1 allocation: 16 bytes)
121-
503.4466694614652
121+
508.39048990953665
122122
```
123123

124124
The 1 allocation seen is from running the `@time` macro itself in global scope. If we instead run
@@ -128,8 +128,8 @@ the timing in a function, we can see that indeed no allocations are performed:
128128
julia> time_sum(x) = @time sum_arg(x);
129129
130130
julia> time_sum(x)
131-
0.000002 seconds
132-
503.4466694614652
131+
0.000001 seconds
132+
508.39048990953665
133133
```
134134

135135
In some situations, your function may need to allocate memory as part of its operation, and this

stdlib/LinearAlgebra/test/dense.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ n = 10
1515
n1 = div(n, 2)
1616
n2 = 2*n1
1717

18-
Random.seed!(1234321)
18+
Random.seed!(1234323)
1919

2020
@testset "Matrix condition number" begin
2121
ainit = rand(n,n)
2222
@testset "for $elty" for elty in (Float32, Float64, ComplexF32, ComplexF64)
2323
ainit = convert(Matrix{elty}, ainit)
2424
for a in (copy(ainit), view(ainit, 1:n, 1:n))
25-
@test cond(a,1) 11860.833898970453 atol=0.5
26-
@test cond(a,2) 5578.947735096807 atol=0.5
27-
@test cond(a,Inf) 9974.454657908922 atol=0.4
28-
@test cond(a[:,1:5]) 5.956698046316083 atol=0.01
25+
@test cond(a,1) 162.93076496229205 atol=0.5
26+
@test cond(a,2) 97.7362909028399 atol=0.5
27+
@test cond(a,Inf) 196.00888526411242 atol=0.4
28+
@test cond(a[:,1:5]) 10.466183798451308 atol=0.01
2929
@test_throws ArgumentError cond(a,3)
3030
end
3131
end

stdlib/LinearAlgebra/test/eigen.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ n = 10
1111
n1 = div(n, 2)
1212
n2 = 2*n1
1313

14-
Random.seed!(1234324)
14+
Random.seed!(12343215)
1515

1616
areal = randn(n,n)/2
1717
aimg = randn(n,n)/2

stdlib/LinearAlgebra/test/lu.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ n = 10
1111
n1 = div(n, 2)
1212
n2 = 2*n1
1313

14-
Random.seed!(1234322)
14+
Random.seed!(1234323)
1515

1616
areal = randn(n,n)/2
1717
aimg = randn(n,n)/2

stdlib/LinearAlgebra/test/qr.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ n = 10
1111
n1 = div(n, 2)
1212
n2 = 2*n1
1313

14-
Random.seed!(1234324)
14+
Random.seed!(1234325)
1515

1616
areal = randn(n,n)/2
1717
aimg = randn(n,n)/2

stdlib/LinearAlgebra/test/uniformscaling.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using .Main.Quaternions
1010
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "OffsetArrays.jl"))
1111
using .Main.OffsetArrays
1212

13-
Random.seed!(1234)
13+
Random.seed!(1234543)
1414

1515
@testset "basic functions" begin
1616
@test I === I' # transpose

stdlib/SparseArrays/src/sparsematrix.jl

+8-7
Original file line numberDiff line numberDiff line change
@@ -1598,13 +1598,14 @@ argument specifies a random number generator, see [Random Numbers](@ref).
15981598
# Examples
15991599
```jldoctest; setup = :(using Random; Random.seed!(1234))
16001600
julia> sprand(Bool, 2, 2, 0.5)
1601-
2×2 SparseMatrixCSC{Bool, Int64} with 4 stored entries:
1602-
1 1
1601+
2×2 SparseMatrixCSC{Bool, Int64} with 2 stored entries:
1602+
⋅ ⋅
16031603
1 1
16041604
16051605
julia> sprand(Float64, 3, 0.75)
1606-
3-element SparseVector{Float64, Int64} with 1 stored entry:
1607-
[1] = 0.66338
1606+
3-element SparseVector{Float64, Int64} with 2 stored entries:
1607+
[1] = 0.523355
1608+
[2] = 0.0890391
16081609
```
16091610
"""
16101611
function sprand(r::AbstractRNG, m::Integer, n::Integer, density::AbstractFloat, rfn::Function, ::Type{T}=eltype(rfn(r, 1))) where T
@@ -1645,9 +1646,9 @@ argument specifies a random number generator, see [Random Numbers](@ref).
16451646
# Examples
16461647
```jldoctest; setup = :(using Random; Random.seed!(0))
16471648
julia> sprandn(2, 2, 0.75)
1648-
2×2 SparseMatrixCSC{Float64, Int64} with 4 stored entries:
1649-
1.49137 1.09378
1650-
-1.56692 1.1035
1649+
2×2 SparseMatrixCSC{Float64, Int64} with 3 stored entries:
1650+
-1.92631 -0.858041
1651+
⋅ 0.0213808
16511652
```
16521653
"""
16531654
sprandn(r::AbstractRNG, m::Integer, n::Integer, density::AbstractFloat) =

stdlib/SparseArrays/test/sparse.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ end
17241724
local A = guardseed(1234321) do
17251725
triu(sprand(10, 10, 0.2))
17261726
end
1727-
@test getcolptr(SparseArrays.droptol!(A, 0.01)) == [1, 1, 1, 1, 4, 5, 6, 6, 9, 11, 14]
1727+
@test getcolptr(SparseArrays.droptol!(A, 0.01)) == [1, 1, 1, 1, 3, 3, 4, 5, 7, 10, 11]
17281728
@test isequal(SparseArrays.droptol!(sparse([1], [1], [1]), 1), SparseMatrixCSC(1, 1, Int[1, 1], Int[], Int[]))
17291729
end
17301730

0 commit comments

Comments
 (0)