Skip to content

Commit

Permalink
minor doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Dec 11, 2024
1 parent 2cbea3d commit 9c26ce4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
7 changes: 6 additions & 1 deletion docs/src/lib/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ MPSMultiline

## Operators
```@docs
AbstractMPO
MPO
FiniteMPO
InfiniteMPO
MPOHamiltonian
FiniteMPOHamiltonian
InfiniteMPOHamiltonian
SparseMPO
DenseMPO
MPOHamiltonian
```

## Environments
Expand Down
22 changes: 11 additions & 11 deletions docs/src/man/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ O_xzx_sum * FiniteMPS(3, ℂ^2, ℂ^4)
make sure that the virtual spaces do not increase past the maximal virtual space that
is dictated by the requirement of being full-rank tensors.

## MPOHamiltonian
## FiniteMPOHamiltonian

We can also represent quantum Hamiltonians in the same form. This is done by converting a
sum of local operators into a single MPO operator. The resulting operator has a very
specific structure, and is often referred to as a *Jordan block MPO*.

This object can be constructed as an MPO by using the [`MPOHamiltonian`](@ref) constructor,
This object can be constructed as an MPO by using the [`FiniteMPOHamiltonian`](@ref) constructor,
which takes two crucial pieces of information:

1. An array of `VectorSpace` objects, which determines the local Hilbert spaces of the
Expand All @@ -103,16 +103,16 @@ h = 0.5
chain = fill(ℂ^2, 3) # a finite chain of 4 sites, each with a 2-dimensional Hilbert space
single_site_operators = [1 => -h * S_z, 2 => -h * S_z, 3 => -h * S_z]
two_site_operators = [(1, 2) => -J * S_x ⊗ S_x, (2, 3) => -J * S_x ⊗ S_x]
H_ising = MPOHamiltonian(chain, single_site_operators..., two_site_operators...);
H_ising = FIniteMPOHamiltonian(chain, single_site_operators..., two_site_operators...);
```

Various alternative constructions are possible, such as using a `Dict` with key-value pairs
that specify the operators, or using generator expressions to simplify the construction.

```@example operators
H_ising′ = -J * MPOHamiltonian(chain,
H_ising′ = -J * FiniteMPOHamiltonian(chain,
(i, i + 1) => S_x ⊗ S_x for i in 1:(length(chain) - 1)) -
h * MPOHamiltonian(chain, i => S_z for i in 1:length(chain))
h * FiniteMPOHamiltonian(chain, i => S_z for i in 1:length(chain))
isapprox(H_ising, H_ising′; atol=1e-6)
```

Expand Down Expand Up @@ -147,9 +147,9 @@ for I in eachindex(IndexCartesian(), square)
end
end
H_ising_2d = MPOHamiltonian(square, local_operators) +
MPOHamiltonian(square, horizontal_operators) +
MPOHamiltonian(square, vertical_operators);
H_ising_2d = FiniteMPOHamiltonian(square, local_operators) +
FiniteMPOHamiltonian(square, horizontal_operators) +
FiniteMPOHamiltonian(square, vertical_operators);
```

There are various utility functions available for constructing more advanced lattices, for
Expand Down Expand Up @@ -224,7 +224,7 @@ Vᵣ = [0, 0, 1]
expand(Vₗ * prod(Ws) * Vᵣ)
```

The `MPOHamiltonian` constructor can also be used to construct the operator from this most
The `FiniteMPOHamiltonian` constructor can also be used to construct the operator from this most
general form, by supplying a 3-dimensional array $W$ to the constructor. Here, the first
dimension specifies the site in the unit cell, the second dimension specifies the row of the
matrix, and the third dimension specifies the column of the matrix.
Expand All @@ -237,7 +237,7 @@ data[1, 1, 2] = -J * S_x
data[1, 2, 3] = S_x
data[1, 1, 3] = -h * S_z
data_range = repeat(data, 4, 1, 1) # make 4 sites long
H_ising″ = MPOHamiltonian(data_range)
H_ising″ = FiniteMPOHamiltonian(data_range)
```

MPSKit will then automatically attach the correct boundary vectors to the Hamiltonian whenever this is required.
Expand All @@ -255,7 +255,7 @@ MPSKit will then automatically attach the correct boundary vectors to the Hamilt
!!! warning
This part is still a work in progress

Because of the discussion above, the `MPOHamiltonian` object is in fact just a `FiniteMPO`,
Because of the discussion above, the `FiniteMPOHamiltonian` object is in fact just an `AbstractMPO`,
with some additional structure. This means that similar operations and properties are
available, such as the virtual spaces, or the individual tensors. However, the block
structure of the operator means that now the virtual spaces are not just a single space, but
Expand Down
23 changes: 13 additions & 10 deletions docs/src/man/states.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ A FiniteMPS is - at its core - a chain of mps tensors.
A [`FiniteMPS`](@ref) can be created by passing in a vector of tensormaps:

```julia
data = fill(TensorMap(rand,ComplexF64,ℂ^1*^2,ℂ^1),10);
FiniteMPS(data);
L = 10
data = [rand(ComplexF64, ℂ^1 ^2 ^1) for _ in 1:L];
FiniteMPS(data)
```

Or alternatively by
Or alternatively by specifying its structure
```julia
len = 10;
max_bond_dimension =^10;
physical_space =^2;
FiniteMPS(rand,ComplexF64,len,physical_space,max_bond_dimension);
max_bond_dimension =^10
physical_space =^2
FiniteMPS(rand, ComplexF64, L, physical_space, max_bond_dimension)
```

You can take dot products, renormalize!, expectation values,....
Expand All @@ -43,7 +43,8 @@ then the state will be gauged such that the third tensor is a left isometry (sim
```julia
state.AC[3]
```
gauges the state in such a way that all tensors to the left are left isometries, and to the right will be right isometries.As a result you should have
gauges the state in such a way that all tensors to the left are left isometries, and to the right will be right isometries.
As a result you should have

```julia
norm(state) == norm(state.AC[3])
Expand All @@ -68,12 +69,14 @@ ACs::Vector{Union{Missing,A}}
CLs::Vector{Union{Missing,B}}
```

calling state.AC returns an "orthoview" instance, which is a very simple dummy object. When you call get/setindex on an orthoview, it will move the gauge for the underlying state, and return the result. The idea behind this construction is that one never has to worry about how the state is gauged, as this gets handled automagically.
calling `state.AC` returns an "orthoview" instance, which is a very simple dummy object.
When you call get/setindex on an orthoview, it will move the gauge for the underlying state, and return the result.
The idea behind this construction is that one never has to worry about how the state is gauged, as this gets handled automagically.

The following bit of code shows the logic in action:

```julia
state = FiniteMPS(10,ℂ^2,ℂ^10); # a random initial state
state = FiniteMPS(10, ^2, ^10); # a random initial state
@show ismissing.(state.ALs) # all AL fields are already calculated
@show ismissing.(state.ARs) # all AR fields are missing

Expand Down

0 comments on commit 9c26ce4

Please sign in to comment.