Skip to content

Commit 54145bf

Browse files
Remove Re-export (#443)
1 parent 6898156 commit 54145bf

25 files changed

+111
-102
lines changed

CHANGELOG.md

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

1010
- Make CUDA conversion more general using Adapt.jl. ([#436], [#437])
1111
- Make the generation of `fock` states non-mutating to support Zygote.jl. ([#438])
12+
- Remove Reexport.jl from the dependencies. ([#443])
1213

1314
## [v0.29.1]
1415
Release date: 2025-03-07
@@ -193,3 +194,4 @@ Release date: 2024-11-13
193194
[#436]: https://github.com/qutip/QuantumToolbox.jl/issues/436
194195
[#437]: https://github.com/qutip/QuantumToolbox.jl/issues/437
195196
[#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"

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/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)

docs/src/users_guide/QuantumObject/QuantumObject.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Qobj(rand(4, 4))
4545
M = rand(ComplexF64, 4, 4)
4646
Qobj(M, dims = [2, 2]) # dims as Vector
4747
Qobj(M, dims = (2, 2)) # dims as Tuple (recommended)
48+
49+
import QuantumToolbox: SVector # or using StaticArrays
4850
Qobj(M, dims = SVector(2, 2)) # dims as StaticArrays.SVector (recommended)
4951
```
5052

@@ -195,6 +197,8 @@ Vector{Int64}(v_d)
195197
```
196198

197199
```@example Qobj
200+
using SparseArrays
201+
198202
v_s = SparseVector(v_d)
199203
```
200204

docs/src/users_guide/QuantumObject/QuantumObject_functions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ Here is a table that summarizes all the supported linear algebra functions and a
4343

4444
- [`eigenenergies`](@ref): return eigenenergies (eigenvalues)
4545
- [`eigenstates`](@ref): return [`EigsolveResult`](@ref) (contains eigenvalues and eigenvectors)
46-
- [`eigvals`](@ref): return eigenvalues
47-
- [`eigen`](@ref): using dense eigen solver and return [`EigsolveResult`](@ref) (contains eigenvalues and eigenvectors)
4846
- [`eigsolve`](@ref): using sparse eigen solver and return [`EigsolveResult`](@ref) (contains eigenvalues and eigenvectors)
4947
- [`eigsolve_al`](@ref): using the Arnoldi-Lindblad eigen solver and return [`EigsolveResult`](@ref) (contains eigenvalues and eigenvectors)
5048

docs/src/users_guide/tensor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ H = 0.5 * ωa * σz + ωc * a' * a + g * (a' * σm + a * σm')
108108

109109
The partial trace is an operation that reduces the dimension of a Hilbert space by eliminating some degrees of freedom by averaging (tracing). In this sense it is therefore the converse of the tensor product. It is useful when one is interested in only a part of a coupled quantum system. For open quantum systems, this typically involves tracing over the environment leaving only the system of interest. In `QuantumToolbox` the function [`ptrace`](@ref) is used to take partial traces. [`ptrace`](@ref) takes one [`QuantumObject`](@ref) as an input, and also one argument `sel`, which marks the component systems that should be kept, and all the other components are traced out.
110110

111-
Remember that the index of `Julia` starts from `1`, and all the elements in `sel` should be positive `Integer`. Therefore, the type of `sel` can be either `Integer`, `Tuple`, `SVector`, or `Vector`.
111+
Remember that the index of `Julia` starts from `1`, and all the elements in `sel` should be positive `Integer`. Therefore, the type of `sel` can be either `Integer`, `Tuple`, `SVector` ([StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl)), or `Vector`.
112112

113113
!!! warning "Beware of type-stability!"
114114
Although it supports also `Vector` type, it is recommended to use `Tuple` or `SVector` from [`StaticArrays.jl`](https://github.com/JuliaArrays/StaticArrays.jl) to improve performance. For a brief explanation on the impact of the type of `sel`, see the section [The Importance of Type-Stability](@ref doc:Type-Stability).

ext/QuantumToolboxCUDAExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using QuantumToolbox: makeVal, getVal
55
import QuantumToolbox: _sparse_similar, _convert_eltype_wordsize
66
import CUDA: cu, CuArray, allowscalar
77
import CUDA.CUSPARSE: CuSparseVector, CuSparseMatrixCSC, CuSparseMatrixCSR, AbstractCuSparseArray
8-
import SparseArrays: SparseVector, SparseMatrixCSC
8+
import SparseArrays: SparseVector, SparseMatrixCSC, sparse
99
import CUDA.Adapt: adapt
1010

1111
allowscalar(false)

0 commit comments

Comments
 (0)