Skip to content

Commit 7304a8f

Browse files
committed
Merge branch 'main' into code-quality-Julia-1
2 parents c28ead9 + e412209 commit 7304a8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+243
-183
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- 'ext/**'
1111
- 'test/runtests.jl'
1212
- 'test/core-test/**'
13-
- 'test/ext-test/cairomakie/**'
13+
- 'test/ext-test/cpu/**'
1414
- 'Project.toml'
1515
pull_request:
1616
branches:
@@ -21,7 +21,7 @@ on:
2121
- 'ext/**'
2222
- 'test/runtests.jl'
2323
- 'test/core-test/**'
24-
- 'test/ext-test/cairomakie/**'
24+
- 'test/ext-test/cpu/**'
2525
- 'Project.toml'
2626
types:
2727
- opened

.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@v4
1212
- name: Check spelling
13-
uses: crate-ci/typos@v1.30.0
13+
uses: crate-ci/typos@v1.31.1

CHANGELOG.md

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

88
## [Unreleased](https://github.com/qutip/QuantumToolbox.jl/tree/main)
99

10+
- Make CUDA conversion more general using Adapt.jl. ([#436], [#437])
11+
- Make the generation of `fock` states non-mutating to support Zygote.jl. ([#438])
12+
- Remove Reexport.jl from the dependencies. ([#443])
13+
1014
## [v0.29.1]
1115
Release date: 2025-03-07
1216

@@ -187,3 +191,7 @@ Release date: 2024-11-13
187191
[#423]: https://github.com/qutip/QuantumToolbox.jl/issues/423
188192
[#428]: https://github.com/qutip/QuantumToolbox.jl/issues/428
189193
[#430]: https://github.com/qutip/QuantumToolbox.jl/issues/430
194+
[#436]: https://github.com/qutip/QuantumToolbox.jl/issues/436
195+
[#437]: https://github.com/qutip/QuantumToolbox.jl/issues/437
196+
[#438]: https://github.com/qutip/QuantumToolbox.jl/issues/438
197+
[#443]: https://github.com/qutip/QuantumToolbox.jl/issues/443

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
1818
OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a"
1919
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2020
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
21-
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2221
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
2322
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
2423
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
@@ -56,7 +55,6 @@ OrdinaryDiffEqCore = "1"
5655
OrdinaryDiffEqTsit5 = "1"
5756
Pkg = "1"
5857
Random = "1"
59-
Reexport = "1"
6058
SciMLBase = "2"
6159
SciMLOperators = "0.3"
6260
SparseArrays = "1"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ sol = mesolve(H_gpu, ψ0_gpu, tlist, c_ops, e_ops = e_ops)
167167

168168
## Performance comparison with other packages
169169

170-
Here we provide a brief performance comparison between `QuantumToolbox.jl` and other popular quantum physics simulation packages, such as [`QuTiP`](https://github.com/qutip/qutip) (Python), [`dynamiqs`](https://github.com/dynamiqs/dynamiqs) (Python - JAX) and [`QuantumOptics.jl`](https://github.com/qojulia/QuantumOptics.jl) (Julia). We clearly show that `QuantumToolbox.jl` is the fastest package among the four. A detailed code is available [here](https://github.com/albertomercurio/QuantumToolbox.jl-Paper-Figures/blob/main/src/benchmarks.jl).
170+
Here we provide a brief performance comparison between `QuantumToolbox.jl` and other popular quantum physics simulation packages, such as [`QuTiP`](https://github.com/qutip/qutip) (Python), [`dynamiqs`](https://github.com/dynamiqs/dynamiqs) (Python - JAX) and [`QuantumOptics.jl`](https://github.com/qojulia/QuantumOptics.jl) (Julia). We clearly show that `QuantumToolbox.jl` is the fastest package among the four. A detailed code is available [here](https://github.com/albertomercurio/QuantumToolbox.jl-Paper-Figures/blob/main/src/benchmarks/benchmarks.jl).
171171

172172
![](https://raw.githubusercontent.com/albertomercurio/QuantumToolbox.jl-Paper-Figures/refs/heads/main/figures/benchmarks.svg)
173173

benchmarks/runbenchmarks.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using BenchmarkTools
2+
using LinearAlgebra
3+
using SparseArrays
24
using QuantumToolbox
35
using OrdinaryDiffEq
46
using LinearSolve

docs/make.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ using Changelog
1010
# Load of packages required to compile the extension documentation
1111
using CairoMakie
1212

13-
DocMeta.setdocmeta!(QuantumToolbox, :DocTestSetup, :(using QuantumToolbox); recursive = true)
13+
doctest_setup = quote
14+
using LinearAlgebra
15+
using SparseArrays
16+
using QuantumToolbox
17+
end
18+
DocMeta.setdocmeta!(QuantumToolbox, :DocTestSetup, doctest_setup; recursive = true)
1419

1520
# some options for `makedocs`
1621
const DRAFT = false # set `true` to disable cell evaluation

docs/src/getting_started/type_stability.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Which returns a tensor of size `2x2x2x2x2x2`. Let's check the `@code_warntype`:
199199
@code_warntype reshape_operator_data([2, 2, 2])
200200
```
201201

202-
We got a `Any` type, because the compiler doesn't know the size of the `dims` vector. We can fix this by using a `Tuple` (or `SVector`):
202+
We got a `Any` type, because the compiler doesn't know the size of the `dims` vector. We can fix this by using a `Tuple` (or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl)):
203203

204204
```@example type-stability
205205
typeof(reshape_operator_data((2, 2, 2)))
@@ -219,13 +219,15 @@ Finally, let's look at the benchmarks
219219
@benchmark reshape_operator_data($((2, 2, 2)))
220220
```
221221

222-
Which is an innocuous but huge difference in terms of performance. Hence, we highly recommend using `Tuple` or `SVector` when defining the dimensions of a user-defined [`QuantumObject`](@ref).
222+
Which is an innocuous but huge difference in terms of performance. Hence, we highly recommend using `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) when defining the dimensions of a user-defined [`QuantumObject`](@ref).
223223

224224
## The use of `Val` in some `QuantumToolbox.jl` functions
225225

226226
In some functions of `QuantumToolbox.jl`, you may find the use of the [`Val`](https://docs.julialang.org/en/v1/base/base/#Base.Val) type in the arguments. This is a trick to pass a value at compile time, and it is very useful to avoid type instabilities. Let's make a very simple example, where we want to create a Fock state ``|j\rangle`` of a given dimension `N`, and we give the possibility to create it as a sparse or dense vector. At first, we can write the function without using `Val`:
227227

228228
```@example type-stability
229+
using SparseArrays
230+
229231
function my_fock(N::Int, j::Int = 0; sparse::Bool = false)
230232
if sparse
231233
array = sparsevec([j + 1], [1.0 + 0im], N)

docs/src/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,25 @@ using QuantumToolbox
7474
QuantumToolbox.versioninfo()
7575
QuantumToolbox.about()
7676
```
77+
78+
# [Other Useful Packages](@id doc:Other-Useful-Packages)
79+
80+
In order to get a better experience and take full advantage of `QuantumToolbox`, we recommend the following external packages:
81+
82+
- Standard `Julia` Libraries: (recommended to also `using` with `QuantumToolbox.jl`)
83+
- [`LinearAlgebra.jl`](https://github.com/JuliaLang/LinearAlgebra.jl)
84+
- [`SparseArrays.jl`](https://github.com/JuliaSparse/SparseArrays.jl)
85+
- Solver `alg`orithms:
86+
- [`DifferentialEquations.jl`](https://github.com/SciML/DifferentialEquations.jl) or [`OrdinaryDiffEq.jl`](https://github.com/SciML/OrdinaryDiffEq.jl)
87+
- [`LinearSolve.jl`](https://github.com/SciML/LinearSolve.jl)
88+
- GPU support:
89+
- [`CUDA.jl`](https://github.com/JuliaGPU/CUDA.jl)
90+
- Distributed Computing support:
91+
- [`Disributed.jl`](https://github.com/JuliaLang/Distributed.jl)
92+
- [`SlurmClusterManager.jl`](https://github.com/JuliaParallel/SlurmClusterManager.jl)
93+
- Plotting Libraries:
94+
- [`Makie.jl`](https://github.com/MakieOrg/Makie.jl)
95+
- Packages for other advanced usage:
96+
- [`StaticArrays.jl`](https://github.com/JuliaArrays/StaticArrays.jl)
97+
- [`SciMLOperators.jl`](https://github.com/SciML/SciMLOperators.jl)
98+
- [`DiffEqCallbacks.jl`](https://github.com/SciML/DiffEqCallbacks.jl)

docs/src/resources/api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
```@meta
22
CurrentModule = QuantumToolbox
3+
4+
DocTestSetup = quote
5+
using LinearAlgebra
6+
using SparseArrays
7+
using QuantumToolbox
8+
end
39
```
410

511
# [API](@id doc-API)

0 commit comments

Comments
 (0)