Skip to content

Commit 0be13fc

Browse files
committed
update docstrings
1 parent 7fdc344 commit 0be13fc

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/operators/mpo.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,17 @@ function Base.isapprox(
383383
return norm₁₂² max(atol^2, rtol^2 * max(norm₁², norm₂²))
384384
end
385385

386-
"""
386+
@doc """
387387
swap(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=SDD(), trscheme)
388388
swap!(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=SDD(), trscheme)
389389
390390
Compose the mpo with a swap gate applied to indices `i` and `i + 1`, effectively creating an
391391
operator that acts on the Hilbert spaces with those factors swapped.
392392
The keyword arguments `alg` and `trscheme` can be used to control how the resulting tensor
393393
is truncated again.
394-
"""
395-
swap(mpo::FiniteMPO{<:MPOTensor}, i::Integer; kwargs...) = swap!(copy(mpo), i; kwargs...)
394+
""" swap, swap!
395+
396+
swap(mpo::FiniteMPO, i::Integer; kwargs...) = swap!(copy(mpo), i; kwargs...)
396397
function swap!(
397398
mpo::FiniteMPO{<:MPOTensor}, i::Integer;
398399
inv::Bool = false,
@@ -415,6 +416,15 @@ function swap!(
415416
return mpo
416417
end
417418

419+
@doc """
420+
multiply_neighbours(mpo::FiniteMPO, i::Integer)
421+
multiply_neighbours!(mpo::FiniteMPO, i::Integer)
422+
423+
Construct the mpo of length `length(mpo) - 1` which is formed by multiplying the operators
424+
on site `i` and `i + 1`.
425+
""" multiply_neighbours, multiply_neighbours!
426+
427+
multiply_neighbours(mpo::FiniteMPO, i::Integer) = multiply_neighbours!(copy(mpo), i)
418428
function multiply_neighbours!(mpo::FiniteMPO{<:MPOTensor}, i::Integer)
419429
1 <= i < length(mpo) || throw(BoundsError(mpo, i))
420430
O₁ = mpo[i]

0 commit comments

Comments
 (0)