Skip to content

Instantly share code, notes, and snippets.

@pervognsen
Last active March 20, 2020 13:47
Show Gist options
  • Save pervognsen/fe2a1571f0e1bd11ecd61cb031f2647f to your computer and use it in GitHub Desktop.
Save pervognsen/fe2a1571f0e1bd11ecd61cb031f2647f to your computer and use it in GitHub Desktop.
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