Skip to content

Commit 2fb1ab2

Browse files
committed
update finitemps docstring
1 parent 2bf400b commit 2fb1ab2

1 file changed

Lines changed: 44 additions & 31 deletions

File tree

src/states/finitemps.jl

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,50 @@ By convention, we have that:
2525
---
2626
2727
## Constructors
28-
FiniteMPS([f, eltype], physicalspaces::Vector{<:Union{S,CompositeSpace{S}}},
29-
maxvirtualspaces::Union{S,Vector{S}};
30-
normalize=true, left=oneunit(S), right=oneunit(S)) where {S<:ElementarySpace}
31-
FiniteMPS([f, eltype], N::Int, physicalspace::Union{S,CompositeSpace{S}},
32-
maxvirtualspaces::Union{S,Vector{S}};
33-
normalize=true, left=oneunit(S), right=oneunit(S)) where {S<:ElementarySpace}
34-
FiniteMPS(As::Vector{<:GenericMPSTensor}; normalize=false, overwrite=false)
35-
36-
Construct an MPS via a specification of physical and virtual spaces, or from a list of
37-
tensors `As`. All cases reduce to the latter. In particular, a state with a non-trivial
38-
total charge can be constructed by passing a non-trivially charged vector space as the
39-
`left` or `right` virtual spaces.
40-
41-
### Arguments
42-
- `As::Vector{<:GenericMPSTensor}`: vector of site tensors
43-
44-
- `f::Function=rand`: initializer function for tensor data
45-
- `eltype::Type{<:Number}=ComplexF64`: scalar type of tensors
46-
47-
- `physicalspaces::Vector{<:Union{S, CompositeSpace{S}}`: list of physical spaces
48-
- `N::Int`: number of sites
49-
- `physicalspace::Union{S,CompositeSpace{S}}`: local physical space
50-
51-
- `virtualspaces::Vector{<:Union{S, CompositeSpace{S}}`: list of virtual spaces
52-
- `maxvirtualspace::S`: maximum virtual space
53-
54-
### Keywords
55-
- `normalize=true`: normalize the constructed state
56-
- `overwrite=false`: overwrite the given input tensors
57-
- `left=oneunit(S)`: left-most virtual space
58-
- `right=oneunit(S)`: right-most virtual space
28+
29+
Recommended ways to construct a finite MPS are:
30+
31+
- Using an MPS manifold of spaces
32+
33+
```julia
34+
rand([rng], [T], manifold::FiniteMPSManifold)
35+
randn([rng], [T], manifold::FiniteMPSManifold)
36+
zeros([T], manifold::FiniteMPSManifold)
37+
ones([T], manifold::FiniteMPSManifold)
38+
```
39+
40+
First build a [`FiniteMPSManifold`](@ref) that fixes the physical and (maximal) virtual spaces, then allocate an MPS on that manifold.
41+
See [`FiniteMPSManifold`](@ref) for how to specify site-dependent virtual-space bounds and nontrivial edge charges via `left_virtualspace` and `right_virtualspace`.
42+
43+
- From site tensors
44+
45+
```julia
46+
FiniteMPS(As::Vector{<:GenericMPSTensor}; normalize = false)
47+
```
48+
49+
Construct an MPS from a vector of already-sized MPS site tensors `As`.
50+
When `normalize = true`, the state is normalized during construction.
51+
52+
- From a full state tensor
53+
54+
```julia
55+
FiniteMPS(ψ::AbstractTensor)
56+
```
57+
58+
Factorizes a full many-body state `ψ` into a finite MPS (using a left-canonical sweep).
59+
60+
In particular, charged MPS can be created by giving nontrivial left and/or right virtual spaces when constructing the manifold:
61+
62+
```julia
63+
ps = fill(ℂ^2, N) # physical spaces
64+
m = FiniteMPSManifold(ps, ℂ^D; left_virtualspace = Qₗ, right_virtualspace = Qᵣ)
65+
ψ = rand(ComplexF64, m) # normalized random MPS on the manifold
66+
```
67+
68+
!!! warning "Deprecated constructors"
69+
Older constructors of the form `FiniteMPS([f, eltype], physicalspaces, max_virtualspaces; ...)`
70+
or `FiniteMPS([f, eltype], N, physicalspace, max_virtualspaces; ...)` are deprecated. Use
71+
`rand`/`randn`/`zeros`/`ones` with a [`FiniteMPSManifold`](@ref) instead.
5972
"""
6073
struct FiniteMPS{A <: GenericMPSTensor, B <: MPSBondTensor} <: AbstractFiniteMPS
6174
ALs::Vector{Union{Missing, A}}

0 commit comments

Comments
 (0)