File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,6 +201,13 @@ function Base.iterate(O::Operator, k = 1)
201201 return (O[i, j], k + 1 )
202202end
203203
204+
205+ # We define `similar` to return a standard `Array` because `Operator` does not
206+ # implement `setindex!`. So it it questionable to what extent returning an
207+ # `Operator` would create an "uninitialized _mutable_ array". It would be
208+ # possible to apply `similar` recursively and get something that at least we
209+ # can `copyto!`. However, there is currently nothing in the JuliaQuantumControl
210+ # codebase that would require this, so we're leaving that for a later time.
204211Base. similar (O:: Operator ) = Array {eltype(O)} (undef, size (O))
205212Base. similar (O:: Operator , :: Type{S} ) where {S} = Array {S} (undef, size (O))
206213Base. similar (O:: Operator , dims:: Tuple{Vararg{Int}} ) = Array {eltype(O)} (undef, dims)
You can’t perform that action at this time.
0 commit comments