Skip to content

Commit a1437f5

Browse files
authored
Don't collect AbstractQ objects in tests (#1872)
1 parent aad0a4c commit a1437f5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/cusolver/linalg.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ CuMatrix{T}(Q::QRCompactWYQ) where {T} = error("QRCompactWY format is not suppor
178178
Matrix{T}(Q::QRPackedQ{S,<:CuArray,<:CuArray}) where {T,S} = Array(CuMatrix{T}(Q))
179179
Matrix{T}(Q::QRCompactWYQ{S,<:CuArray,<:CuArray}) where {T,S} = Array(CuMatrix{T}(Q))
180180

181+
if VERSION < v"1.10-"
181182
# extracting the full matrix can be done with `collect` (which defaults to `Array`)
182183
function Base.collect(src::Union{QRPackedQ{<:Any,<:CuArray,<:CuArray},
183184
QRCompactWYQ{<:Any,<:CuArray,<:CuArray}})
@@ -193,6 +194,8 @@ Base.similar(Q::Union{QRPackedQ{<:Any,<:CuArray,<:CuArray},
193194
::Type{T}, dims::Dims{N}) where {T,N} =
194195
CuArray{T,N}(undef, dims)
195196

197+
end
198+
196199
function Base.getindex(Q::QRPackedQ{<:Any, <:CuArray}, ::Colon, j::Int)
197200
y = CUDA.zeros(eltype(Q), size(Q, 2))
198201
y[j] = 1

test/cusolver/dense.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,13 @@ k = 1
359359

360360
d_I = CuMatrix{elty}(I, size(d_F.Q))
361361
@test det(d_F.Q) det(collect(d_F.Q * CuMatrix{elty}(I, size(d_F.Q)))) atol=tol*norm(A)
362-
@test collect(d_F.Q * d_I) collect(d_F.Q)
363-
@test collect(d_I * d_F.Q) collect(d_F.Q)
362+
if VERSION >= v"1.10-"
363+
@test collect((d_F.Q'd_I) * d_F.Q) collect(d_I)
364+
@test collect(d_F.Q * (d_I * d_F.Q')) collect(d_I)
365+
else
366+
@test collect(d_F.Q * d_I) collect(d_F.Q)
367+
@test collect(d_I * d_F.Q) collect(d_F.Q)
368+
end
364369

365370
d_I = CuMatrix{elty}(I, size(d_F.R))
366371
@test collect(d_F.R * d_I) collect(d_F.R)

0 commit comments

Comments
 (0)