Skip to content

Commit

Permalink
start fixing ambiguities
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoStrouwen committed Dec 3, 2023
1 parent 1111ac8 commit d80fade
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 44 deletions.
4 changes: 2 additions & 2 deletions ext/LinearSolveBandedMatricesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import LinearSolve: defaultalg,
do_factorization, init_cacheval, DefaultLinearSolver, DefaultAlgorithmChoice

# Defaults for BandedMatrices
function defaultalg(A::BandedMatrix, b, oa::OperatorAssumptions)
function defaultalg(A::BandedMatrix, b, oa::OperatorAssumptions{Bool})
if oa.issq
return DefaultLinearSolver(DefaultAlgorithmChoice.DirectLdiv!)
elseif LinearSolve.is_underdetermined(A)
Expand All @@ -15,7 +15,7 @@ function defaultalg(A::BandedMatrix, b, oa::OperatorAssumptions)
end
end

function defaultalg(A::Symmetric{<:Number, <:BandedMatrix}, b, ::OperatorAssumptions)
function defaultalg(A::Symmetric{<:Number, <:BandedMatrix}, b, ::OperatorAssumptions{Bool})
return DefaultLinearSolver(DefaultAlgorithmChoice.CholeskyFactorization)
end

Expand Down
2 changes: 1 addition & 1 deletion ext/LinearSolveFastAlmostBandedMatricesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using FastAlmostBandedMatrices, LinearAlgebra, LinearSolve
import LinearSolve: defaultalg,
do_factorization, init_cacheval, DefaultLinearSolver, DefaultAlgorithmChoice

function defaultalg(A::AlmostBandedMatrix, b, oa::OperatorAssumptions)
function defaultalg(A::AlmostBandedMatrix, b, oa::OperatorAssumptions{Bool})
if oa.issq
return DefaultLinearSolver(DefaultAlgorithmChoice.DirectLdiv!)
else
Expand Down
32 changes: 16 additions & 16 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end
defaultalg(A, b) = defaultalg(A, b, OperatorAssumptions(true))

function defaultalg(A::Union{DiffEqArrayOperator, MatrixOperator}, b,
assump::OperatorAssumptions)
assump::OperatorAssumptions{Bool})
defaultalg(A.A, b, assump)
end

Expand All @@ -36,41 +36,41 @@ function defaultalg(A, b, assump::OperatorAssumptions{Nothing})
defaultalg(A, b, OperatorAssumptions(issq, assump.condition))
end

function defaultalg(A::Tridiagonal, b, assump::OperatorAssumptions)
function defaultalg(A::Tridiagonal, b, assump::OperatorAssumptions{Bool})
if assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.LUFactorization)
else
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
end
end

function defaultalg(A::SymTridiagonal, b, ::OperatorAssumptions)
function defaultalg(A::SymTridiagonal, b, ::OperatorAssumptions{Bool})
DefaultLinearSolver(DefaultAlgorithmChoice.LDLtFactorization)
end
function defaultalg(A::Bidiagonal, b, ::OperatorAssumptions)
function defaultalg(A::Bidiagonal, b, ::OperatorAssumptions{Bool})

Check warning on line 50 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L50

Added line #L50 was not covered by tests
DefaultLinearSolver(DefaultAlgorithmChoice.DirectLdiv!)
end
function defaultalg(A::Factorization, b, ::OperatorAssumptions)
function defaultalg(A::Factorization, b, ::OperatorAssumptions{Bool})

Check warning on line 53 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L53

Added line #L53 was not covered by tests
DefaultLinearSolver(DefaultAlgorithmChoice.DirectLdiv!)
end
function defaultalg(A::Diagonal, b, ::OperatorAssumptions)
function defaultalg(A::Diagonal, b, ::OperatorAssumptions{Bool})
DefaultLinearSolver(DefaultAlgorithmChoice.DiagonalFactorization)
end

function defaultalg(A::Hermitian, b, ::OperatorAssumptions)
function defaultalg(A::Hermitian, b, ::OperatorAssumptions{Bool})
DefaultLinearSolver(DefaultAlgorithmChoice.CholeskyFactorization)
end

function defaultalg(A::Symmetric{<:Number, <:Array}, b, ::OperatorAssumptions)
function defaultalg(A::Symmetric{<:Number, <:Array}, b, ::OperatorAssumptions{Bool})
DefaultLinearSolver(DefaultAlgorithmChoice.BunchKaufmanFactorization)
end

