Skip to content

Commit

Permalink
Throw an error if trying to compute qr or ql positive
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed Oct 8, 2023
1 parent f212536 commit 02d84c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions NDTensors/src/linearalgebra/linearalgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ non-negative. Such a QR decomposition of a
matrix is unique. Returns a tuple (Q,R).
"""
function qr_positive(M::AbstractMatrix)
if iscu(M)
throw("Currently qr positive methods do not work for CuArrays because they require scalar operations. Please convert to CPU Array or use generic qr")

Check warning on line 426 in NDTensors/src/linearalgebra/linearalgebra.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: NDTensors/src/linearalgebra/linearalgebra.jl:426:- throw("Currently qr positive methods do not work for CuArrays because they require scalar operations. Please convert to CPU Array or use generic qr") NDTensors/src/linearalgebra/linearalgebra.jl:426:+ throw( NDTensors/src/linearalgebra/linearalgebra.jl:427:+ "Currently qr positive methods do not work for CuArrays because they require scalar operations. Please convert to CPU Array or use generic qr", NDTensors/src/linearalgebra/linearalgebra.jl:428:+ )
end
sparseQ, R = qr(M)
Q = convert(typeof(R), sparseQ)
nc = size(Q, 2)
Expand All @@ -447,6 +450,9 @@ non-negative. Such a QL decomposition of a
matrix is unique. Returns a tuple (Q,L).
"""
function ql_positive(M::AbstractMatrix)
if iscu(M)
throw("Currently ql positive methods do not work for CuArrays because they require scalar operations. Please convert to CPU Array or use generic ql")

Check warning on line 454 in NDTensors/src/linearalgebra/linearalgebra.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: NDTensors/src/linearalgebra/linearalgebra.jl:454:- throw("Currently ql positive methods do not work for CuArrays because they require scalar operations. Please convert to CPU Array or use generic ql") NDTensors/src/linearalgebra/linearalgebra.jl:456:+ throw( NDTensors/src/linearalgebra/linearalgebra.jl:457:+ "Currently ql positive methods do not work for CuArrays because they require scalar operations. Please convert to CPU Array or use generic ql", NDTensors/src/linearalgebra/linearalgebra.jl:458:+ )
end
sparseQ, L = ql(M)
Q = convert(typeof(L), sparseQ)
nr, nc = size(L)
Expand Down

0 comments on commit 02d84c7

Please sign in to comment.