Skip to content

Commit c265b77

Browse files
committed
Merge branch 'main' into liouvillian
2 parents b6aec62 + b68373b commit c265b77

33 files changed

+751
-132
lines changed

.github/workflows/CI.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ jobs:
5656

5757
include:
5858
# for core tests (intermediate versions)
59-
# - version: '1.x'
60-
# node:
61-
# os: 'ubuntu-latest'
62-
# arch: 'x64'
63-
# group: 'Core'
59+
- version: '1.11'
60+
node:
61+
os: 'ubuntu-latest'
62+
arch: 'x64'
63+
group: 'Core'
6464

6565
# for extension tests
6666
- version: '1'
6767
node:
6868
os: 'ubuntu-latest'
6969
arch: 'x64'
7070
group: 'Makie_Ext'
71-
- version: '1'
71+
- version: '1.11'
7272
node:
7373
os: 'ubuntu-latest'
7474
arch: 'x64'

.github/workflows/CleanPreviewDoc.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,62 @@ name: Cleanup Preview Documentation
33
on:
44
pull_request:
55
types: [closed]
6+
schedule:
7+
- cron: "0 0 * * 0" # Run weekly on Sunday at midnight
8+
workflow_dispatch:
69

710
permissions:
811
contents: write
9-
deployments: write
1012

1113
jobs:
1214
cleanup-preview-doc:
1315
runs-on: ubuntu-latest
1416
steps:
1517
- name: Checkout gh-pages branch
16-
uses: actions/checkout@v5
18+
uses: actions/checkout@v4
1719
with:
1820
ref: gh-pages
19-
- name: Delete preview and history + push changes
21+
- name: Delete preview(s) and reset history
2022
run: |
21-
if [ -d "previews/PR$PRNUM" ]; then
23+
# If triggered by PR close, delete that specific preview
24+
if [ "${{ github.event_name }}" = "pull_request" ]; then
25+
PRNUM=${{ github.event.number }}
26+
if [ -d "previews/PR$PRNUM" ]; then
27+
echo "Deleting preview for PR #$PRNUM"
28+
git rm -rf "previews/PR$PRNUM"
29+
fi
30+
else
31+
# Scheduled/manual run: check all previews against open PRs
32+
echo "Checking all preview folders for stale PRs..."
33+
34+
# Get list of all PR preview folders
35+
if [ -d "previews" ]; then
36+
for dir in previews/PR*; do
37+
[ -d "$dir" ] || continue
38+
PRNUM=$(echo "$dir" | grep -oP 'PR\K\d+')
39+
40+
# Check if PR is still open via GitHub API
41+
STATUS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
42+
"https://api.github.com/repos/${{ github.repository }}/pulls/$PRNUM" \
43+
| jq -r '.state // "closed"')
44+
45+
if [ "$STATUS" != "open" ]; then
46+
echo "Deleting stale preview for closed PR #$PRNUM"
47+
git rm -rf "$dir"
48+
fi
49+
done
50+
fi
51+
fi
52+
53+
# Only commit and push if there are changes
54+
if ! git diff --cached --quiet; then
2255
git config user.name "Documenter.jl"
2356
git config user.email "[email protected]"
24-
git rm -rf "previews/PR$PRNUM"
25-
git commit -m "delete preview"
57+
git commit -m "delete preview(s)"
2658
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
2759
git push --force origin gh-pages-new:gh-pages
60+
else
61+
echo "No stale previews found"
2862
fi
2963
env:
3064
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
PRNUM: ${{ github.event.number }}

