forked from SciML/LinearSolve.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinearSolveFastAlmostBandedMatricesExt.jl
More file actions
34 lines (29 loc) · 1.26 KB
/
Copy pathLinearSolveFastAlmostBandedMatricesExt.jl
File metadata and controls
34 lines (29 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module LinearSolveFastAlmostBandedMatricesExt
using FastAlmostBandedMatrices, LinearAlgebra, LinearSolve
import LinearSolve: defaultalg,
do_factorization, init_cacheval, DefaultLinearSolver,
DefaultAlgorithmChoice
function defaultalg(A::AlmostBandedMatrix, b, oa::OperatorAssumptions{Bool})
if oa.issq
return DefaultLinearSolver(DefaultAlgorithmChoice.DirectLdiv!)
else
return DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
end
end
# For BandedMatrix
for alg in (:SVDFactorization, :MKLLUFactorization, :DiagonalFactorization,
:SparspakFactorization, :KLUFactorization, :UMFPACKFactorization,
:GenericLUFactorization, :RFLUFactorization, :BunchKaufmanFactorization,
:CHOLMODFactorization, :NormalCholeskyFactorization, :LDLtFactorization,
:AppleAccelerateLUFactorization, :CholeskyFactorization, :LUFactorization)
@eval begin
function init_cacheval(::$(alg), ::AlmostBandedMatrix, b, u, Pl, Pr, maxiters::Int,
abstol, reltol, verbose::LinearVerbosity, assumptions::OperatorAssumptions)
return nothing
end
end
end
function do_factorization(alg::QRFactorization, A::AlmostBandedMatrix, b, u)
return alg.inplace ? qr!(A) : qr(A)
end
end