def cholupdate(R,x,sgn='+'):
    '''
    Placeholder for a python version of MATLAB's cholupdate.  Now it is O(n^3)
    '''
    if len(x.shape) == 1:
        # Reshape x so that the dot product below is correct
        x = np.reshape(x,(x.shape[0],1))
    assert(R.shape[0] == x.shape[0])
    A = np.dot(R.T,R)
    if sgn == '+':
        R1 = A + np.dot(x,x.T)
    elif sgn == '-':
        R1 = A - np.dot(x,x.T)
    else:
        raise Exception('Sign needs to be + or - in cholupdate')
    return jitchol(R1).T
dataset/ETHPy150Open marionmari/pyGPs/pyGPs/Core/tools.py/cholupdate/original