Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing authored Jan 17, 2025
1 parent 0b2d609 commit 8d6c957
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions docs/src/manual/ansatz/mps.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CairoMakie.activate!(type = "svg")
using NetworkLayout
```

Matrix Product States ([`MPS`](@ref)) (also known as _Tensor Trains_) are a Quantum Tensor Network [`Ansatz`](@ref) whose tensors are laid out in a 1D chain. Depending on the boundary conditions, these chains can be open or closed (i.e. periodic boundary conditions).
Matrix Product States ([`MPS`](@ref)) (also known as _Tensor Trains_) are [`Ansatz`](@ref) Tensor Networks whose tensors are laid out in a 1D chain. Depending on the boundary conditions, these chains can be open or closed (i.e. periodic boundary conditions).

!!! warning
Currently only [`Open`](@ref) boundary conditions are supported in Tenet.
Expand Down Expand Up @@ -55,20 +55,20 @@ form(ψ)
!!! warning
Depending on the form, Tenet will dispatch under the hood the appropriate algorithm which assumes full use of the canonical form, so be careful when making modifications that might alter the canonical form without changing the trait.

Tenet has the internal function [`Tenet.check_form`](@ref) to check if the `MPS` is in the correct canonical form. This function can be used to ensure that the `MPS` is in the correct form before performing any operation that requires it.
Tenet has the internal function [`Tenet.check_form`](@ref) to check if the [`MPS`](@ref) is in the correct canonical form. This function can be used to ensure that the [`MPS`](@ref) is in the correct form before performing any operation that requires it.
Currently, Tenet supports the [`NonCanonical`](@ref), [`CanonicalForm`](@ref) and [`MixedCanonical`](@ref) forms.

#### `NonCanonical` Form
In the [`NonCanonical`](@ref) form, the tensors in the [`MPS`](@ref) do not satisfy any particular orthogonality conditions. This is the default [`form`](@ref) when an [`MPS`](@ref) is initialized without specifying a canonical form. It is useful for general purposes but may not be optimal for certain computations that benefit from orthogonality.

#### `Canonical` Form
Also known as Vidal's form, the [`Canonical`](@ref) form represents the [`MPS`](@ref) using a sequence of tensors (`Γ`) and diagonal vectors (`λ`) containing the Schmidt coefficients. The [`MPS`](@ref) is expressed as:
Also known as Vidal's form, the [`Canonical`](@ref) form represents the [`MPS`](@ref) using a sequence of tensors $\Gamma$ and diagonal vectors $\Lambda$ containing the Schmidt coefficients. The [`MPS`](@ref) is expressed as:

```math
| \psi \rangle = \sum_{i_1, \dots, i_N} \Gamma_1^{i_1} \lambda_2 \Gamma_2^{i_2} \dots \lambda_{N-1} \Gamma_{N-1}^{i_{N-1}} \lambda_N \Gamma_N^{i_N} | i_1, \dots, i_N \rangle \, .
| \psi \rangle = \sum_{i_1, \dots, i_N} \Gamma_1^{i_1} \Lambda_2 \Gamma_2^{i_2} \dots \Lambda_{N-1} \Gamma_{N-1}^{i_{N-1}} \Lambda_N \Gamma_N^{i_N} | i_1, \dots, i_N \rangle \, .
```

You can convert an `MPS` to the `Canonical` form by calling `canonize!`:
You can convert an [`MPS`](@ref) to the [`Canonical`](@ref) form by calling [`canonize!`](@ref):

```@repl examples
canonize!(ψ)
Expand All @@ -77,9 +77,12 @@ form(ψ)
```

#### `MixedCanonical` Form
In the [`MixedCanonical`](@ref) form, tensors to the left of the orthogonality center are left-canonical, tensors to the right are right-canonical, and the tensors at the orthogonality center (which can be [`Site`](@ref) or `Vector{<:Site}`) contains the entanglement information between the left and right parts of the chain. In Tenet, a left (right) canonical `Tensor` is an isometry pointing to the direction right (left). The position of the orthogonality center is stored in the `orthog_center` field.
In the [`MixedCanonical`](@ref) form, the Schmidt coefficients are contained in one tensor, called the orthogonality center, and the rest of the tensors locating to the left and right side are left- and right-canonical; i.e. isometries pointing to the right and left directions respectively.

You can convert an [`MPS`](@ref) to the [`MixedCanonical`](@ref) form and specify the orthogonality center using [`mixed_canonize!`](@ref). Additionally, one can check that the `MPS` is effectively in mixed canonical form using the function [`isisometry`](@ref), which returns `True` if the [`Tensor`](@ref) at that particular site is an isometry pointing at direction `dir`:
!!! tip
If the Schmidt coefficients are spread out along multiple tensors but localized, then [`MixedCanonical`](@ref) accepts using a `Vector{<:Site}` for representing the orthogonality center.

You can convert an [`MPS`](@ref) to the [`MixedCanonical`](@ref) form and specify the orthogonality center using [`mixed_canonize!`](@ref). Additionally, one can check that the [`MPS`](@ref) is effectively in mixed canonical form using the function [`isisometry`](@ref), which returns `true` if the [`Tensor`](@ref) at that particular site is an isometry pointing at direction `dir`:

```@repl examples
mixed_canonize!(ψ, Site(2))
Expand All @@ -92,8 +95,11 @@ form(ψ)

## Matrix Product Operators (MPO)

Matrix Product Operators ([`MPO`](@ref)) are the operator version of [Matrix Product State (MPS)](#matrix-product-states-mps).
The major difference between them is that MPOs have 2 indices per site (1 input and 1 output) while MPSs only have 1 index per site (i.e. an output). Currently, only [`Open`](@ref) boundary conditions are supported in Tenet.
Matrix Product Operators ([`MPO`](@ref)) are the operator version of [Matrix Product States (MPS)](@ref).
The major difference between them is that MPOs have 2 indices per site (1 input and 1 output) while MPSs only have 1 index per site (i.e. an output).

!!! warning
Currently, only [`Open`](@ref) boundary conditions are supported for [`MPO`](@ref).

```@example examples
fig = Figure() # hide
Expand Down

0 comments on commit 8d6c957

Please sign in to comment.