Skip to content

Commit 62affab

Browse files
committed
improve docstring for synonyms
1 parent a276ad9 commit 62affab

File tree

8 files changed

+31
-17
lines changed

8 files changed

+31
-17
lines changed

src/qobj/arithmetic_and_attributes.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,15 @@ LinearAlgebra.:(/)(A::AbstractQuantumObject{DT}, n::T) where {DT,T<:Number} =
112112
get_typename_wrapper(A)(A.data / n, A.type, A.dims)
113113

114114
@doc raw"""
115+
A ⋅ B
115116
dot(A::QuantumObject, B::QuantumObject)
116117
117118
Compute the dot product between two [`QuantumObject`](@ref): ``\langle A | B \rangle``
118119
119120
Note that `A` and `B` should be [`Ket`](@ref) or [`OperatorKet`](@ref)
120121
121-
`A ⋅ B` (where `⋅` can be typed by tab-completing `\cdot` in the REPL) is a synonym for `dot(A, B)`
122+
!!! note
123+
`A ⋅ B` (where `⋅` can be typed by tab-completing `\cdot` in the REPL) is a synonym of `dot(A, B)`.
122124
"""
123125
function LinearAlgebra.dot(
124126
A::QuantumObject{DT1,OpType},
@@ -138,7 +140,8 @@ Supports the following inputs:
138140
- `A` is in the type of [`Operator`](@ref), with `i` and `j` are both [`Ket`](@ref).
139141
- `A` is in the type of [`SuperOperator`](@ref), with `i` and `j` are both [`OperatorKet`](@ref)
140142
141-
Note that `matrix_element(i, A, j)` is a synonym of `dot(i, A, j)`.
143+
!!! note
144+
`matrix_element(i, A, j)` is a synonym of `dot(i, A, j)`.
142145
"""
143146
function LinearAlgebra.dot(
144147
i::QuantumObject{DT1,KetQuantumObject},
@@ -202,7 +205,8 @@ LinearAlgebra.transpose(
202205
203206
Lazy adjoint (conjugate transposition) of the [`AbstractQuantumObject`](@ref)
204207
205-
Note that `A'` and `dag(A)` are synonyms of `adjoint(A)`.
208+
!!! note
209+
`A'` and `dag(A)` are synonyms of `adjoint(A)`.
206210
"""
207211
LinearAlgebra.adjoint(
208212
A::AbstractQuantumObject{DT,OpType},
@@ -322,7 +326,8 @@ Support for the following types of [`QuantumObject`](@ref):
322326
- If `A` is [`Ket`](@ref) or [`Bra`](@ref), default `p = 2`
323327
- If `A` is [`Operator`](@ref), default `p = 1`
324328
325-
Note that `unit` is a synonym of `normalize`.
329+
!!! note
330+
`unit` is a synonym of `normalize`.
326331
327332
Also, see [`norm`](@ref) about its definition for different types of [`QuantumObject`](@ref).
328333
"""
@@ -382,7 +387,8 @@ LinearAlgebra.rmul!(B::QuantumObject{<:AbstractArray}, a::Number) = (rmul!(B.dat
382387
383388
Matrix square root of [`QuantumObject`](@ref)
384389
385-
Note that `√(A)` is a synonym for `sqrt(A)`
390+
!!! note
391+
`√(A)` (where `√` can be typed by tab-completing `\sqrt` in the REPL) is a synonym of `sqrt(A)`.
386392
"""
387393
LinearAlgebra.sqrt(A::QuantumObject{<:AbstractArray{T}}) where {T} =
388394
QuantumObject(sqrt(sparse_to_dense(A.data)), A.type, A.dims)

src/qobj/boolean_functions.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ issuper(A) = false # default case
6565
6666
Test whether the [`AbstractQuantumObject`](@ref) is Hermitian.
6767
68-
Note that `isherm` is a synonym of `ishermitian`.
68+
!!! note
69+
`isherm` is a synonym of `ishermitian`.
6970
"""
7071
LinearAlgebra.ishermitian(A::AbstractQuantumObject) = ishermitian(A.data)
7172

src/qobj/functions.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ end
154154
155155
Returns the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product) ``\hat{A} \otimes \hat{B} \otimes \cdots``.
156156
157-
Note that `tensor` and `⊗` are synonyms of `kron`.
157+
!!! note
158+
`tensor` and `⊗` (where `⊗` can be typed by tab-completing `\otimes` in the REPL) are synonyms of `kron`.
158159
159160
# Examples
160161

src/qobj/operators.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,10 @@ Identity operator ``\hat{\mathbb{1}}`` with size `N`.
422422
423423
It is also possible to specify the list of Hilbert dimensions `dims` if different subsystems are present.
424424
425-
Note that
426-
- `type` can only be either [`Operator`](@ref) or [`SuperOperator`](@ref)
427-
- `qeye` is a synonym of `eye`
425+
Note that `type` can only be either [`Operator`](@ref) or [`SuperOperator`](@ref)
426+
427+
!!! note
428+
`qeye` is a synonym of `eye`.
428429
"""
429430
eye(
430431
N::Int;

src/qobj/quantum_object.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ QuantumObject(A::AbstractArray, type::ObjType, dims::Integer) where {ObjType<:Qu
5959
6060
Generate [`QuantumObject`](@ref) with a given `A::AbstractArray` and specified `type::QuantumObjectType` and `dims`.
6161
62-
Note that `Qobj` is a synonym of `QuantumObject`.
62+
!!! note
63+
`Qobj` is a synonym of `QuantumObject`.
6364
"""
6465
function QuantumObject(
6566
A::AbstractMatrix{T};

src/qobj/quantum_object_base.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ Returns a tuple containing each dimensions of the array in the [`AbstractQuantum
128128
129129
Optionally, you can specify an index (`idx`) to just get the corresponding dimension of the array.
130130
131-
Note that `shape` is a synonym of `size`.
131+
!!! note
132+
`shape` is a synonym of `size`.
132133
"""
133134
Base.size(A::AbstractQuantumObject) = size(A.data)
134135
Base.size(A::AbstractQuantumObject, idx::Int) = size(A.data, idx)

src/qobj/quantum_object_evo.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,10 @@ Generate [`QuantumObjectEvolution`](@ref).
181181
!!! warning "Beware of type-stability!"
182182
Please note that, unlike QuTiP, this function doesn't support `op_func_list` as `Vector` type. This is related to the type-stability issue. See the Section [The Importance of Type-Stability](@ref doc:Type-Stability) for more details.
183183
184-
# Notes
185-
- 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.
186-
- `QobjEvo` is a synonym of `QuantumObjectEvolution`
184+
Note that 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.
185+
186+
!!! note
187+
`QobjEvo` is a synonym of `QuantumObjectEvolution`.
187188
188189
# Examples
189190
This operator can be initialized in the same way as the QuTiP `QobjEvo` object. For example

src/qobj/synonyms.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ export sqrtm, logm, expm, sinm, cosm
1111
@doc raw"""
1212
Qobj(A; kwargs...)
1313
14-
`Qobj` is a synonym for generating [`QuantumObject`](@ref). See the docstring of [`QuantumObject`](@ref) for more details.
14+
!!! note
15+
`Qobj` is a synonym for generating [`QuantumObject`](@ref). See the docstring of [`QuantumObject`](@ref) for more details.
1516
"""
1617
const Qobj = QuantumObject # we need the docstring here, otherwise the docstring won't be found because QuantumObject is not a public symbol
1718

1819
@doc raw"""
1920
QobjEvo(args...; kwargs...)
2021
21-
`QobjEvo` is a synonym for generating [`QuantumObjectEvolution`](@ref). See the docstrings of [`QuantumObjectEvolution`](@ref) for more details.
22+
!!! note
23+
`QobjEvo` is a synonym for generating [`QuantumObjectEvolution`](@ref). See the docstrings of [`QuantumObjectEvolution`](@ref) for more details.
2224
"""
2325
const QobjEvo = QuantumObjectEvolution # we need the docstring here, otherwise the docstring won't be found because QuantumObjectEvolution is not a public symbol
2426

0 commit comments

Comments
 (0)