Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name = "QuantumOptics"
uuid = "6e0679c1-51ea-5a7c-ac74-d61b76210b0c"
version = "1.2.3"
version = "1.2.4"

[deps]
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Expand All @@ -18,13 +17,13 @@ QuantumOpticsBase = "4f57444f-1401-5e15-980d-4471b28d5678"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
WignerSymbols = "9f57e263-0b3d-5e2e-b1be-24f2bb48858b"

[compat]
Arpack = "0.5.1 - 0.5.3"
DiffEqBase = "6.162"
DiffEqCallbacks = "2, 3, 4"
DiffEqNoiseProcess = "5.23.0"
FFTW = "1"
Expand All @@ -38,6 +37,7 @@ QuantumOpticsBase = "0.5.9"
Random = "1.10"
RecursiveArrayTools = "2, 3"
Reexport = "0.2, 1.0"
SciMLBase = "2.114"
SparseArrays = "1.10"
StochasticDiffEq = "6.76.0"
WignerSymbols = "1, 2"
Expand Down
30 changes: 15 additions & 15 deletions src/timeevolution_base.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using QuantumOpticsBase
using QuantumOpticsBase: check_samebases, check_multiplicable

import OrdinaryDiffEqCore, OrdinaryDiffEqLowOrderRK, DiffEqCallbacks, DiffEqBase
import OrdinaryDiffEqCore, OrdinaryDiffEqLowOrderRK, DiffEqCallbacks, SciMLBase

function recast! end

Expand Down Expand Up @@ -128,18 +128,18 @@ function _promote_time_and_state(u0, H::AbstractOperator, tspan)
Ts = eltype(H)
Tt = real(Ts)
p = Vector{Tt}(undef,0)
u0_promote = DiffEqBase.promote_u0(u0, p, tspan[1])
tspan_promote = DiffEqBase.promote_tspan(u0_promote.data, p, tspan, nothing, Dict{Symbol, Any}())
u0_promote = SciMLBase.promote_u0(u0, p, tspan[1])
tspan_promote = SciMLBase.promote_tspan(u0_promote.data, p, tspan, nothing, Dict{Symbol, Any}())
return tspan_promote, u0_promote
end
function _promote_time_and_state(u0, H::AbstractOperator, J, tspan)
Ht = eltype(H)
Jt = DiffEqBase.anyeltypedual(J) # finds dual eltype in J, otherwise returns Any
Jt = SciMLBase.anyeltypedual(J) # finds dual eltype in J, otherwise returns Any
# ForwardDiff doesn't promote ForwardDiff.Dual over julia Base number types, but we want to promote
# duals with DiffEq operations without using DiffEqBase.promote_dual in ext/DiffEqBaseForwardDiffExt.jl,
# duals with DiffEq operations without using SciMLBase.promote_dual in ext/SciMLBaseForwardDiffExt.jl,
# so we have to tread carefully here
if DiffEqBase.isdualtype(Jt)
if DiffEqBase.isdualtype(Ht)
if SciMLBase.isdualtype(Jt)
if SciMLBase.isdualtype(Ht)
Ts = promote_type(Ht, Jt)
else
Ts = Jt
Expand All @@ -149,31 +149,31 @@ function _promote_time_and_state(u0, H::AbstractOperator, J, tspan)
end
Tt = real(Ts)
p = Vector{Tt}(undef,0)
u0_promote = DiffEqBase.promote_u0(u0, p, tspan[1])
tspan_promote = DiffEqBase.promote_tspan(u0_promote.data, p, tspan, nothing, Dict{Symbol, Any}())
u0_promote = SciMLBase.promote_u0(u0, p, tspan[1])
tspan_promote = SciMLBase.promote_tspan(u0_promote.data, p, tspan, nothing, Dict{Symbol, Any}())
return tspan_promote, u0_promote
end

_promote_time_and_state(u0, f, tspan) = _promote_time_and_state(u0, f(first(tspan)..., u0), tspan)

@inline function DiffEqBase.promote_u0(u0::Ket, p, t0)
u0data_promote = DiffEqBase.promote_u0(u0.data, p, t0)
@inline function SciMLBase.promote_u0(u0::Ket, p, t0)
u0data_promote = SciMLBase.promote_u0(u0.data, p, t0)
if u0data_promote !== u0.data
u0_promote = Ket(u0.basis, u0data_promote)
return u0_promote
end
return u0
end
@inline function DiffEqBase.promote_u0(u0::Bra, p, t0)
u0data_promote = DiffEqBase.promote_u0(u0.data, p, t0)
@inline function SciMLBase.promote_u0(u0::Bra, p, t0)
u0data_promote = SciMLBase.promote_u0(u0.data, p, t0)
if u0data_promote !== u0.data
u0_promote = Bra(u0.basis, u0data_promote)
return u0_promote
end
return u0
end
@inline function DiffEqBase.promote_u0(u0::Operator, p, t0)
u0data_promote = DiffEqBase.promote_u0(u0.data, p, t0)
@inline function SciMLBase.promote_u0(u0::Operator, p, t0)
u0data_promote = SciMLBase.promote_u0(u0.data, p, t0)
if u0data_promote !== u0.data
u0_promote = Operator(u0.basis_l, u0.basis_r, u0data_promote)
return u0_promote
Expand Down
Loading