.github/workflows/SpellCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
- name: Checkout Actions Repository
1111
uses: actions/checkout@v5
1212
- name: Check spelling
13-
uses: crate-ci/typos@v1.36.3
13+
uses: crate-ci/typos@v1.37.2

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- uses: actions/checkout@v5
4747
- uses: julia-actions/setup-julia@v2
4848
with:
49-
version: '1'
49+
version: '1.11'
5050
- uses: julia-actions/cache@v2
5151
- uses: julia-actions/julia-buildpkg@v1
5252
- uses: julia-actions/julia-docdeploy@v1

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- Generalize the definition of `liouvillian`. It no longer expects the Hamiltonian to be Hermitian. ([#541])
1111

12+
## [v0.37.0]
13+
Release date: 2025-10-12
14+
15+
- Fix `cite()` bibtex output. ([#552])
16+
- Implement `sesolve_map` and `mesolve_map` for solving multiple initial states and parameter sets in parallel. ([#554])
17+
- Add `qeye_like` and `qzero_like`, which are synonyms of `one` and `zero`. ([#555])
18+
- Add steadystate and DSF benchmarks. The `SteadyStateODESOlver` tolerances are lowered to `terminate_reltol=1e-4` and `terminate_abstol=1e-6` to improve speed at the cost of accuracy. ([#557])
19+
1220
## [v0.36.0]
1321
Release date: 2025-09-29
1422

@@ -232,6 +240,7 @@ Release date: 2024-11-13
232240
[v0.34.1]: https://github.com/qutip/QuantumToolbox.jl/releases/tag/v0.34.1
233241
[v0.35.0]: https://github.com/qutip/QuantumToolbox.jl/releases/tag/v0.35.0
234242
[v0.36.0]: https://github.com/qutip/QuantumToolbox.jl/releases/tag/v0.36.0
243+
[v0.37.0]: https://github.com/qutip/QuantumToolbox.jl/releases/tag/v0.37.0
235244
[#86]: https://github.com/qutip/QuantumToolbox.jl/issues/86
236245
[#139]: https://github.com/qutip/QuantumToolbox.jl/issues/139
237246
[#271]: https://github.com/qutip/QuantumToolbox.jl/issues/271
@@ -326,3 +335,7 @@ Release date: 2024-11-13
326335
[#541]: https://github.com/qutip/QuantumToolbox.jl/issues/541
327336
[#544]: https://github.com/qutip/QuantumToolbox.jl/issues/544
328337
[#546]: https://github.com/qutip/QuantumToolbox.jl/issues/546
338+
[#552]: https://github.com/qutip/QuantumToolbox.jl/issues/552
339+
[#554]: https://github.com/qutip/QuantumToolbox.jl/issues/554
340+
[#555]: https://github.com/qutip/QuantumToolbox.jl/issues/555
341+
[#557]: https://github.com/qutip/QuantumToolbox.jl/issues/557

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuantumToolbox"
22
uuid = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
33
authors = ["Alberto Mercurio", "Yi-Te Huang"]
4-
version = "0.36.0"
4+
version = "0.37.0"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

benchmarks/Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[deps]
22
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3-
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
4-
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
53
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
4+
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
function benchmark_dsf!(SUITE)
2+
F = 2
3+
Δ = 0.25
4+
κ = 1
5+
U = 0.01
6+
J = 0.5
7+
tlist = LinRange(0, 15, 300)
8+
9+
N = 5
10+
a1 = kron(destroy(N), qeye(N))
11+
a2 = kron(qeye(N), destroy(N))
12+
function H_dsf(op_list, p)
13+
Δ = p.Δ
14+
F = p.F
15+
U = p.U
16+
J = p.J
17+
a1, a2 = op_list
18+
return Δ * a1' * a1 +
19+
Δ * a2' * a2 +
20+
U * a1'^2 * a1^2 +
21+
U * a2'^2 * a2^2 +
22+
F * (a1 + a1') +
23+
J * (a1' * a2 + a1 * a2')
24+
end
25+
function c_ops_dsf(op_list, p)
26+
κ = p.κ
27+
a1, a2 = op_list
28+
return [κ * a1, κ * a2]
29+
end
30+
function e_ops_dsf(op_list, p)
31+
a1, a2 = op_list
32+
return [a1' * a1, a2' * a2]
33+
end
34+
op_list = [a1, a2]
35+
ψ0 = kron(fock(N, 0), fock(N, 0))
36+
α0 = 1.5
37+
α0_l = [α0, α0]
38+
dsf_params == Δ, F = F, κ = κ, U = U, J = J)
39+
40+
SUITE["Time Evolution"]["Dynamical Shifted Fock"]["mesolve"] = @benchmarkable dsf_mesolve(
41+
$H_dsf,
42+
$ψ0,
43+
$tlist,
44+
$c_ops_dsf,
45+
$op_list,
46+
$α0_l,
47+
$dsf_params,
48+
e_ops = $e_ops_dsf,
49+
progress_bar = Val(false),
50+
)
51+
52+
SUITE["Time Evolution"]["Dynamical Shifted Fock"]["mcsolve"]["Serial"] = @benchmarkable dsf_mcsolve(
53+
$H_dsf,
54+
$ψ0,
55+
$tlist,
56+
$c_ops_dsf,
57+
$op_list,
58+
$α0_l,
59+
$dsf_params,
60+
ntraj = 100,
61+
e_ops = $e_ops_dsf,
62+
progress_bar = Val(false),
63+
ensemblealg = EnsembleSerial(),
64+
)
65+
66+
SUITE["Time Evolution"]["Dynamical Shifted Fock"]["mcsolve"]["Multithreaded"] = @benchmarkable dsf_mcsolve(
67+
$H_dsf,
68+
$ψ0,
69+
$tlist,
70+
$c_ops_dsf,
71+
$op_list,
72+
$α0_l,
73+
$dsf_params,
74+
ntraj = 100,
75+
e_ops = $e_ops_dsf,
76+
progress_bar = Val(false),
77+
ensemblealg = EnsembleThreads(),
78+
)
79+
80+
return nothing
81+
end

benchmarks/runbenchmarks.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@ using BenchmarkTools
22
using LinearAlgebra
33
using SparseArrays
44
using QuantumToolbox
5-
using OrdinaryDiffEq
6-
using LinearSolve
5+
using SciMLBase: EnsembleSerial, EnsembleThreads
76

87
BLAS.set_num_threads(1)
98

109
const SUITE = BenchmarkGroup()
1110

1211
include("correlations_and_spectrum.jl")
1312
include("dynamical_fock_dimension.jl")
13+
include("dynamical_shifted_fock.jl")
1414
include("eigenvalues.jl")
1515
include("steadystate.jl")
1616
include("timeevolution.jl")
1717

1818
benchmark_correlations_and_spectrum!(SUITE)
1919
benchmark_dfd!(SUITE)
20+
benchmark_dsf!(SUITE)
2021
benchmark_eigenvalues!(SUITE)
2122
benchmark_steadystate!(SUITE)
2223
benchmark_timeevolution!(SUITE)

benchmarks/steadystate.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@ function benchmark_steadystate!(SUITE)
1111

1212
SUITE["Steadystate"]["Direct"] = @benchmarkable steadystate($H, $c_ops)
1313

14+
SUITE["Steadystate"]["Iterative"] = @benchmarkable steadystate($H, $c_ops; solver = SteadyStateLinearSolver())
15+
16+
SUITE["Steadystate"]["ODE"] = @benchmarkable steadystate($H, $c_ops; solver = SteadyStateODESolver())
17+
1418
return nothing
1519
end

0 commit comments

Comments
 (0)