Skip to content
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

Performance optimization with LU decomposition #35

Open
rth opened this issue Jan 14, 2017 · 2 comments
Open

Performance optimization with LU decomposition #35

rth opened this issue Jan 14, 2017 · 2 comments

Comments

@rth
Copy link
Contributor

rth commented Jan 14, 2017

Making this @bsmurphy comment a separate issue,

BTW, @rth (and anyone else who thinks about matrices, I don't think about them that much admittedly), I've been wondering if we could use LU decomposition on the kriging matrix to speed up the solution. Any thoughts? I haven't thought about this that much, but since the LHS matrix is the same (just the RHS vector that's changing), we might be able to leverage this for the looping backend...

@rth
Copy link
Contributor Author

rth commented Jan 14, 2017

@bsmurphy Thanks for this idea!

The current situation (at least with ordinary kriging) is that to solve the linear kriging system we use,

  1. matrix inversion in _exec_loop (loop backend), _exec_vector (vectorized backend) and _c_exec_loop (C loop backend) .

The linalg.solve uses a LU decomposition internally , so I guess the questions are,

  1. would it be faster to get rid of matrix inversion, and use LU decomposition instead?
  2. in the cases when linalg.solve is used repeatedly inside a loop could we precompute the LU decomposition outside of the loop and solve a simpler system in the loop?

Both sound interesting and would be worth exploring (strarting from the pure Python implementations that are easier to change). In any case we need benchmarks to see how it would impact performance and memory use (cf. PR #36) ..

@rth rth mentioned this issue Jan 14, 2017
@rth rth changed the title Optimization of loop kriging backend with LU matrix decomposition Performance optimization with LU matrix decomposition Jan 14, 2017
@rth rth changed the title Performance optimization with LU matrix decomposition Performance optimization with LU decomposition Jan 14, 2017
@MuellerSeb
Copy link
Member

We should use the properties of the kriging matrix to optimize that.
The kriging equation can always be reformulated to use the covariance-matrix instead of the semi-variogram-matrix (as done now). Then, this part of the matrix is a symmetric and positive definite matrix (if we use a valid covariance model), which could be tackled by the Cholesky decomposition. The full inversion could then be computed by block matrix-inversion as stated here: #52 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants