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 support for tensor network forms (bilinear and quadratic) #136

Merged
merged 19 commits into from
Feb 13, 2024

Conversation

JoeyT1994
Copy link
Contributor

This PR adds the BilinearForm and QuadraticForm types along with the AbstractForm

We define an AbstractForm to be of the structure <x|A|y> where x, y are Tensor Network States and A is a Tensor Network Operator. The AbstractForm contains the mapping from the vertices of the original states to their names in the Form, along with the mapping from the vector space to the dual space.

The BilinearForm is the generic case where x, y and A are all distinct and constructors are defined for this case.
The QuadraticForm is the case when x and y are identical and the constructor definitions reflect that. In this case functions like gradient(qf::QuadraticForm, state_vertices::Vector) are defined for getting the derivative of the qf with respect to the vertices of the original state x.

A short series of tests are included.

@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2024

Codecov Report

Attention: 32 lines in your changes are missing coverage. Please review.

Comparison is base (da7636e) 73.24% compared to head (e3010a5) 73.25%.
Report is 1 commits behind head on main.

Files Patch % Lines
src/formnetworks/abstractformnetwork.jl 50.00% 20 Missing ⚠️
src/formnetworks/quadraticformnetwork.jl 66.66% 7 Missing ⚠️
src/formnetworks/bilinearformnetwork.jl 76.19% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #136   +/-   ##
=======================================
  Coverage   73.24%   73.25%           
=======================================
  Files          68       70    +2     
  Lines        4033     4101   +68     
=======================================
+ Hits         2954     3004   +50     
- Misses       1079     1097   +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/Forms/bilinearform.jl Outdated Show resolved Hide resolved
src/Forms/bilinearform.jl Outdated Show resolved Hide resolved
src/Forms/bilinearform.jl Outdated Show resolved Hide resolved
src/Forms/bilinearform.jl Outdated Show resolved Hide resolved
test/test_forms.jl Outdated Show resolved Hide resolved
@mtfishman
Copy link
Member

@JoeyT1994 you marked a number of comments as resolved but then I don't see the corresponding changes made.

@JoeyT1994
Copy link
Contributor Author

@mtfishman I think something has gone out of sync with Github because they are resolved on my local machine. I think it keeps using .jl files from FormNetworks before it was renamed to formnetworks. Let me try to resolve it

src/utils.jl Outdated Show resolved Hide resolved
src/exports.jl Outdated Show resolved Hide resolved
@mtfishman mtfishman changed the title Add Support for Forms Add support for tensor network forms (bilinear and quadratic) Feb 13, 2024
@mtfishman
Copy link
Member

@JoeyT1994 anything left to do here besides changing the directory FormNetworks back to formnetworks?

@JoeyT1994
Copy link
Contributor Author

I don't think so, at least for now. Just trying to change the folder name, git is very strange about renaming case sensitive things so I think I need to use some extra commands

@JoeyT1994
Copy link
Contributor Author

Okay renaming dealt with

@mtfishman
Copy link
Member

Looks good. I think this already takes us pretty close to being able to use general tensor networks in alternating_update!

@mtfishman mtfishman merged commit c2cc66a into ITensor:main Feb 13, 2024
7 of 11 checks passed
@JoeyT1994 JoeyT1994 deleted the bilinearform branch June 16, 2024 13:46
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 this pull request may close these issues.

3 participants