Skip to content

Commit ac88cc4

Browse files
committed
Fix obsolete and inconsistent supports_inplace(::AbstractVector})
As pointed out by GitHub Copilot in code review
1 parent 891196a commit ac88cc4

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/interfaces/supports_inplace.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,16 @@ considerable performance issues
4040
should support in-place operations.
4141
"""
4242
supports_inplace(::Type{<:Vector{ComplexF64}}) = true
43-
supports_inplace(::Type{T}) where {T<:AbstractVector} = ismutabletype(T) # fallback
44-
# The fallback doesn't actually guarantee that the required interface implied
45-
# by `supports_inplace` is fulfilled, but it's a reasonable expectation to
46-
# have, and the `check_state` function will test it.
4743

4844
supports_inplace(::Type{<:Matrix}) = true
4945
supports_inplace(::Type{<:Operator}) = true
5046
supports_inplace(::Type{<:LinearAlgebra.Diagonal}) = true
5147
supports_inplace(::Type{<:SparseMatrixCSC}) = true # XXX is this a good idea?
5248
supports_inplace(::Type{<:ScaledOperator{<:Any,OT}}) where {OT} = supports_inplace(OT)
49+
50+
# Fallback (both for operators and states)
5351
supports_inplace(::Type{T}) where {T<:AbstractArray} =
54-
ArrayInterface.ismutable(T) && ArrayInterface.fast_scalar_indexing(T) # fallback
52+
ArrayInterface.ismutable(T) && ArrayInterface.fast_scalar_indexing(T)
5553

5654
# Generic catch-all for types without a specific method (prevents StackOverflow
5755
# from the value→type fallback below)

0 commit comments

Comments
 (0)