Skip to content

Commit 9fff016

Browse files
Simplify QobEvo creation and time evolution (#477)
1 parent 5e41ed3 commit 9fff016

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

src/qobj/quantum_object_evo.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,17 +440,8 @@ end
440440

441441
_promote_to_scimloperator(data::AbstractMatrix) = MatrixOperator(data)
442442
_promote_to_scimloperator(data::AbstractSciMLOperator) = data
443-
# TODO: The following special cases can be simplified after
444-
# https://github.com/SciML/SciMLOperators.jl/pull/264 is merged
445443
_promote_to_scimloperator::Number, data::AbstractMatrix) = MatrixOperator* data)
446-
function _promote_to_scimloperator::Number, data::MatrixOperator)
447-
isconstant(data) && return MatrixOperator* data.A)
448-
return ScaledOperator(α, data) # Going back to the generic case
449-
end
450-
function _promote_to_scimloperator::Number, data::ScaledOperator)
451-
isconstant(data.λ) && return ScaledOperator* data.λ, data.L)
452-
return ScaledOperator(data.λ, _promote_to_scimloperator(α, data.L)) # Try to propagate the rule
453-
end
444+
# We still have to define this for AddedOperator, as it is not present in SciMLOperators.jl
454445
function _promote_to_scimloperator::Number, data::AddedOperator)
455446
return AddedOperator(_promote_to_scimloperator.(α, data.ops)) # Try to propagate the rule
456447
end

src/time_evolution/mesolve.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,7 @@ function mesolveProblem(
9797

9898
tspan = (tlist[1], tlist[end])
9999

100-
# TODO: Remove this when https://github.com/SciML/SciMLSensitivity.jl/issues/1181 is fixed
101-
if haskey(kwargs3, :sensealg)
102-
prob = ODEProblem{getVal(inplace)}(L, ρ0, tspan, params; kwargs3...)
103-
else
104-
prob = ODEProblem{getVal(inplace),FullSpecialize}(L, ρ0, tspan, params; kwargs3...)
105-
end
100+
prob = ODEProblem{getVal(inplace),FullSpecialize}(L, ρ0, tspan, params; kwargs3...)
106101

107102
return TimeEvolutionProblem(prob, tlist, L_evo.dimensions, (isoperket = Val(isoperket(ψ0)),))
108103
end

src/time_evolution/sesolve.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@ function sesolveProblem(
7676

7777
tspan = (tlist[1], tlist[end])
7878

79-
# TODO: Remove this when https://github.com/SciML/SciMLSensitivity.jl/issues/1181 is fixed
80-
if haskey(kwargs3, :sensealg)
81-
prob = ODEProblem{getVal(inplace)}(U, ψ0, tspan, params; kwargs3...)
82-
else
83-
prob = ODEProblem{getVal(inplace),FullSpecialize}(U, ψ0, tspan, params; kwargs3...)
84-
end
79+
prob = ODEProblem{getVal(inplace),FullSpecialize}(U, ψ0, tspan, params; kwargs3...)
8580

8681
return TimeEvolutionProblem(prob, tlist, H_evo.dimensions)
8782
end

0 commit comments

Comments
 (0)