Skip to content

Commit 5e5c3d9

Browse files
Fix doctests
1 parent 9be1016 commit 5e5c3d9

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

docs/src/getting_started/type_stability.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ Which is an innocuous but huge difference in terms of performance. Hence, we hig
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ M = rand(ComplexF64, 4, 4)
4646
Qobj(M, dims = [2, 2]) # dims as Vector
4747
Qobj(M, dims = (2, 2)) # dims as Tuple (recommended)
4848
49-
import QuantumObject: SVector # or using StaticArrays
49+
import QuantumToolbox: SVector # or using StaticArrays
5050
Qobj(M, dims = SVector(2, 2)) # dims as StaticArrays.SVector (recommended)
5151
```
5252

@@ -197,6 +197,8 @@ Vector{Int64}(v_d)
197197
```
198198

199199
```@example Qobj
200+
using SparseArrays
201+
200202
v_s = SparseVector(v_d)
201203
```
202204

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

src/qobj/eigsolve.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ julia> a = destroy(5);
444444
445445
julia> H = a + a';
446446
447+
julia> using LinearAlgebra;
448+
447449
julia> E, ψ, U = eigen(H)
448450
EigsolveResult: type=Operator dims=[5]
449451
values:

test/runtests.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ const testdir = dirname(@__FILE__)
1212

1313
# Put core tests in alphabetical order
1414
core_tests = [
15-
# "block_diagonal_form.jl",
16-
# "correlations_and_spectrum.jl",
17-
# "dynamical_fock_dimension_mesolve.jl",
18-
# "dynamical-shifted-fock.jl",
19-
# "eigenvalues_and_operators.jl",
20-
# "entropy_and_metric.jl",
21-
# "generalized_master_equation.jl",
22-
# "low_rank_dynamics.jl",
23-
# "negativity_and_partial_transpose.jl",
24-
# "progress_bar.jl",
15+
"block_diagonal_form.jl",
16+
"correlations_and_spectrum.jl",
17+
"dynamical_fock_dimension_mesolve.jl",
18+
"dynamical-shifted-fock.jl",
19+
"eigenvalues_and_operators.jl",
20+
"entropy_and_metric.jl",
21+
"generalized_master_equation.jl",
22+
"low_rank_dynamics.jl",
23+
"negativity_and_partial_transpose.jl",
24+
"progress_bar.jl",
2525
"quantum_objects.jl",
2626
"quantum_objects_evo.jl",
2727
"states_and_operators.jl",

0 commit comments

Comments
 (0)