Skip to content

Commit 08c6cd6

Browse files
committed
Combined documentation and added reference.
1 parent 54387b9 commit 08c6cd6

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

src/lib/ITensorMPS/src/mpo.jl

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,24 @@ function ITensors.contract(A::MPO, ψ::MPS; alg=nothing, method=alg, kwargs...)
629629
return contract(Algorithm(alg), A, ψ; kwargs...)
630630
end
631631

632+
function zipup_docstring(isMPOMPO::Bool)::String
633+
rhsTypeString = isMPOMPO ? "MPO" : "MPS"
634+
rhsString = isMPOMPO ? "B" : "ψ"
635+
return """ - "zipup": The MPO and $rhsTypeString tensors are contracted then truncated at each site without enforcing
636+
the appropriate orthogonal gauge. Once this sweep is complete a call to `truncate!` occurs.
637+
Because the initial truncation is not locally optimal it is recommended to use a loose
638+
`cutoff` and `maxdim` and then pass the desired truncation parameters to the locally optimal
639+
`truncate!` sweep via the additional keyword argument `truncate_kwargs`.
640+
A set of parameters suggested in [^Paeckel2019] is
641+
`contract(A, $rhsString; method="zipup", cutoff=cutoff / 10, maxdim=2 * maxdim, truncate_kwargs=(; cutoff, maxdim))`."""
642+
end
643+
644+
function Paeckel2019_citation_docstring()::String
645+
return """
646+
[^Paeckel2019]: Time-evolution methods for matrix-product states. Sebastian Paeckel et al. [arXiv:1901.05824](https://arxiv.org/abs/1901.05824)
647+
"""
648+
end
649+
632650
contract_mpo_mps_doc = """
633651
contract(ψ::MPS, A::MPO; kwargs...) -> MPS
634652
*(::MPS, ::MPO; kwargs...) -> MPS
@@ -666,14 +684,11 @@ Choose the method with the `method` keyword, for example
666684
a density matrix which is diagonalized iteratively at each site.
667685
- "naive": The MPO and MPS tensor are contracted exactly at each site and then a truncation
668686
of the resulting MPS is performed.
669-
- "zipup": The MPO and MPS tensors are contracted then truncated at each site without enforcing
670-
the appropriate orthogonal gauge. Once this sweep is complete a call to `truncate!` occurs.
671-
Because the initial truncation is not locally optimal it is recommended to use a loose
672-
`cutoff` and `maxdim` and then pass the desired truncation parameters to the locally optimal
673-
`truncate!` sweep via the additional keyword argument `truncate_kwargs`.
674-
Suggested use is `contract(A, ψ; method="zipup", cutoff=cutoff / 10, maxdim=2 * maxdim, truncate_kwargs=(; cutoff, maxdim))`.
687+
$(zipup_docstring(false))
675688
676689
See also [`apply`](@ref).
690+
691+
$(Paeckel2019_citation_docstring())
677692
"""
678693

679694
@doc """
@@ -959,14 +974,11 @@ C = apply(A, B; alg="naive", truncate=false)
959974
- `alg="zipup"`: the algorithm to use for the contraction. Supported algorithms are
960975
- "naive": The MPO tensors are contracted exactly at each site and then a truncation
961976
of the resulting MPO is performed.
962-
- "zipup": The MPO and MPS tensors are contracted then truncated at each site without enforcing
963-
the appropriate orthogonal gauge. Once this sweep is complete a call to `truncate!` occurs.
964-
Because the initial truncation is not locally optimal it is recommended to use a loose
965-
`cutoff` and `maxdim` and then pass the desired truncation parameters to the locally optimal
966-
`truncate!` sweep via the additional keyword argument `truncate_kwargs`.
967-
Suggested use is `contract(A, ψ; method="zipup", cutoff=cutoff / 10, maxdim=2 * maxdim, truncate_kwargs=(; cutoff, maxdim))`.
977+
$(zipup_docstring(false))
968978
969979
See also [`apply`](@ref) for details about the arguments available.
980+
981+
$(Paeckel2019_citation_docstring())
970982
"""
971983

972984
@doc """

0 commit comments

Comments
 (0)