You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@inlinefunction Base.copyto!(dest::DataOperator{BL,BR}, bc::Broadcast.Broadcasted{Style,Axes,F,Args}) where {BL,BR,Style<:DataOperatorStyle{BL,BR},Axes,F,Args}
@inline Base.copyto!(dest::Bra{B1}, bc::Broadcast.Broadcasted{Style,Axes,F,Args}) where {B1,B2,Style<:BraStyle{B2},Axes,F,Args} =
251
244
throw(IncompatibleBases())
252
245
253
-
@inline Base.copyto!(A::T,B::T) where T<:Union{Ket, Bra}= (copyto!(A.data,B.data); A) # Can not use T<:QuantumInterface.StateVector, because StateVector does not imply the existence of a data property
246
+
@inline Base.copyto!(dest::T,src::T) where {T<:Union{Ket, Bra}} = (copyto!(dest.data,src.data); dest) # Can not use T<:QuantumInterface.StateVector, because StateVector does not imply the existence of a data property
247
+
248
+
# A few more standard interfaces: These do not necessarily make sense for a StateVector, but enable transparent use of DifferentialEquations.jl
249
+
Base.eltype(::Type{Ket{B,A}}) where {B,N,A<:AbstractVector{N}} = N # ODE init
250
+
Base.eltype(::Type{Bra{B,A}}) where {B,N,A<:AbstractVector{N}} = N
251
+
Base.any(f::Function, x::T; kwargs...) where {T<:Union{Ket, Bra}} =any(f, x.data; kwargs...) # ODE nan checks
252
+
Base.all(f::Function, x::T; kwargs...) where {T<:Union{Ket, Bra}} =all(f, x.data; kwargs...)
253
+
Base.fill!(x::T, a) where {T<:Union{Ket, Bra}} =typeof(x)(x.basis, fill!(x.data, a))
254
+
Base.similar(x::T, t) where {T<:Union{Ket, Bra}} =typeof(x)(x.basis, similar(x.data))
255
+
RecursiveArrayTools.recursivecopy!(dest::Ket{B,A},src::Ket{B,A}) where {B,A} =copyto!(dest, src) # ODE in-place equations
256
+
RecursiveArrayTools.recursivecopy!(dest::Bra{B,A},src::Bra{B,A}) where {B,A} =copyto!(dest, src)
257
+
RecursiveArrayTools.recursivecopy(x::T) where {T<:Union{Ket, Bra}} =copy(x)
258
+
RecursiveArrayTools.recursivecopy(x::AbstractArray{T}) where {T<:Union{Ket, Bra}} =copy(x)
259
+
RecursiveArrayTools.recursivefill!(x::T, a) where {T<:Union{Ket, Bra}} =fill!(x, a)
0 commit comments