function defaultalg(A::Symmetric{<:Number, <:SparseMatrixCSC}, b, ::OperatorAssumptions)
function defaultalg(A::Symmetric{<:Number, <:SparseMatrixCSC}, b, ::OperatorAssumptions{Bool})
DefaultLinearSolver(DefaultAlgorithmChoice.CHOLMODFactorization)
end

function defaultalg(A::AbstractSparseMatrixCSC{Tv, Ti}, b,
assump::OperatorAssumptions) where {Tv, Ti}
assump::OperatorAssumptions{Bool}) where {Tv, Ti}
if assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.SparspakFactorization)
else
Expand All @@ -80,7 +80,7 @@ end

@static if INCLUDE_SPARSE
function defaultalg(A::AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti}, b,
assump::OperatorAssumptions) where {Ti}
assump::OperatorAssumptions{Bool}) where {Ti}
if assump.issq
if length(b) <= 10_000 && length(nonzeros(A)) / length(A) < 2e-4
DefaultLinearSolver(DefaultAlgorithmChoice.KLUFactorization)
Expand All @@ -93,7 +93,7 @@ end
end
end

function defaultalg(A::GPUArraysCore.AbstractGPUArray, b, assump::OperatorAssumptions)
function defaultalg(A::GPUArraysCore.AbstractGPUArray, b, assump::OperatorAssumptions{Bool})

Check warning on line 96 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L96

