-
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
speculativeWhether the change will be implemented is speculativeWhether the change will be implemented is speculative
Description
From this Discourse discussion.
using LinearAlgebra
julia> ones(3,2) \ ones(3)
2-element Vector{Float64}:
0.5
0.4999999999999999
julia> ones(3,3) \ ones(3)
ERROR: SingularException(2)
julia> ones(3,4) \ ones(3)
4-element Vector{Float64}:
0.2500000000000001
0.25
0.25
0.25The issue here is that \ applies the LU decomposition to a square input but a pivoted QR to a rectangular input. The LU solver cannot handle singular inputs while QR can.
julia> qr(ones(3,3),ColumnNorm()) \ ones(3)
3-element Vector{Float64}:
0.33333333333333337
0.33333333333333337
0.33333333333333337A naive fix might just be to check the lu(A) call within \ and re-try with qr(A,ColumnNorm()) if it fails via singularity.
Metadata
Metadata
Assignees
Labels
speculativeWhether the change will be implemented is speculativeWhether the change will be implemented is speculative