Skip to content

Commit 356d684

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

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/interfaces/supports_inplace.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,24 @@ similar "traits": When using [custom structs](@extref Julia
3232
operators, even if those structs are not defined as `mutable`, they may still
3333
define the in-place interface (typically because their *components* are
3434
mutable). Conversely, even types that are "mutable" may want to opt out
35-
`evaluate!` for performance reasons.
35+
of `evaluate!` for performance reasons.
3636
3737
Mutable abstract arrays ([`ArrayInterface.ismutable`](@extref)) without
3838
considerable performance issues
3939
([`ArrayInterface.fast_scalar_indexing`](@extref))
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)