Skip to content

Commit

Permalink
Change typeof(x) <: y to x isa y
Browse files Browse the repository at this point in the history
  • Loading branch information
Pepijn de Vos committed Nov 2, 2023
1 parent dbd631f commit 68152be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ext/LinearSolveEnzymeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ end
function EnzymeCore.EnzymeRules.reverse(config, func::Const{typeof(LinearSolve.solve!)}, ::Type{RT}, cache, linsolve::EnzymeCore.Annotation{LP}; kwargs...) where {RT, LP <: LinearSolve.LinearCache}
y, dys, _linsolve, dAs, dbs = cache

@assert !(typeof(linsolve) <: Const)
@assert !(typeof(linsolve) <: Active)
@assert !(linsolve isa Const)
@assert !(linsolve isa Active)

if EnzymeRules.width(config) == 1
dys = (dys,)
Expand Down
2 changes: 1 addition & 1 deletion ext/LinearSolveIterativeSolversExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function LinearSolve.init_cacheval(alg::IterativeSolversJL, A, b, u, Pl, Pr, max
end

function SciMLBase.solve!(cache::LinearCache, alg::IterativeSolversJL; kwargs...)
if cache.isfresh || !(typeof(alg) <: IterativeSolvers.GMRESIterable)
if cache.isfresh || !(alg isa IterativeSolvers.GMRESIterable)
solver = LinearSolve.init_cacheval(alg, cache.A, cache.b, cache.u, cache.Pl,
cache.Pr,
cache.maxiters, cache.abstol, cache.reltol,
Expand Down
2 changes: 1 addition & 1 deletion src/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ function init_cacheval(::SparspakFactorization, A, b, u, Pl, Pr, maxiters::Int,
reltol,
verbose::Bool, assumptions::OperatorAssumptions)
A = convert(AbstractMatrix, A)
if typeof(A) <: SparseArrays.AbstractSparseArray
if A isa SparseArrays.AbstractSparseArray
return sparspaklu(SparseMatrixCSC(size(A)..., getcolptr(A), rowvals(A),
nonzeros(A)),
factorize = false)
Expand Down

0 comments on commit 68152be

Please sign in to comment.