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

Add compatible function checking sites against MPS, MPO #743

Closed
emstoudenmire opened this issue Sep 19, 2021 · 4 comments
Closed

Add compatible function checking sites against MPS, MPO #743

emstoudenmire opened this issue Sep 19, 2021 · 4 comments
Assignees

Comments

@emstoudenmire
Copy link
Collaborator

Define a function compatible(sites::Vector{<:Index},psi::MPS) which checks that sites and psi are the same length and that sites==siteinds(psi) essentially. (Perhaps that could be the whole definition.)

@emstoudenmire emstoudenmire self-assigned this Sep 19, 2021
@mtfishman
Copy link
Member

The main corner case with defining it as sites==siteinds(psi) is the case when there are multiple site indices per tensor. A more general definition would be something like all(s -> hassameinds(s[1], s[2]), zip(sites, siteinds(psi))).

Also I would prefer something a bit more descriptive, like compatible_inds. Another question would be, does the MPO version compare only to the unprimed indices, or all of the indices?

@emstoudenmire
Copy link
Collaborator Author

These are good considerations. I agree about the function name.

For the MPO case, my vote would be that if either set of MPO inds are an exact match (including prime level) then it returns true, otherwise false. So the meaning would be “an MPS with these inds can be multiplied by this MPO without any index adjustments”.

@mtfishman
Copy link
Member

There's already a function like that used for checking index compatibility at the beginning of DMRG: https://github.com/ITensor/ITensors.jl/blob/v0.2.6/src/mps/dmrg.jl#L41

@mtfishman
Copy link
Member

There is a lot of similar functionality floating around as internal functions so I think it is a matter of choosing a good interface and exposing it externally.

I've been trying to go for a consistency between the ITensor level index functions and the MPS/MPO index functions, so something like hascommoninds could work here.

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

No branches or pull requests

2 participants