'Computes the sigma matrix and update the cholesky decomposition.'

def _compute_sigma(self, resids):

    M = self._M
    nobs = self.nobs
    sig = np.dot(resids, resids.T)
    if (not self._dfk):
        div = nobs
    elif (self._dfk.lower() == 'dfk1'):
        div = np.zeros((M ** 2))
        for i in range(M):
            for j in range(M):
                div[(i + j)] = (((self.df_model[i] + 1) * (self.df_model[j] + 1)) ** (1 / 2))
        div.reshape(M, M)
    else:
        div = np.zeros((M ** 2))
        for i in range(M):
            for j in range(M):
                div[(i + j)] = (nobs - np.max((self.df_model[i] + 1), (self.df_model[j] + 1)))
        div.reshape(M, M)
    self.cholsigmainv = np.linalg.cholesky(np.linalg.pinv((sig / div))).T
    return (sig / div)
