Change default solver to QR#131
Conversation
|
@ChrisRackauckas is this good enough? The BackslashSolver from Claude in 121 has some type inference issues. |
| struct QRSolver{F} <: CoarseSolver | ||
| factorization::F | ||
| function QRSolver(A) | ||
| fact = qr(A) |
There was a problem hiding this comment.
make this a column-pivoted QR, so it handles singularities?
There was a problem hiding this comment.
I am pretty sure SPQR already handles these faithfully:
julia> A = sprand(4,4,0.1)
4×4 SparseMatrixCSC{Float64, Int64} with 3 stored entries:
⋅ ⋅ ⋅ ⋅
0.248639 0.469341 ⋅ ⋅
⋅ ⋅ ⋅ ⋅
⋅ ⋅ 0.0588856 ⋅
julia> f = qr(A)
SparseArrays.SPQR.QRSparse{Float64, Int64}
Q factor:
4×4 SparseArrays.SPQR.QRSparseQ{Float64, Int64}
R factor:
4×4 SparseMatrixCSC{Float64, Int64} with 3 stored entries:
0.248639 ⋅ 0.469341 ⋅
⋅ 0.0588856 ⋅ ⋅
⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅
Row permutation:
4-element Vector{Int64}:
2
4
3
1
Column permutation:
4-element Vector{Int64}:
1
3
2
4Or do you have something else in mind? Note that if we start converting the coarse matrix from sparse to dense (as done in the pinv solver), then we again run into memory issues.
There was a problem hiding this comment.
I dug into this topic quite a bit, and yes SPQR does work. There's now also https://github.com/SciML/SparseColumnPivotedQR.jl now, but SPQR is likely better for the matrices that people are using an AMG for.
There was a problem hiding this comment.
Thanks for taking time here! I tried to benchmark everything to look out for regressions, but ran into some trouble with the new OrdinaryDiffEq release (SciML/SciMLBenchmarks.jl#1601).
FYI if the coarse solver is accessible via LinearSolve, then it can be used via coarse_solver = AMG.LinearSolveWrapper(myalg) already since AMG v1.0 or so.
f8e4644 to
fffeabf
Compare
Supersedes #121