Skip to content

Commit e2c6d3e

Browse files
github-actions[bot]CompatHelper JuliaytdHuangalbertomercurio
authored
CompatHelper: bump compat for SciMLOperators to 1, (keep existing compat) (#470)
Co-authored-by: CompatHelper Julia <compathelper_noreply@julialang.org> Co-authored-by: Yi-Te Huang <44385685+ytdHuang@users.noreply.github.com> Co-authored-by: Yi-Te Huang <y.t.d.huang@phys.ncku.edu.tw> Co-authored-by: Alberto Mercurio <alberto.mercurio96@gmail.com>
1 parent 7a6cc50 commit e2c6d3e

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased](https://github.com/qutip/QuantumToolbox.jl/tree/main)
99

1010
- Improve efficiency of `bloch_redfield_tensor` by avoiding unnecessary conversions. ([#509])
11+
- Support `SciMLOperators v1.4+`. ([#470])
1112

1213
## [v0.33.0]
1314
Release date: 2025-07-22
@@ -255,6 +256,7 @@ Release date: 2024-11-13
255256
[#455]: https://github.com/qutip/QuantumToolbox.jl/issues/455
256257
[#456]: https://github.com/qutip/QuantumToolbox.jl/issues/456
257258
[#460]: https://github.com/qutip/QuantumToolbox.jl/issues/460
259+
[#470]: https://github.com/qutip/QuantumToolbox.jl/issues/470
258260
[#472]: https://github.com/qutip/QuantumToolbox.jl/issues/472
259261
[#473]: https://github.com/qutip/QuantumToolbox.jl/issues/473
260262
[#476]: https://github.com/qutip/QuantumToolbox.jl/issues/476

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ KernelAbstractions = "0.9.2"
5555
LaTeXStrings = "1.2"
5656
LinearAlgebra = "1"
5757
LinearSolve = "2, 3"
58-
Makie = "0.20, 0.21, 0.22, 0.23, 0.24"
58+
Makie = "0.20, 0.21, 0.22, 0.23"
5959
OrdinaryDiffEqCore = "1"
6060
OrdinaryDiffEqTsit5 = "1"
6161
Pkg = "1"
6262
Random = "1"
6363
SciMLBase = "2"
64-
SciMLOperators = "0.3, 0.4"
64+
SciMLOperators = "1.4"
6565
SparseArrays = "1"
6666
SpecialFunctions = "2"
6767
StaticArraysCore = "1"

src/QuantumToolbox.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import SciMLBase:
1616
u_modified!,
1717
NullParameters,
1818
ODEFunction,
19+
SDEFunction,
1920
ODEProblem,
2021
SDEProblem,
2122
EnsembleProblem,

src/qobj/quantum_object_evo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ function (A::QuantumObjectEvolution)(
512512
)
513513
end
514514

515-
A.data(ψout.data, ψin.data, p, t)
515+
A.data(ψout.data, ψin.data, nothing, p, t)
516516

517517
return ψout
518518
end

src/time_evolution/time_evolution.jl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -395,40 +395,37 @@ end
395395
396396
A struct to represent the diffusion operator. This is used to perform the diffusion process on N different Wiener processes.
397397
=#
398-
struct DiffusionOperator{T,OpType<:Tuple{Vararg{AbstractSciMLOperator}}} <: AbstractSciMLOperator{T}
398+
struct DiffusionOperator{T,OpType<:Tuple{Vararg{AbstractSciMLOperator}}}
399399
ops::OpType
400400
function DiffusionOperator(ops::OpType) where {OpType}
401401
T = mapreduce(eltype, promote_type, ops)
402402
return new{T,OpType}(ops)
403403
end
404404
end
405405

406-
@generated function update_coefficients!(L::DiffusionOperator, u, p, t)
407-
ops_types = L.parameters[2].parameters
408-
N = length(ops_types)
409-
return quote
410-
Base.@nexprs $N i -> begin
411-
update_coefficients!(L.ops[i], u, p, t)
412-
end
413-
414-
nothing
415-
end
416-
end
417-
418-
@generated function LinearAlgebra.mul!(v::AbstractVecOrMat, L::DiffusionOperator, u::AbstractVecOrMat)
406+
@generated function (L::DiffusionOperator)(w, v, p, t)
419407
ops_types = L.parameters[2].parameters
420408
N = length(ops_types)
421409
quote
422-
M = length(u)
423-
S = (size(v, 1), size(v, 2)) # This supports also `v` as a `Vector`
410+
M = length(v)
411+
S = (size(w, 1), size(w, 2)) # This supports also `w` as a `Vector`
424412
(S[1] == M && S[2] == $N) || throw(DimensionMismatch("The size of the output vector is incorrect."))
425413
Base.@nexprs $N i -> begin
426-
mul!(@view(v[:, i]), L.ops[i], u)
414+
op = L.ops[i]
415+
op(@view(w[:, i]), v, v, p, t)
427416
end
428-
return v
417+
return w
429418
end
430419
end
431420

421+
#TODO: Remove when a new release of SciMLBase.jl >2.104.0 is available
422+
(f::SDEFunction)(du, u, p, t) =
423+
if f.f isa AbstractSciMLOperator
424+
f.f(du, u, u, p, t)
425+
else
426+
f.f(du, u, p, t)
427+
end
428+
432429
#######################################
433430

434431
function liouvillian_floquet(

test/core-test/time_evolution.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ end
484484
H = TESetup.H
485485
ψ0 = TESetup.ψ0
486486
tlist = TESetup.tlist
487-
c_ops = TESetup.c_ops
488487
c_ops_sme = TESetup.c_ops_sme
489488
sc_ops_sme = TESetup.sc_ops_sme
490489
c_ops_sme2 = TESetup.c_ops_sme2

0 commit comments

Comments
 (0)