Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Normalize #192
base: main
Are you sure you want to change the base?
Normalize #192
Changes from 45 commits
ec7ec3b
bd05519
e116388
cd2b139
6391bfa
fa91e7c
201882a
7228fb5
75d0c3b
c90139b
e87e1b3
8d780a8
e62ae0f
371492d
5138e51
275191a
194fba3
50369c1
0e5e5d8
4bc0183
9e14f14
0a7355e
b07b978
440c267
ed7befa
322dca4
54f41c0
dc0e132
2af3984
30786bc
f0d4fc8
ed5037e
e61e58c
6998077
511e09f
ed0c069
553a983
005b0e5
af68e63
0704609
e1344f0
66319b0
b098d44
b296277
1c87d22
f88b21c
6a8d4b9
c845947
90c7251
86f3087
6ff0cd5
34e8e5e
d096722
70a3f7e
2cb7f85
73e9e1e
4f4e2e5
620da37
180183e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems like a basic design question here is if normalizing should refer to treating the
tn
as a state that should be normalized to 1 or as something such that you want the result ofcontract(tn)
to be 1.It seems reasonable to define it such that
tn
is a state where you wantcontract(norm_network(tn))
to be 1 as you do here, however it may be good to write it in terms of an inner function that takes a tensor network and returns a new one where the tensors are scaled such that contracting it is 1. I can't think of a good name for that right now, but for the time being I'll refer to it asrescale(tn::AbstractITensorNetwork)
, soscalar(rescale(tn)) == 1
for any inputtn
, and the input has to be a closed network that evaluates to a scalar. Then we can just definenormalize(tn) = ket_network(rescale(norm_network(tn)))
or something like that.The current implementation feels a bit too "in the weeds" dealing with quadratic forms, bras, kets, etc. and seems like something that could be abstracted and generalized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also defining a function like
rescale
then would be relevant for other kinds of networks like partition functions, where if you track the normalization factors then that gives the evaluation of the partition function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relatedly,
rescale(tn::AbstractITensorNetwork)
could be defined in two steps, one where it computes the local scale factors (I think there is already a function for that?) and then a next step where it just divides the factors by those scale factors, so the implementation could be a bit simpler by dividing it into multiple generic steps.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I see what you mean, that's a nice idea to split it apart like that. Will change it to do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I split it apart based on a rescale function.