Skip to content

Commit 750770a

Browse files
authored
Some doc fixes and additions for spin operators (#59)
* Some doc fixes and additions for spin operators * Fix some mistakes
1 parent 79c2006 commit 750770a

File tree

1 file changed

+51
-23
lines changed

1 file changed

+51
-23
lines changed

src/operators/spinoperators.jl

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ end
5050
5151
The spin operator along the x-axis.
5252
53-
See also [`σˣ`](@ref)
53+
See also [`σˣ`](@ref).
5454
"""
5555
function S_x end
5656
S_x(; kwargs...) = S_x(ComplexF64, Trivial; kwargs...)
@@ -99,7 +99,11 @@ end
9999

100100
const= S_x
101101

102-
"""Pauli x operator."""
102+
"""
103+
Pauli ``x`` operator, defined as ``σˣ = 2 ⋅ Sˣ``.
104+
105+
See also [`Sˣ`](@ref S_x).
106+
"""
103107
σˣ(args...; kwargs...) = 2 * S_x(args...; kwargs...)
104108

105109
"""
@@ -108,7 +112,7 @@ const Sˣ = S_x
108112
109113
The spin operator along the y-axis.
110114
111-
See also [`σʸ`](@ref)
115+
See also [`σʸ`](@ref).
112116
"""
113117
function S_y end
114118
S_y(; kwargs...) = S_y(ComplexF64, Trivial; kwargs...)
@@ -170,7 +174,11 @@ end
170174

171175
const= S_y
172176

173-
"""Pauli y operator."""
177+
"""
178+
Pauli ``y`` operator, defined as ``σʸ = 2 ⋅ Sʸ``.
179+
180+
See also [`Sʸ`](@ref S_y).
181+
"""
174182
σʸ(args...; kwargs...) = 2 * S_y(args...; kwargs...)
175183

176184
"""
@@ -180,7 +188,7 @@ const Sʸ = S_y
180188
The spin operator along the z-axis. Possible values for `symmetry` are `Trivial`, `Z2Irrep`,
181189
and `U1Irrep`.
182190
183-
See also [`σᶻ`](@ref)
191+
See also [`σᶻ`](@ref).
184192
"""
185193
function S_z end
186194
S_z(; kwargs...) = S_z(ComplexF64, Trivial; kwargs...)
@@ -223,7 +231,11 @@ end
223231

224232
const Sᶻ = S_z
225233

226-
"""Pauli z operator."""
234+
"""
235+
Pauli ``z`` operator, defined as ``σᶻ = 2 ⋅ Sᶻ``.
236+
237+
See also [`Sᶻ`](@ref S_z).
238+
"""
227239
σᶻ(args...; kwargs...) = 2 * S_z(args...; kwargs...)
228240

229241
"""
@@ -232,7 +244,7 @@ const Sᶻ = S_z
232244
233245
The spin plus operator.
234246
235-
See also [`σ⁺`](@ref)
247+
See also [`σ⁺`](@ref).
236248
"""
237249
function S_plus end
238250
S_plus(; kwargs...) = S_plus(ComplexF64, Trivial; kwargs...)
@@ -284,7 +296,11 @@ end
284296

285297
const S⁺ = S_plus
286298

287-
"""Pauli plus operator."""
299+
"""
300+
Pauli plus operator, defined as ``σ⁺ = 2 ⋅ S⁺``.
301+
302+
See also [`S⁺`](@ref S_plus).
303+
"""
288304
σ⁺(args...; kwargs...) = 2 * S_plus(args...; kwargs...)
289305

290306
"""
@@ -293,7 +309,7 @@ const S⁺ = S_plus
293309
294310
The spin minus operator.
295311
296-
See also [`σ⁻`](@ref)
312+
See also [`σ⁻`](@ref).
297313
"""
298314
function S_min end
299315
S_min(; kwargs...) = S_min(ComplexF64, Trivial; kwargs...)
@@ -345,23 +361,31 @@ end
345361

346362
const S⁻ = S_min
347363

348-
"""Pauli minus operator."""
364+
"""
365+
Pauli minus operator, defined as ``σ⁻ = 2 ⋅ S⁻``.
366+
367+
See also [`S⁻`](@ref S_min).
368+
"""
349369
σ⁻(args...; kwargs...) = 2 * S_min(args...; kwargs...)
350370

351371
unicode_table = Dict(:x => , :y => , :z => :ᶻ, :plus => :⁺, :min => :⁻)
352372

353373
function spinop_docstring(L::Symbol, R::Symbol)
354374
return """
355-
S_$L$R([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; spin=1 // 2)
356-
$(Symbol(:S, unicode_table[L], unicode_table[R]))([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; spin=1 // 2)
375+
S_$L$R([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; spin=1 // 2)
376+
$(Symbol(:S, unicode_table[L], unicode_table[R]))([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; spin=1 // 2)
357377
358-
The spin $L$R exchange operator.
378+
The spin $L$R exchange operator.
359379
360-
See also [`σ$(unicode_table[L])$(unicode_table[R])`](@ref)
361-
"""
380+
See also [`σ$(unicode_table[L])$(unicode_table[R])`](@ref).
381+
"""
362382
end
363383
function pauli_unicode_docstring(L::Symbol, R::Symbol)
364-
return """Pauli $L$R operator."""
384+
return """
385+
Pauli $L$R operator, defined as ``σ$(unicode_table[L])$(unicode_table[R]) = 4 ⋅ S$(unicode_table[L])$(unicode_table[R])``.
386+
387+
See also [`S$(unicode_table[L])$(unicode_table[R])`](@ref S_$L$R).
388+
"""
365389
end
366390

367391
for (L, R) in ((:x, :x), (:y, :y), (:z, :z), (:plus, :min), (:min, :plus))
@@ -409,7 +433,7 @@ end
409433
410434
The spin exchange operator.
411435
412-
See also [`σσ`](@ref)
436+
See also [`σσ`](@ref).
413437
"""
414438
function S_exchange end
415439
S_exchange(; kwargs...) = S_exchange(ComplexF64, Trivial; kwargs...)
@@ -437,7 +461,11 @@ end
437461

438462
const SS = S_exchange
439463

440-
"""Pauli exchange operator."""
464+
"""
465+
Pauli exchange operator, defined as ``σσ = 4 ⋅ SS``.
466+
467+
See also [`SS`](@ref S_exchange).
468+
"""
441469
σσ(args...; kwargs...) = 4 * S_exchange(args...; kwargs...)
442470

443471
"""
@@ -491,9 +519,9 @@ function weyl_heisenberg_matrices(Q::Int, elt=ComplexF64)
491519
end
492520

493521
"""
494-
potts_Z([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; Q=3)
522+
potts_Z([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; q=3)
495523
496-
The Potts Z operator, also known as the clock operator, where Z^q=1.
524+
The Potts ``Z`` operator, also known as the clock operator, where ``Z^q = 1``.
497525
"""
498526
function potts_Z end
499527
potts_Z(; kwargs...) = potts_Z(ComplexF64, Trivial; kwargs...)
@@ -506,10 +534,10 @@ function potts_Z(elt::Type{<:Number}, ::Type{Trivial}; q=3)
506534
end
507535

508536
"""
509-
potts_X([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; Q=3)
510-
potts_field([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; Q=3)
537+
potts_X([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; q=3)
538+
potts_field([eltype::Type{<:Number}], [symmetry::Type{<:Sector}]; q=3)
511539
512-
The Potts X operator, also known as the shift operator, where X^q=1.
540+
The Potts ``X`` operator, also known as the shift operator, where ``X^q = 1``.
513541
"""
514542
function potts_X end
515543
potts_X(; kwargs...) = potts_X(ComplexF64, Trivial; kwargs...)

0 commit comments

Comments
 (0)