Skip to content

Commit b673576

Browse files
oxinaboxvtjnash
andauthored
Relax constrain on lq to allwo AbstractMatrix (#32120)
Co-authored-by: Jameson Nash <[email protected]>
1 parent aa7d879 commit b673576

File tree

1 file changed

+4
-2
lines changed
  • stdlib/LinearAlgebra/src

1 file changed

+4
-2
lines changed

stdlib/LinearAlgebra/src/lq.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ julia> l == S.L && q == S.Q
107107
true
108108
```
109109
"""
110-
lq(A::StridedMatrix{<:BlasFloat}) = lq!(copy(A))
111-
lq(x::Number) = lq(fill(x,1,1))
110+
lq(A::AbstractMatrix{T}) where {T} = lq!(copy_oftype(A, lq_eltype(T)))
111+
lq(x::Number) = lq!(fill(convert(lq_eltype(typeof(x)), x), 1, 1))
112+
113+
lq_eltype(::Type{T}) where {T} = typeof(zero(T) / sqrt(abs2(one(T))))
112114

113115
copy(A::LQ) = LQ(copy(A.factors), copy(A.τ))
114116

0 commit comments

Comments
 (0)