Skip to content
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

Unable to construct a FiniteMPS that has alternating virtual spaces without specifying all virtual spaces. #93

Closed
DaanMaertens opened this issue Nov 29, 2023 · 9 comments · Fixed by #102

Comments

@DaanMaertens
Copy link
Collaborator

A possible constructor for a FiniteMPS is to specify a (vector of) physical spaces and a single maxvirtspace representing the maximum space one wants on the virtual level, according to

FiniteMPS(rand, ComplexF64, rand(3:2:20) ,pspace, maxvirtspace)

If one however wants the physical space pspace=Rep[SU₂](1//2 => 1) then this constructor will fail because it will try to find the infimum between a space containing integer reps of SU2 and another containing half-integers only. The virtual spaces of the mps should be alternating between integer and half-integer and this can currently only be done by using the constructor that requires all the virtual spaces.

@DaanMaertens
Copy link
Collaborator Author

see commit cad1d97 for my proposed solution.

@Jutho
Copy link
Member

Jutho commented Nov 29, 2023

What happens if you make maxvirtspace have both integer and halfinteger representations?

@DaanMaertens
Copy link
Collaborator Author

This gives the same result as my implementation. So technically you could already do it, though this way might be a little counterintuitive?

@Jutho
Copy link
Member

Jutho commented Nov 29, 2023

I agree that being able to specify a vector of maxvirtspaces should be an option.

The simplicity of specifying a single space is of course attractive, and I think it works generally, but indeed, you need to think through the consequences and how to choose/construct it.

@Gertian
Copy link
Collaborator

Gertian commented Nov 30, 2023

You could also assume that the user defines the maximum dimension of the virtual Hilbert space.
So if you give it maxvirtdim = 5 with e.g. SU(2) sectors it might take two spin 1/2 sectors and a spin 0 sector. Or 5 spin 0 sectors etc...

Something like this could be easily achieved by using the truncdim option in TensorKit.svd() .

@lkdvos
Copy link
Member

lkdvos commented Nov 30, 2023

The problem being that you don't have anything to SVD yet if you create a random state. The singular values will be distributed randomly, and you might end up picking 1 spin 5 sector by accident, instead of an even distribution which is more likely what you want/expect.

I would suggest to modify the current constructor which specifies all virtual spaces, to automatically use these as site-dependent maximal spaces. This way, we can also intercept accidental creation of states that are not full-rank, which are likely to lead to issues further down the line.

@lkdvos
Copy link
Member

lkdvos commented Nov 30, 2023

# constructor with a single physical space, and a single virtual space.
FiniteMPS([f, elt], pspace::VectorSpace, maxvspace::ElementarySpace; length=N, kwargs...)
# constructor with variable physical spaces and variable virtual spaces
FiniteMPS([f, elt], pspaces::Vector{<:VectorSpace}, maxvspaces::Vector{<:ElementarySpace}; kwargs...)

While it might be convenient to automatically infer all other combinations, it might also become quite a mess to keep this implemented nicely, and I would argue that the it is not that much more verbose to type repeat(alternatingspaces, N/2).
In the case where you explicitly wish to construct an MPS which is not full-rank, probably it is better to really require the user to construct the tensors themselves, as it is also less obvious how to gauge them consistently I think.

@Gertian
Copy link
Collaborator

Gertian commented Nov 30, 2023

Since it's a finiteMPS I'd just build the n-th virtual space as (physical space)^n or a trunctated version thereof.
But indeed it's slightly ill defined since the truncated sectors would be randomly picked.

Perhaps something like : ```FiniteMPS([f, elt], pspaces::Vector{<:VectorSpace}, truncator; kwargs...)''' with truncator an algorithm that is passed to the QR/SVD used in the constructor ? Like this users can freely choose between the available truncation methods from TensorKit.

@lkdvos
Copy link
Member

lkdvos commented Nov 30, 2023

But again, it really does not make sense to truncate a just-initialized state, no matter what truncated algorithm you are using? For example, I could ask for a state filled with zeros, in which case any truncation method fails anyways. If you really want to truncate an MPS, I think it makes more sense to construct it, and then just truncate the result.
The FiniteMPS constructor does not really need to have the responsability of also truncating.

@lkdvos lkdvos linked a pull request Dec 2, 2023 that will close this issue
lkdvos added a commit that referenced this issue Dec 4, 2023
* changed constructors in finitemps.jl

* Update docstring FiniteMPS

* Formatter

* Fix length vector

---------

Co-authored-by: DaanMaertens <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants