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.
Following explanations in the feature request #2, this PR reintroduces code from v1.0.0 (3bf98a1) for UniversalKriging where it is computed with a loop.
In the version 3bf98a1, in every loop an
A
matrix is defined together with a second memberb
and the system isA x = b
then solved withnp.linalg.solve
.This PR, just factorizes the matrix definition outside of the python loop, and computes it's inverse. The
x
vector can be obtained byA^(-1) b
, which is much faster once we have inverted the matrix. This result in (a) reducing the required RAM, compared to the all vectorized version (b) speed up the code by a factor of ~15 (fornx=100
,ny=200
,n=100
).Everything is defined in the
cexecute
function, alongside the originalexecute
function. A typical use would be,There are some additional tests in
tests.py
to check that both versions give the same output (although this might need to be tested more).Edit:
Added a vectorized pure python version (without the loop), that is ~4-6x faster, but requires more RAM (e.g. 6 GB of RAM for nx=1000, ny=1000, npt=100). It can be accessed through,