Last active
March 20, 2020 13:47
-
-
Save pervognsen/fe2a1571f0e1bd11ecd61cb031f2647f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def givens(x, y): | |
r = np.hypot(x, y) | |
if np.isclose(r, 0): | |
return x, 1, 0 | |
return r, x / r, y / r | |
def cholesky_update(L, x): | |
m, n = A.shape | |
x = x.copy() | |
for i in range(m): | |
L[i, i], c, s = givens(L[i, i], x[i]) | |
L[i+1:, i], x[i+1:] = c * L[i+1:, i] + s * x[i+1:], -s * L[i+1:, i] + c * x[i+1:] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment