Skip to content

Commit

Permalink
EnumX --> Symbol is slow
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Feb 13, 2024
1 parent 6fd247c commit b6bd5f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function defaultalg(A, b, assump::OperatorAssumptions{Bool})
DefaultLinearSolver(alg)
end

@inline algchoice_to_alg(::Val{alg}) where {alg} = algchoice_to_alg(alg)

Check warning on line 221 in src/default.jl

View check run for this annotation

Codecov / codecov/patch

src/default.jl#L221

Added line #L221 was not covered by tests
function algchoice_to_alg(alg::Symbol)
if alg === :SVDFactorization
SVDFactorization(false, LinearAlgebra.QRIteration())
Expand Down Expand Up @@ -345,11 +346,12 @@ end
retcode = sol.retcode,
iters = sol.iters, stats = sol.stats)
end
alg_enum = getproperty(LinearSolve.DefaultAlgorithmChoice, alg)
ex = if ex == :()
Expr(:elseif, :(Symbol(alg.alg) === $(Meta.quot(alg))), newex,
Expr(:elseif, :(alg.alg == $(alg_enum)), newex,
:(error("Algorithm Choice not Allowed")))
else
Expr(:elseif, :(Symbol(alg.alg) === $(Meta.quot(alg))), newex, ex)
Expr(:elseif, :(alg.alg == $(alg_enum)), newex, ex)
end
end
ex = Expr(:if, ex.args...)
Expand Down

0 comments on commit b6bd5f5

Please sign in to comment.