Skip to content

Normalize #192

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

Merged
merged 101 commits into from
May 8, 2025
Merged

Normalize #192

merged 101 commits into from
May 8, 2025

Conversation

JoeyT1994
Copy link
Contributor

This PR adds support for normalizing tensor networks with either a BP backend or an exact backend.

Specifically given an ITensorNetwork tn we can call tn_normalized = normalize(tn; alg) to enforce tn_normalized * dag(tn_normalized) == 1 within the framework of the desired algorithm.

This is particularly useful in the context of alg = "bp" as it stabilizes the fixed point of belief propagation such that the norm of the message tensors is stable when running subsequent bp iterations on tn_normalized.

@mtfishman this is a routine that I am calling frequently in bp_alternating_update and so I thought I would add it. I also think it is generally useful when doing things like TEBD to keep the bp_norm more stable.

@JoeyT1994
Copy link
Contributor Author

@mtfishman Yes the source of the failing tests is EinExprs.jl as when I comment out those specific tests and loading of that extension things pass. I will keep them commented out for now.

@JoeyT1994
Copy link
Contributor Author

@mtfishman Okay I defined a map_vertices_preserve_graph! function as an alternative to map_vertex_data_preserve_graph and had the scale! function forward to that.

A map_vertex_data function exists in DataGraphs.jl and works immediately on the AbstractITensorNetwork type so I removed that definition here. However, map_vertex_data_preserve_graph is not yet defined in DataGraphs.jl .

We should make a PR to DataGraphs.jl and define map_vertex_data_preserve_graph and map_vertices_preserve_graph! and map_vertices_preserve_graph etc. Up to you whether you want me to do that before merging this PR or just leave as a TODO.

@mtfishman
Copy link
Member

We should make a PR to DataGraphs.jl and define map_vertex_data_preserve_graph and map_vertices_preserve_graph! and map_vertices_preserve_graph etc. Up to you whether you want me to do that before merging this PR or just leave as a TODO.

I think the reason it wasn't defined in DataGraphs.jl is because ITensorNetworks are quite special, since the vertex metadata (the ITensors) implicitly determine the graph structure. That's not the case for most other data graphs I can think of. For that reason, DataGraphs.jl just assumes mapping/modifying the vertex data doesn't change the graph structure. So, I think it is fine to keep this in ITensorNetworks.jl for now.

@mtfishman mtfishman merged commit 8453430 into ITensor:main May 8, 2025
10 of 11 checks passed
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.

2 participants