Could anyone point me to a library/code allowing me to perform low-rank updates on a Cholesky decomposition in python (numpy)? Matlab offers this functionality as a function cal
This should do a rank-1 update or downdate on numpy arrays R and x with sign '+' or '-' corresponding to update or downdate. (Ported from MATLAB cholupdate at the Wikipedia page: http://en.wikipedia.org/wiki/Cholesky_decomposition):
def cholupdate(R,x,sign):
import numpy as np
p = np.size(x)
x = x.T
for k in range(p):
if sign == '+':
r = np.sqrt(R[k,k]**2 + x[k]**2)
elif sign == '-':
r = np.sqrt(R[k,k]**2 - x[k]**2)
c = r/R[k,k]
s = x[k]/R[k,k]
R[k,k] = r
if sign == '+':
R[k,k+1:p] = (R[k,k+1:p] + s*x[k+1:p])/c
elif sign == '-':
R[k,k+1:p] = (R[k,k+1:p] - s*x[k+1:p])/c
x[k+1:p]= c*x[k+1:p] - s*R[k, k+1:p]
return R