Added line #L96 was not covered by tests
if assump.condition === OperatorCondition.IllConditioned || !assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
else
Expand All @@ -102,7 +102,7 @@ function defaultalg(A::GPUArraysCore.AbstractGPUArray, b, assump::OperatorAssump
end

# A === nothing case
function defaultalg(A, b::GPUArraysCore.AbstractGPUArray, assump::OperatorAssumptions)
function defaultalg(A::Nothing, b::GPUArraysCore.AbstractGPUArray, assump::OperatorAssumptions{Bool})

Check warning on line 105 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L105

Added line #L105 was not covered by tests
if assump.condition === OperatorCondition.IllConditioned || !assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
else
Expand All @@ -112,7 +112,7 @@ end

# Ambiguity handling
function defaultalg(A::GPUArraysCore.AbstractGPUArray, b::GPUArraysCore.AbstractGPUArray,
assump::OperatorAssumptions)
assump::OperatorAssumptions{Bool})
if assump.condition === OperatorCondition.IllConditioned || !assump.issq
DefaultLinearSolver(DefaultAlgorithmChoice.QRFactorization)
else
Expand All @@ -121,7 +121,7 @@ function defaultalg(A::GPUArraysCore.AbstractGPUArray, b::GPUArraysCore.Abstract
end

function defaultalg(A::SciMLBase.AbstractSciMLOperator, b,
assump::OperatorAssumptions)
assump::OperatorAssumptions{Bool})
if has_ldiv!(A)
return DefaultLinearSolver(DefaultAlgorithmChoice.DirectLdiv!)
elseif !assump.issq
Expand All @@ -137,7 +137,7 @@ function defaultalg(A::SciMLBase.AbstractSciMLOperator, b,
end

# Allows A === nothing as a stand-in for dense matrix
function defaultalg(A, b, assump::OperatorAssumptions)
function defaultalg(A, b, assump::OperatorAssumptions{Bool})
alg = if assump.issq
# Special case on Arrays: avoid BLAS for RecursiveFactorization.jl when
# it makes sense according to the benchmarks, which is dependent on
Expand Down
133 changes: 108 additions & 25 deletions src/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,15 @@ function do_factorization(alg::GenericFactorization, A, b, u)
return fact
end

function init_cacheval(alg::GenericFactorization{typeof(lu)}, A, b, u, Pl, Pr,
function init_cacheval(alg::GenericFactorization{typeof(lu)}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 486 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L486

Added line #L486 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.lu_instance(convert(AbstractMatrix, A))
ArrayInterface.lu_instance(A)

Check warning on line 489 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L489

Added line #L489 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(lu!)}, A, b, u, Pl, Pr,
function init_cacheval(alg::GenericFactorization{typeof(lu!)}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 491 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L491

Added line #L491 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.lu_instance(convert(AbstractMatrix, A))
ArrayInterface.lu_instance(A)

Check warning on line 494 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L494

Added line #L494 was not covered by tests
end

function init_cacheval(alg::GenericFactorization{typeof(lu)},
Expand Down Expand Up @@ -526,16 +526,36 @@ function init_cacheval(alg::GenericFactorization{typeof(lu!)}, A::Tridiagonal, b
assumptions::OperatorAssumptions)
ArrayInterface.lu_instance(A)
end
function init_cacheval(alg::GenericFactorization{typeof(lu!)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 529 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L529

Added line #L529 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 532 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L532

Added line #L532 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(lu)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 534 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L534

Added line #L534 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 537 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L537

Added line #L537 was not covered by tests
end

function init_cacheval(alg::GenericFactorization{typeof(qr)}, A, b, u, Pl, Pr,
function init_cacheval(alg::GenericFactorization{typeof(qr)}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 540 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L540

Added line #L540 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.qr_instance(convert(AbstractMatrix, A))
ArrayInterface.qr_instance(A)

Check warning on line 543 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L543

Added line #L543 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(qr!)}, A, b, u, Pl, Pr,
function init_cacheval(alg::GenericFactorization{typeof(qr!)}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 545 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L545

Added line #L545 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.qr_instance(convert(AbstractMatrix, A))
ArrayInterface.qr_instance(A)

Check warning on line 548 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L548

Added line #L548 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(qr)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 550 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L550

Added line #L550 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 553 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L553

Added line #L553 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(qr!)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 555 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L555

Added line #L555 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 558 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L558

Added line #L558 was not covered by tests
end

function init_cacheval(alg::GenericFactorization{typeof(qr)},
Expand Down Expand Up @@ -571,15 +591,15 @@ function init_cacheval(alg::GenericFactorization{typeof(qr!)}, A::Tridiagonal, b
ArrayInterface.qr_instance(A)
end

function init_cacheval(alg::GenericFactorization{typeof(svd)}, A, b, u, Pl, Pr,
function init_cacheval(alg::GenericFactorization{typeof(svd)}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 594 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L594

Added line #L594 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.svd_instance(convert(AbstractMatrix, A))
ArrayInterface.svd_instance(A)

Check warning on line 597 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L597

Added line #L597 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(svd!)}, A, b, u, Pl, Pr,
function init_cacheval(alg::GenericFactorization{typeof(svd!)}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 599 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L599

Added line #L599 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.svd_instance(convert(AbstractMatrix, A))
ArrayInterface.svd_instance(A)

Check warning on line 602 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L602

Added line #L602 was not covered by tests
end

function init_cacheval(alg::GenericFactorization{typeof(svd)},
Expand Down Expand Up @@ -615,6 +635,16 @@ function init_cacheval(alg::GenericFactorization{typeof(svd!)}, A::Tridiagonal,
assumptions::OperatorAssumptions)
ArrayInterface.svd_instance(A)
end
function init_cacheval(alg::GenericFactorization{typeof(svd!)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 638 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L638

Added line #L638 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 641 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L641

Added line #L641 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(svd)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 643 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L643

Added line #L643 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 646 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L646

Added line #L646 was not covered by tests
end

function init_cacheval(alg::GenericFactorization, A::Diagonal, b, u, Pl, Pr, maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
Expand All @@ -630,6 +660,18 @@ function init_cacheval(alg::GenericFactorization, A::SymTridiagonal{T, V}, b, u,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)
end
function init_cacheval(alg::GenericFactorization, A, b, u, Pl, Pr,

Check warning on line 663 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L663

Added line #L663 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
init_cacheval(alg, convert(AbstractMatrix, A), b, u, Pl, Pr,

Check warning on line 666 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L666

Added line #L666 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
end
function init_cacheval(alg::GenericFactorization, A::AbstractMatrix, b, u, Pl, Pr,
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
do_factorization(alg, A, b, u)
end

function init_cacheval(alg::Union{GenericFactorization{typeof(bunchkaufman!)},
GenericFactorization{typeof(bunchkaufman)}},
Expand All @@ -654,15 +696,49 @@ end
# Try to never use it.

# Cholesky needs the posdef matrix, for GenericFactorization assume structure is needed
function init_cacheval(alg::Union{GenericFactorization{typeof(cholesky)},
GenericFactorization{typeof(cholesky!)}}, A, b, u, Pl, Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
function init_cacheval(alg::GenericFactorization{typeof(cholesky)}, A::AbstractMatrix, b, u, Pl, Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
newA = copy(convert(AbstractMatrix, A))
do_factorization(alg, newA, b, u)
end
function init_cacheval(alg::GenericFactorization{typeof(cholesky!)}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 705 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L705

Added line #L705 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
newA = copy(convert(AbstractMatrix, A))
do_factorization(alg, newA, b, u)
end
function init_cacheval(alg::GenericFactorization{typeof(cholesky!)}, A::Diagonal, b, u, Pl, Pr, maxiters::Int,

Check warning on line 711 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L711

Added line #L711 was not covered by tests
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
Diagonal(inv.(A.diag))

Check warning on line 713 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L713

Added line #L713 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(cholesky!)}, A::Tridiagonal, b, u, Pl, Pr,

Check warning on line 715 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L715

Added line #L715 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.lu_instance(A)

Check warning on line 718 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L718

Added line #L718 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(cholesky!)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 720 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L720

Added line #L720 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 723 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L723

Added line #L723 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(cholesky)}, A::Diagonal, b, u, Pl, Pr, maxiters::Int,

Check warning on line 725 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L725

Added line #L725 was not covered by tests
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
Diagonal(inv.(A.diag))

Check warning on line 727 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L727

Added line #L727 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(cholesky)}, A::Tridiagonal, b, u, Pl, Pr,

Check warning on line 729 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L729

Added line #L729 was not covered by tests
maxiters::Int,
abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions)
ArrayInterface.lu_instance(A)

Check warning on line 732 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L732

Added line #L732 was not covered by tests
end
function init_cacheval(alg::GenericFactorization{typeof(cholesky)}, A::SymTridiagonal{T, V}, b, u, Pl, Pr,

Check warning on line 734 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L734

Added line #L734 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions) where {T, V}
LinearAlgebra.LDLt{T, SymTridiagonal{T, V}}(A)

Check warning on line 737 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L737

Added line #L737 was not covered by tests
end


function init_cacheval(alg::Union{GenericFactorization},
function init_cacheval(alg::GenericFactorization,

Check warning on line 741 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L741

Added line #L741 was not covered by tests
A::Union{Hermitian{T, <:SparseMatrixCSC},
Symmetric{T, <:SparseMatrixCSC}}, b, u, Pl, Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
Expand Down Expand Up @@ -1242,37 +1318,44 @@ function FastQRFactorization()
end

@static if VERSION < v"1.7beta"
function init_cacheval(alg::FastQRFactorization{Val{false}}, A, b, u, Pl, Pr,
function init_cacheval(alg::FastQRFactorization{Val{false}}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 1321 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L1321

Added line #L1321 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
ws = QRWYWs(A; blocksize = alg.blocksize)
return WorkspaceAndFactors(ws,
ArrayInterface.qr_instance(convert(AbstractMatrix, A)))
ArrayInterface.qr_instance(A))
end

function init_cacheval(::FastQRFactorization{Val{true}}, A, b, u, Pl, Pr,
function init_cacheval(::FastQRFactorization{Val{true}}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 1329 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L1329

Added line #L1329 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
ws = QRpWs(A)
return WorkspaceAndFactors(ws,
ArrayInterface.qr_instance(convert(AbstractMatrix, A)))
ArrayInterface.qr_instance(A))
end
else
function init_cacheval(alg::FastQRFactorization{NoPivot}, A, b, u, Pl, Pr,
function init_cacheval(alg::FastQRFactorization{NoPivot}, A::AbstractMatrix, b, u, Pl, Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
ws = QRWYWs(A; blocksize = alg.blocksize)
return WorkspaceAndFactors(ws,
ArrayInterface.qr_instance(convert(AbstractMatrix, A)))
ArrayInterface.qr_instance(A))
end
function init_cacheval(::FastQRFactorization{ColumnNorm}, A, b, u, Pl, Pr,
function init_cacheval(::FastQRFactorization{ColumnNorm}, A::AbstractMatrix, b, u, Pl, Pr,

Check warning on line 1344 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L1344

Added line #L1344 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
ws = QRpWs(A)
return WorkspaceAndFactors(ws,
ArrayInterface.qr_instance(convert(AbstractMatrix, A)))
ArrayInterface.qr_instance(A))
end
end
function init_cacheval(alg::FastQRFactorization, A, b, u, Pl, Pr,

Check warning on line 1352 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L1352

Added line #L1352 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
return init_cacheval(alg, convert(AbstractMatrix, A), b, u, Pl, Pr,

Check warning on line 1355 in src/factorization.jl

View check run for this annotation

Codecov / codecov/patch

src/factorization.jl#L1355

Added line #L1355 was not covered by tests
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
end

function SciMLBase.solve!(cache::LinearCache, alg::FastQRFactorization{P};
kwargs...) where {P}
Expand Down Expand Up @@ -1380,4 +1463,4 @@ for alg in InteractiveUtils.subtypes(AbstractFactorization)
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
end
end
end

0 comments on commit d80fade

Please sign in to comment.