@@ -391,16 +391,17 @@ function Base.isapprox(
391391 return norm₁₂² ≤ max (atol^ 2 , rtol^ 2 * max (norm₁², norm₂²))
392392end
393393
394- """
394+ @doc """
395395 swap(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=SDD(), trscheme)
396396 swap!(mpo::FiniteMPO, i::Integer; inv::Bool=false, alg=SDD(), trscheme)
397397
398398Compose the mpo with a swap gate applied to indices `i` and `i + 1`, effectively creating an
399399operator that acts on the Hilbert spaces with those factors swapped.
400400The keyword arguments `alg` and `trscheme` can be used to control how the resulting tensor
401401is truncated again.
402- """
403- swap (mpo:: FiniteMPO{<:MPOTensor} , i:: Integer ; kwargs... ) = swap! (copy (mpo), i; kwargs... )
402+ """ swap, swap!
403+
404+ swap (mpo:: FiniteMPO , i:: Integer ; kwargs... ) = swap! (copy (mpo), i; kwargs... )
404405function swap! (
405406 mpo:: FiniteMPO{<:MPOTensor} , i:: Integer ;
406407 inv:: Bool = false ,
@@ -423,6 +424,15 @@ function swap!(
423424 return mpo
424425end
425426
427+ @doc """
428+ multiply_neighbours(mpo::FiniteMPO, i::Integer)
429+ multiply_neighbours!(mpo::FiniteMPO, i::Integer)
430+
431+ Construct the mpo of length `length(mpo) - 1` which is formed by multiplying the operators
432+ on site `i` and `i + 1`.
433+ """ multiply_neighbours, multiply_neighbours!
434+
435+ multiply_neighbours (mpo:: FiniteMPO , i:: Integer ) = multiply_neighbours! (copy (mpo), i)
426436function multiply_neighbours! (mpo:: FiniteMPO{<:MPOTensor} , i:: Integer )
427437 1 <= i < length (mpo) || throw (BoundsError (mpo, i))
428438 O₁ = mpo[i]
0 commit comments