Skip to content

Commit eb3ef12

Browse files
Update docstrings
1 parent 384246d commit eb3ef12

File tree

10 files changed

+319
-303
lines changed

10 files changed

+319
-303
lines changed

src/qobj/boolean_functions.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ isket(::Type{QuantumObject{DT,KetQuantumObject,N}}) where {DT,N} = true
2424
isket(A) = false # default case
2525

2626
@doc raw"""
27-
isoper(A::AbstractQuantumObject)
27+
isoper(A)
2828
2929
Checks if the [`AbstractQuantumObject`](@ref) `A` is a [`OperatorQuantumObject`](@ref). Default case returns `false` for any other inputs.
3030
"""
@@ -33,7 +33,7 @@ isoper(::Type{<:AbstractQuantumObject{DT,OperatorQuantumObject,N}}) where {DT,N}
3333
isoper(A) = false # default case
3434

3535
@doc raw"""
36-
isoperbra(A::QuantumObject)
36+
isoperbra(A)
3737
3838
Checks if the [`QuantumObject`](@ref) `A` is a [`OperatorBraQuantumObject`](@ref). Default case returns `false` for any other inputs.
3939
"""
@@ -42,7 +42,7 @@ isoperbra(::Type{QuantumObject{DT,OperatorBraQuantumObject,N}}) where {DT,N} = t
4242
isoperbra(A) = false # default case
4343

4444
@doc raw"""
45-
isoperket(A::QuantumObject)
45+
isoperket(A)
4646
4747
Checks if the [`QuantumObject`](@ref) `A` is a [`OperatorKetQuantumObject`](@ref). Default case returns `false` for any other inputs.
4848
"""
@@ -51,7 +51,7 @@ isoperket(::Type{QuantumObject{DT,OperatorKetQuantumObject,N}}) where {DT,N} = t
5151
isoperket(A) = false # default case
5252

5353
@doc raw"""
54-
issuper(A::AbstractQuantumObject)
54+
issuper(A)
5555
5656
Checks if the [`AbstractQuantumObject`](@ref) `A` is a [`SuperOperatorQuantumObject`](@ref). Default case returns `false` for any other inputs.
5757
"""

