Conversation
a1f1076 to
8e8359b
Compare
tommyod
left a comment
There was a problem hiding this comment.
Looked over at it looks good to me! Great work as always!
To reiteratie on float32: this is just a choice, we could use float64. We could also re-write the logic in iterative_ensemble_smoother a bit to facilitate ERT integration in an easier way. The current logic is that the user must give all arrays used for the assimilation in the same dtype. The idea is that it makes little sense to use e.g. float32 for parameters but float64 for observations, or whatever - so dtypes must match or iterative_ensemble_smoother will assume a user error and raise. This is admittedly a bit strict perhaps.
|
Another comment that I want to fill out for future reference: one of the tests has a large diff. This is expected, because we now use a scaled version of subspace inversion. See these PRs for more information:
Essentially we used a version of subspace inversion before that was "unscaled". This version strictly speaking is mathematically WRONG for anything but an identity covariance matrix. In previous readings of the relevant papers I thought that "scaling" refers to numerical scaling, but it does not - if we use the "unscaled" version we actually solve a rough approximation of the equation that we want to solve. Scaling is necessary to achieve good results on almost all problems, but it should probably never have been called "scaling" and an unscaled version should arguably never have been presented in the paper. This lead to a lot of confusion, but is is fixed now. The scaled version has no additional computational cost on diagonal covariance matrices. |
c142e57 to
f20e31d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13082 +/- ##
==========================================
- Coverage 90.31% 90.23% -0.08%
==========================================
Files 453 453
Lines 31285 31287 +2
==========================================
- Hits 28256 28233 -23
- Misses 3029 3054 +25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Merging this PR will improve performance by 43.51%
Performance Changes
Comparing |
Issue
Resolves #12944
The new API fixes a bug in subspace inversion and no longer exposes the argument
inversion.See snapshot test
test_update_snapshot.The old implementation of subspace is only correct when
R = I.Instead, the API exposes the argument
truncationwheretruncation=1.0is the same asEXACTand anything less than 1.0 isSUBSPACE.I've made it so the change is backward compatible in the sense that default is
truncation=1.0The new API is stricter with regards to types as it requires that all inputs are of the exact same type.
In ert, we don't know what type the parameters have when initializing strategies.
So, I'm casting everything to float32 before udpating.
git rebase -i main --exec 'just rapid-tests')When applicable