Skip to content

Commit 081af8e

Browse files
committed
update InfiniteMPS docstring
1 parent 2fb1ab2 commit 081af8e

File tree

1 file changed

+52
-24
lines changed

1 file changed

+52
-24
lines changed

src/states/infinitemps.jl

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,58 @@ By convention, we have that:
1818
---
1919
2020
## Constructors
21-
InfiniteMPS([f, eltype], physicalspaces::Vector{<:Union{S, CompositeSpace{S}},
22-
virtualspaces::Vector{<:Union{S, CompositeSpace{S}};
23-
kwargs...) where {S<:ElementarySpace}
24-
InfiniteMPS(As::AbstractVector{<:GenericMPSTensor}; kwargs...)
25-
InfiniteMPS(ALs::AbstractVector{<:GenericMPSTensor}, C₀::MPSBondTensor;
26-
kwargs...)
27-
28-
Construct an MPS via a specification of physical and virtual spaces, or from a list of
29-
tensors `As`, or a list of left-gauged tensors `ALs`.
30-
31-
### Arguments
32-
- `As::AbstractVector{<:GenericMPSTensor}`: vector of site tensors
33-
- `ALs::AbstractVector{<:GenericMPSTensor}`: vector of left-gauged site tensors
34-
- `C₀::MPSBondTensor`: initial gauge tensor
35-
36-
- `f::Function=rand`: initializer function for tensor data
37-
- `eltype::Type{<:Number}=ComplexF64`: scalar type of tensors
38-
39-
- `physicalspaces::AbstractVector{<:Union{S, CompositeSpace{S}}`: list of physical spaces
40-
- `virtualspaces::AbstractVector{<:Union{S, CompositeSpace{S}}`: list of virtual spaces
41-
42-
### Keywords
43-
- `tol`: gauge fixing tolerance
44-
- `maxiter`: gauge fixing maximum iterations
21+
22+
Recommended ways to construct an infinite (periodic unit-cell) MPS are:
23+
24+
- Using an MPS manifold of spaces
25+
26+
```julia
27+
rand([rng], [T], manifold::InfiniteMPSManifold; tol, maxiter)
28+
randn([rng], [T], manifold::InfiniteMPSManifold; tol, maxiter)
29+
```
30+
31+
Build an [`InfiniteMPSManifold`](@ref) with physical spaces and (maximal) virtual spaces for the unit cell.
32+
33+
- From unit-cell site tensors
34+
35+
```julia
36+
InfiniteMPS(As::AbstractVector{<:GenericMPSTensor}; tol, maxiter)
37+
```
38+
39+
Takes a vector `As` of (full-rank preferred) site tensors defining one unit cell.
40+
The tensors are gauge-fixed (left/right) and internal bond tensors `C` are produced.
41+
If any tensor isn't full rank, a warning is emitted and `makefullrank!` is applied.
42+
43+
- From left- or right- gauged tensors and an initial gauge tensors
44+
45+
```julia
46+
InfiniteMPS(ALs::AbstractVector{<:GenericMPSTensor}, C₀::MPSBondTensor; tol, maxiter)
47+
InfiniteMPS(C₀::MPSBondTensor, ARs::AbstractVector{<:GenericMPSTensor}; tol, maxiter)
48+
```
49+
50+
Starts from gauged tensors `ALs` or `ARs` and an initial center bond `C₀` and completes the other gauge.
51+
52+
### Keywords (passed to [`gaugefix!`](@ref))
53+
- `tol`: convergence tolerance for gauge fixing.
54+
- `maxiter`: maximum iterations in gauge fixing.
55+
- Additional keyword arguments accepted by `gaugefix!` (e.g. `order = :L | :R`).
56+
57+
### Examples
58+
```julia
59+
using MPSKit, TensorKit
60+
ps = PeriodicVector([ℂ^2, ℂ^2, ℂ^2]) # physical spaces, 3-site unit cell
61+
vs = PeriodicVector([ℂ^4, ℂ^8, ℂ^4]) # maximal virtual spaces
62+
m = InfiniteMPSManifold(ps, vs)
63+
ψ = rand(ComplexF64, m; tol=1e-10)
64+
65+
# Construct from pre-built site tensors
66+
As = map(i -> rand(ComplexF64, m[i]), 1:length(m))
67+
ψ2 = InfiniteMPS(As; tol=1e-10)
68+
```
69+
70+
!!! warning "Deprecated constructors"
71+
Older constructors like `InfiniteMPS(pspaces, Dspaces)` or with `[f, T]` are deprecated.
72+
Use `rand`/`randn` with an [`InfiniteMPSManifold`](@ref) instead.
4573
"""
4674
struct InfiniteMPS{A <: GenericMPSTensor, B <: MPSBondTensor} <: AbstractMPS
4775
AL::PeriodicVector{A}

0 commit comments

Comments
 (0)