-
Notifications
You must be signed in to change notification settings - Fork 16
Additional GEVP method with errors #195
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
Conversation
Thanks Jan, this looks good. I will have a closer look tomorrow. Maybe @s-kuberski also has an opinion? As mentioned in #191 this feature will break with numpy 1.25 due to an incompatability in |
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.
I left a few small comments in the code.
Can we also have some consistency checks versus the standard GEVP
method? You mention in the comments that the results do not necessarily agree but can we have some check within a tolerance?
I added a test that shows that the mean values of the vectors with error are close to the ones from the other method. It also checks that there are errors, that they increase the errors of the projected correlator and, finally, that the result is |
Very good, thanks a lot. I would wait for @s-kuberski's feedback but from my side, this is ready to merge. Another question is maybe how to interpret the fact that the error of the projected correlator is larger when including the error of the eigenvectors. Do you have a feeling if one neglects anything when using the original |
That is an interesting question. We had a discussion about this before. My opinion is that it is correct to project without errors. If I measure a correlator with some source, I get some linear combination of states. If I measure with multiple sources and project with some (error-less) vector, I get another linear combination of states. Ideally, i got this vector from the GEVP and it produces a better overlap with the state I care about, but this is something that will be reflected in my later analysis. For example, I get longer plateaus. The GEVP-error does not help to quantify state assignment. I either found a projection to the state I want, or I did not. I feel like this error should only be used when we are taking about the vector or source itself. |
Hi! Thanks for implementing this. I try to have a look as soon as possible, sorry for being slow. |
Hi, first, thank you very much for taking the time to implement this. Also, I think that the perspective that you take in the last comment is an interesting one and I would agree concerning the fact that one does not need to include the uncertainties on the eigenvectors if one is just interested in having a nice projection. Concerning the changes:
To conclude: I very much like the addition. For smooth integration in the existing workflow, I would really like to have an implementation where the user can work with or without errors on the eigenvectors, just by changing a flag, with the same possibilities in both cases. I would be really interested in your opinion. I think I could also contribute to this, if you like. |
Just a GitHub technicality: As a maintainer of the repo @s-kuberski should be able to push to @JanNeuendorf's feature branch in case you want to work on this together. |
Okay, I think there is nothing wrong with having errors as an option in the |
Hi,
Things to discuss:
I am happy to discuss and to do changes, if you come up with ideas (also considering the keywords etc.) |
pyerrors/misc.py
Outdated
@@ -183,3 +183,18 @@ def _assert_equal_properties(ol, otype=Obs): | |||
if hasattr(ol[0], attr): | |||
if not getattr(ol[0], attr) == getattr(o, attr): | |||
raise Exception(f"All Obs in list have to have the same state '{attr}'.") | |||
|
|||
|
|||
def obsval(o): |
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.
I think the built-in float
function should be able to do this as well.
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.
float(o) is o.value
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.
Very good point. In general terms, float(o)
could not cope with o
being None
, so obsval
would be a bit more flexible. But that should not matter in this case. I can remove the function.
The interface looks good to me, but I didn't run any thorough tests. Would be interesting to hear @JanNeuendorf's opinion. |
I apologize for the late reply. |
Thanks for you feedback. If you did not see any other difference than machine precision between the two ways of solving the GEVP, I would not worry too much about the sorting of states because it would then also depend on every other step of the analysis chain... Now that I think about this, I would still leave everything as implemented as the I'll have another look at the code and push a small update (with |
Sorry for the mess, I'll try to find out why my test fails (randomly or on specific versions). |
Turns out there is an ambiguity in the overall sign of single eigenvectors that might differ when changing the solver. This could also appear in production but would not have any impact for the physics because it cancels in the projection. |
Okay, the sign difference might be important. I have a scenario where I project different sides of a matrix with different vectors. The end-results are independent from the sign, but maybe somewhere in between one might plot the correlator without taking an |
Just to remind you: The current version of the pull request does not change any behavior of existing code, since you would have to turn on I don't know if there can be any simple convention as the whole problem is invariant under flipping the sign of an eigenvector. I can think a bit about this, but I would not be sure if there is a way to streamline this (after all, everything is just passed to Fortran code). The routines act on different data in the two cases. Funnily, when I use |
This adds an additional method to the correlator class called
error_gevp()
.It uses cholesky decomposition to give the eigenvectors with errors in the same form as the output of
Corr.GEVP()
.This could have been implemented as an extra flag for
Corr.GEVP()
, but I think this would not be optimal for the following reasons.If you do not want this as a method on
Corr
, this could just be moved to misc?