src/qobj/eigsolve.jl

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -323,33 +323,34 @@ function eigsolve(
323323
end
324324

325325
@doc raw"""
326-
eigsolve_al(H::QuantumObject,
327-
T::Real, c_ops::Union{Nothing,AbstractVector,Tuple}=nothing;
328-
alg::OrdinaryDiffEqAlgorithm=Tsit5(),
329-
H_t::Union{Nothing,Function}=nothing,
330-
params::NamedTuple=NamedTuple(),
331-
ρ0::Union{Nothing, AbstractMatrix} = nothing,
332-
k::Int=1,
333-
krylovdim::Int=min(10, size(H, 1)),
334-
maxiter::Int=200,
335-
eigstol::Real=1e-6,
336-
kwargs...)
326+
eigsolve_al(
327+
H::Union{AbstractQuantumObject{DT1,HOpType},Tuple},
328+
T::Real,
329+
c_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
330+
alg::OrdinaryDiffEqAlgorithm = Tsit5(),
331+
params::NamedTuple = NamedTuple(),
332+
ρ0::AbstractMatrix = rand_dm(prod(H.dims)).data,
333+
k::Int = 1,
334+
krylovdim::Int = min(10, size(H, 1)),
335+
maxiter::Int = 200,
336+
eigstol::Real = 1e-6,
337+
kwargs...,
338+
)
337339
338340
Solve the eigenvalue problem for a Liouvillian superoperator `L` using the Arnoldi-Lindblad method.
339341
340342
# Arguments
341-
- `H`: The Hamiltonian (or directly the Liouvillian) of the system.
342-
- `T`: The time at which to evaluate the time evolution
343+
- `H`: The Hamiltonian (or directly the Liouvillian) of the system. It can be a [`QuantumObject`](@ref), a [`QuantumObjectEvolution`](@ref), or a tuple of the form supported by [`mesolve`](@ref).
344+
- `T`: The time at which to evaluate the time evolution.
343345
- `c_ops`: A vector of collapse operators. Default is `nothing` meaning the system is closed.
344-
- `alg`: The differential equation solver algorithm
345-
- `H_t`: A function `H_t(t)` that returns the additional term at time `t`
346-
- `params`: A dictionary of additional parameters
347-
- `ρ0`: The initial density matrix. If not specified, a random density matrix is used
348-
- `k`: The number of eigenvalues to compute
349-
- `krylovdim`: The dimension of the Krylov subspace
350-
- `maxiter`: The maximum number of iterations for the eigsolver
351-
- `eigstol`: The tolerance for the eigsolver
352-
- `kwargs`: Additional keyword arguments passed to the differential equation solver
346+
- `alg`: The differential equation solver algorithm. Default is `Tsit5()`.
347+
- `params`: A `NamedTuple` containing the parameters of the system.
348+
- `ρ0`: The initial density matrix. If not specified, a random density matrix is used.
349+
- `k`: The number of eigenvalues to compute.
350+
- `krylovdim`: The dimension of the Krylov subspace.
351+
- `maxiter`: The maximum number of iterations for the eigsolver.
352+
- `eigstol`: The tolerance for the eigsolver.
353+
- `kwargs`: Additional keyword arguments passed to the differential equation solver.
353354
354355
# Notes
355356
- For more details about `alg` please refer to [`DifferentialEquations.jl` (ODE Solvers)](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/)

src/qobj/quantum_object_base.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export Bra, Ket, Operator, OperatorBra, OperatorKet, SuperOperator
1717
abstract type AbstractQuantumObject{DataType,ObjType,N}
1818
1919
Abstract type for all quantum objects like [`QuantumObject`](@ref) and [`QuantumObjectEvolution`](@ref).
20+
21+
# Example
22+
```
23+
julia> sigmax() isa AbstractQuantumObject
24+
true
25+
```
2026
"""
2127
abstract type AbstractQuantumObject{DataType,ObjType,N} end
2228

src/qobj/quantum_object_evo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Julia struct representing any time-dependent quantum object. The `data` field is
1313
\hat{O}(t) = \sum_{i} c_i(p, t) \hat{O}_i
1414
```
1515
16-
where `c_i(p, t)` is a function that depends on the parameters `p` and time `t`, and `\hat{O}_i` are the operators that form the quantum object. The `type` field is the type of the quantum object, and the `dims` field is the dimensions of the quantum object. For more information about `type` and `dims`, see [`QuantumObject`](@ref). For more information about `AbstractSciMLOperator`, see the [SciML](https://docs.sciml.ai/SciMLOperators/stable/) documentation.
16+
where ``c_i(p, t)`` is a function that depends on the parameters `p` and time `t`, and ``\hat{O}_i`` are the operators that form the quantum object. The `type` field is the type of the quantum object, and the `dims` field is the dimensions of the quantum object. For more information about `type` and `dims`, see [`QuantumObject`](@ref). For more information about `AbstractSciMLOperator`, see the [SciML](https://docs.sciml.ai/SciMLOperators/stable/) documentation.
1717
1818
# Examples
1919
This operator can be initialized in the same way as the QuTiP `QobjEvo` object. For example
@@ -82,7 +82,7 @@ Quantum Object: type=Operator dims=[10, 2] size=(20, 20) ishermitian=fal
8282
⎢⠀⠀⠀⠀⠂⡑⢄⠀⠀⠀⎥
8383
⎢⠀⠀⠀⠀⠀⠀⠂⡑⢄⠀⎥
8484
⎣⠀⠀⠀⠀⠀⠀⠀⠀⠂⡑⎦
85-
````
85+
```
8686
"""
8787
struct QuantumObjectEvolution{
8888
DT<:AbstractSciMLOperator,

src/qobj/synonyms.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Qobj(A; kwargs...) = QuantumObject(A; kwargs...)
2020
@doc raw"""
2121
QobjEvo(op_func_list::Union{Tuple,AbstractQuantumObject}, α::Union{Nothing,Number}=nothing; type::Union{Nothing, QuantumObjectType}=nothing, f::Function=identity)
2222
23-
Generate [`QuantumObjectEvolution`](@ref)
23+
Generate [`QuantumObjectEvolution`](@ref).
2424
2525
Note that this functions is same as `QuantumObjectEvolution(op_func_list)`. If `α` is provided, all the operators in `op_func_list` will be pre-multiplied by `α`. The `type` parameter is used to specify the type of the [`QuantumObject`](@ref), either `Operator` or `SuperOperator`. The `f` parameter is used to pre-apply a function to the operators before converting them to SciML operators.
2626
@@ -99,7 +99,7 @@ Quantum Object: type=Operator dims=[10, 2] size=(20, 20) ishermitian=fal
9999
⎢⠀⠀⠀⠀⠂⡑⢄⠀⠀⠀⎥
100100
⎢⠀⠀⠀⠀⠀⠀⠂⡑⢄⠀⎥
101101
⎣⠀⠀⠀⠀⠀⠀⠀⠀⠂⡑⎦
102-
````
102+
```
103103
"""
104104
QobjEvo(
105105
op_func_list::Union{Tuple,AbstractQuantumObject},

src/steadystate.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,26 @@ end
6565

6666
@doc raw"""
6767
steadystate(
68-
H::QuantumObject,
68+
H::QuantumObject{DT,OpType},
6969
c_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
7070
solver::SteadyStateSolver = SteadyStateDirectSolver(),
71-
kwargs...
71+
kwargs...,
7272
)
7373
7474
Solve the stationary state based on different solvers.
7575
7676
# Parameters
77-
- `H::QuantumObject`: The Hamiltonian or the Liouvillian of the system.
78-
- `c_ops::Union{Nothing,AbstractVector,Tuple}=nothing`: The list of the collapse operators.
79-
- `solver::SteadyStateSolver=SteadyStateDirectSolver()`: see documentation [Solving for Steady-State Solutions](@ref doc:Solving-for-Steady-State-Solutions) for different solvers.
80-
- `kwargs...`: The keyword arguments for the solver.
77+
- `H`: The Hamiltonian or the Liouvillian of the system.
78+
- `c_ops`: The list of the collapse operators.
79+
- `solver`: see documentation [Solving for Steady-State Solutions](@ref doc:Solving-for-Steady-State-Solutions) for different solvers.
80+
- `kwargs`: The keyword arguments for the solver.
8181
"""
8282
function steadystate(
83-
H::QuantumObject{<:AbstractArray,OpType},
83+
H::QuantumObject{DT,OpType},
8484
c_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
8585
solver::SteadyStateSolver = SteadyStateDirectSolver(),
8686
kwargs...,
87-
) where {OpType<:Union{OperatorQuantumObject,SuperOperatorQuantumObject}}
87+
) where {DT,OpType<:Union{OperatorQuantumObject,SuperOperatorQuantumObject}}
8888
L = liouvillian(H, c_ops)
8989

9090
return _steadystate(L, solver; kwargs...)
@@ -185,14 +185,14 @@ _steadystate(
185185

186186
@doc raw"""
187187
steadystate(
188-
H::QuantumObject,
189-
ψ0::QuantumObject,
188+
H::QuantumObject{DT1,HOpType},
189+
ψ0::QuantumObject{DT2,StateOpType},
190190
tmax::Real = Inf,
191191
c_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
192192
solver::SteadyStateODESolver = SteadyStateODESolver(),
193193
reltol::Real = 1.0e-8,
194194
abstol::Real = 1.0e-10,
195-
kwargs...
195+
kwargs...,
196196
)
197197
198198
Solve the stationary state based on time evolution (ordinary differential equations; `OrdinaryDiffEq.jl`) with a given initial state.
@@ -210,14 +210,14 @@ or
210210
```
211211
212212
# Parameters
213-
- `H::QuantumObject`: The Hamiltonian or the Liouvillian of the system.
214-
- `ψ0::QuantumObject`: The initial state of the system.
215-
- `tmax::Real=Inf`: The final time step for the steady state problem.
216-
- `c_ops::Union{Nothing,AbstractVector,Tuple}=nothing`: The list of the collapse operators.
217-
- `solver::SteadyStateODESolver=SteadyStateODESolver()`: see [`SteadyStateODESolver`](@ref) for more details.
218-
- `reltol::Real=1.0e-8`: Relative tolerance in steady state terminate condition and solver adaptive timestepping.
219-
- `abstol::Real=1.0e-10`: Absolute tolerance in steady state terminate condition and solver adaptive timestepping.
220-
- `kwargs...`: The keyword arguments for the ODEProblem.
213+
- `H`: The Hamiltonian or the Liouvillian of the system.
214+
- `ψ0`: The initial state of the system.
215+
- `tmax=Inf`: The final time step for the steady state problem.
216+
- `c_ops=nothing`: The list of the collapse operators.
217+
- `solver`: see [`SteadyStateODESolver`](@ref) for more details.
218+
- `reltol=1.0e-8`: Relative tolerance in steady state terminate condition and solver adaptive timestepping.
219+
- `abstol=1.0e-10`: Absolute tolerance in steady state terminate condition and solver adaptive timestepping.
220+
- `kwargs`: The keyword arguments for the ODEProblem.
221221
"""
222222
function steadystate(
223223
H::QuantumObject{DT1,HOpType},

0 commit comments

Comments
 (0)