Skip to content

Commit 560b395

Browse files
deniusc42f
authored andcommitted
Fix type piracy in test/qr.jl
1 parent 2583967 commit 560b395

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/qr.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using StaticArrays, Test, LinearAlgebra, Random
22

3-
Base.randn(::Type{BigFloat}) = BigFloat(randn(Float64))
4-
Base.randn(::Type{BigFloat}, I::Integer) = [randn(BigFloat) for i=1:I]
5-
Base.randn(::Type{Int}) = rand(-9:9)
6-
Base.randn(::Type{Int}, I::Integer) = [randn(Int) for i=1:I]
7-
Base.randn(::Type{Complex{T}}) where T = Complex{T}(randn(T,2)...)
8-
Base.randn(::Type{Complex}) = randn(Complex{Float64})
3+
broadenrandn(::Type{BigFloat}) = BigFloat(randn(Float64))
4+
broadenrandn(::Type{Int}) = rand(-9:9)
5+
broadenrandn(::Type{Complex{T}}) where T = Complex{T}(broadenrandn(T), broadenrandn(T))
6+
broadenrandn(::Type{T}) where T = randn(T)
97

108
Random.seed!(42)
119
@testset "QR decomposition" begin
@@ -46,7 +44,7 @@ Random.seed!(42)
4644
for eltya in (Float32, Float64, BigFloat, Int),
4745
rel in (real, complex),
4846
sz in [(3,3), (3,4), (4,3)]
49-
arr = SMatrix{sz[1], sz[2], rel(eltya), sz[1]*sz[2]}( [randn(rel(eltya)) for i = 1:sz[1], j = 1:sz[2]] )
47+
arr = SMatrix{sz[1], sz[2], rel(eltya), sz[1]*sz[2]}( [broadenrandn(rel(eltya)) for i = 1:sz[1], j = 1:sz[2]] )
5048
test_qr(arr)
5149
end
5250
# some special cases

0 commit comments

Comments
 (0)