-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update MPS
manual in docs
#262
base: master
Are you sure you want to change the base?
Conversation
An `MPS` representation is not unique: a single `MPS` can be represented in different canonical [`Form`](@ref). The choice of canonical form can affect the efficiency and stability of algorithms used to manipulate the `MPS`. You can check the canonical form of an `MPS` by calling the `form` function: | ||
|
||
```@example | ||
mps = MPS([rand(2, 2), rand(2, 2, 2), rand(2, 2)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# default ordering is (physical, virtual left, virtual right)
### Canonical Forms | ||
|
||
An `MPS` representation is not unique: a single `MPS` can be represented in different canonical [`Form`](@ref). The choice of canonical form can affect the efficiency and stability of algorithms used to manipulate the `MPS`. You can check the canonical form of an `MPS` by calling the `form` function: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on the form, Tenet will dispatch under the hood the appropriate algorithm which makes full use of the canonical form, so be careful when making modifications that might alter the form without changing the trait.
docs/src/manual/ansatz/mps.md
Outdated
|
||
fig # hide | ||
``` | ||
|
||
### Canonical Forms | ||
|
||
An `MPS` representation is not unique: a single `MPS` can be represented in different canonical [`Form`](@ref). The choice of canonical form can affect the efficiency and stability of algorithms used to manipulate the `MPS`. You can check the canonical form of an `MPS` by calling the `form` function: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current form of the MPS is stored as a trait (refs etc) and can be accessed via the form
function
… of Yao gates (#258) * try fix reordering of sites * try fix layout of multi-qubit gates in Yao to Tenet conversion * Remove permutedims & add collect for array building * minor fixes on Reactant pkg extension * implement `copy` for some structs * fix column- to row-major layout conversion on `Reactant.promote_to` call * remove dead code --------- Co-authored-by: Todorbsc <[email protected]>
* Add evolve! function for an MPS with an MPO * Add tests for MPS-MPO evolution * Remove unnecessary @show * Add comment * Fix kwarg handling on truncate! function * Fix normalize! for Canonical form and small fixes on evolve! with MPO * Extend evolve!(mps, mpo) tests * Format code * Remove unnecessary kwarg * Refactor code so it is easier to extend for other canonical forms * Fix comment * Enhance tests * Add reset_index kwarg * Update tests * Format code * Remove unnecessary Quantum functions, add docstring for truncate_sweep! * Format code * Remove stale function
``` | ||
> :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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be a warning.
... which assumes full use of the canonical form ...
what does this mean?
... so be careful when making modifications that might alter the canonical form without changing the trait.
Users must not modify the form field directly; the public API is to call canonize!
or mixed_canonize!
so they shouldn't care about this.
So I would just put the first part of the paragraph. You can put it in a info box if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, if a user does Tenet.canonize_site!
or some other function (replace!
, contract!
, ...), you lose the sense of form
and thus we have that warning.
> :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. | ||
Currently, `Tenet` supports the [`NonCanonical`](@ref), [`CanonicalForm`](@ref) and [`MixedCanonical`](@ref) forms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, `Tenet` supports the [`NonCanonical`](@ref), [`CanonicalForm`](@ref) and [`MixedCanonical`](@ref) forms. | |
Currently, `Tenet` has the following forms implemented: |
In the `NonCanonical` form, the tensors in the `MPS` do not satisfy any particular orthogonality conditions. This is the default `form` when an `MPS` 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` form represents the `MPS` using a sequence of isometric tensors (`Γ`) and diagonal vectors (`λ`) containing the Schmidt coefficients. The `MPS` is expressed as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also known as Vidal's form, the `Canonical` form represents the `MPS` using a sequence of isometric tensors (`Γ`) and diagonal vectors (`λ`) containing the Schmidt coefficients. The `MPS` is expressed as: | |
Also known as Vidal gauge, the `Canonical` form represents the `MPS` using a sequence of isometric tensors (`Γ`) and diagonal vectors (`λ`) containing the Schmidt coefficients. Mathematically, the `MPS` is expressed as: |
|
||
form(mps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe better remove this? or maybe better use @repl
instead of @example
https://documenter.juliadocs.org/stable/man/syntax/#@repl-block
``` | ||
|
||
#### `MixedCanonical` Form | ||
In the `MixedCanonical` 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` or `Vector{<:Site}`) contains the entanglement information between the left and right parts of the chain. The position of the orthogonality center is stored in the `orthog_center` field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to explain what is left-/right-canonical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... contains the entanglement information between the left and right parts of the chain. ...
I'm not convinced by this phrase but I don't know how to rephrase it jajajaj
any idea @arturgs @starsfordummies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just remove the sentence "and the tensors... "
|
||
##### Additional Resources | ||
For more in-depth information on Matrix Product States and their canonical forms, you may refer to: | ||
- Schollwöck, U. (2011). The density-matrix renormalization group in the age of matrix product states. Annals of physics, 326(1), 96-192. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh for this kind of citations we had a Documenter plugin that I've disabled. we can reenable it.
look for DocumenterCitations.jl
Depending on the boundary conditions, the chains can be open or closed (i.e. periodic boundary conditions), currently | ||
only `Open` boundary conditions are supported in `Tenet`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
....currently
onlyOpen
boundary conditions are supported inTenet
.
There is a weird newline there. But also, this is the kind of information that can better be in a warning box.
Summary
This PR updates the
MPS
manual, accounting with the changes fromMPS
refactor (PR #232) and thus adding explanation of the different canonical forms we support. I think it makes sense that the manual for the canonical forms is in thisMPS
manual.Additionally, I fixed a problem in the
Project.toml
of the docs.@starsfordummies Can you take a look at the explanation on each canonical form? Maybe we can explain it better.