-
Notifications
You must be signed in to change notification settings - Fork 175
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
Fix Squared Operator #1127
Fix Squared Operator #1127
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1127 +/- ##
==========================================
+ Coverage 81.66% 81.91% +0.25%
==========================================
Files 207 207
Lines 12543 12544 +1
Branches 1902 1903 +1
==========================================
+ Hits 10243 10276 +33
+ Misses 1854 1825 -29
+ Partials 446 443 -3
Continue to review full report at Codecov.
|
cool! was this affecting steady state solvers? |
Not really, it's just a factor of 2, but I'm trying to get those factors right. |
The steady state does not go through this code path (yet. I'll open another PR to do that, as this code path is simpler, cleaner and faster) |
Cherry picked from netket#1065 so that i separate the two changes in two different PRs. Computing the gradient of operators that use nkjax.expect instead of the covariance formula (such as SquaredOperator) also had a wrong factor of 2 for C->C models. This is due to the weird way that Jax handles complex differentiation. This PR now fixes it, and a test is added to check the gradient wrt finite differences. Also, this PR moves out into a common test file the finite difference functions so that they can be used for other tests.
Cherry picked from #1065 so that i separate the two changes in two different PRs.
Computing the gradient of operators that use
nkjax.expect
instead of the covariance formula (such asSquaredOperator
) also had a wrong factor of 2 for C->C models.This is due to the weird way that Jax handles complex differentiation.
This PR now fixes it, and a test is added to check the gradient wrt finite differences.
Also, this PR moves out into a common test file the finite difference functions so that they can be used for other tests.