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

Relax push! constrains under specific conditions #147

Closed
jofrevalles opened this issue Jun 4, 2024 · 3 comments · Fixed by #149
Closed

Relax push! constrains under specific conditions #147

jofrevalles opened this issue Jun 4, 2024 · 3 comments · Fixed by #149
Labels
question Further information is requested

Comments

@jofrevalles
Copy link
Member

Summary

A common procedure in Tensor Networks is replacing some given tensors with new ones. For example, we may have an mps and evolve it with some operator to obtain new tensors, which share the same indices but change their size. The way to do this in now Tenet I believe is quite cumbersome, and could be improved if we relaxed the conditions in push!. Currently, Tenet checks that the new pushed tensor does match in size for all their indices. This can be a problem if we wanted to update a tensor T that has increased in bond dimension, but we still have not computed its neighbor tensor that shares indices with.
My suggestion is that we can put a keyword argument in replace! that relaxes the mentioned constrains in push!.

@mofeing
Copy link
Member

mofeing commented Jun 5, 2024

Allowing users to push tensors with different index sizes is something that scares me due to the possibility of introducing subtle and difficult to track bugs.

But I completely agree that this makes some code super cumbersome.

My idea for this is that we could allow this but through a higher-level interface such that Tenet still checks the dimensions but (and this is the key) after a wrapped region (and not on each push! call).

Here is a prototype code:

Tenet.@unsafe_region tn begin
    # here go the push!, pop!, replace!, ...
    ...
end

When this block of code finishes, Tenet will check if the index dimensions remain consistent and throw an error if not.

@jofrevalles
Copy link
Member Author

I like this idea!

@mofeing
Copy link
Member

mofeing commented Jun 10, 2024

Implemented in #149

@mofeing mofeing closed this as completed Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants