@@ -383,16 +383,17 @@ function Base.isapprox(
383383 return norm₁₂² ≤ max (atol^ 2 , rtol^ 2 * max (norm₁², norm₂²))
384384end
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
390390Compose the mpo with a swap gate applied to indices `i` and `i + 1`, effectively creating an
391391operator that acts on the Hilbert spaces with those factors swapped.
392392The keyword arguments `alg` and `trscheme` can be used to control how the resulting tensor
393393is 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... )
396397function swap! (
397398 mpo:: FiniteMPO{<:MPOTensor} , i:: Integer ;
398399 inv:: Bool = false ,
@@ -415,6 +416,15 @@ function swap!(
415416 return mpo
416417end
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)
418428function multiply_neighbours! (mpo:: FiniteMPO{<:MPOTensor} , i:: Integer )
419429 1 <= i < length (mpo) || throw (BoundsError (mpo, i))
420430 O₁ = mpo[i]
0 commit comments