Recursively compute the covariance matrix for the multivariate normal
        proposal distribution.

        This method is called every self.interval once self.delay iterations
        have been performed.

def update_cov(self):
        """Recursively compute the covariance matrix for the multivariate normal
        proposal distribution.

        This method is called every self.interval once self.delay iterations
        have been performed.
        """

        scaling = (2.4) ** 2 / self.dim  # Gelman et al. 1996.
        epsilon = 1.0e-5
        chain = np.asarray(self._trace)

        # Recursively compute the chain mean
        self.C, self.chain_mean = self.recursive_cov(self.C, self._trace_count,
                                                     self.chain_mean, chain, scaling=scaling, epsilon=epsilon)

        # Shrink covariance if acceptance rate is too small
        acc_rate = self.accepted / (self.accepted + self.rejected)
        if self.shrink_if_necessary:
            if acc_rate < .001:
                self.C *= .01
            elif acc_rate < .01:
                self.C *= .25
            if self.verbose > 1:
                if acc_rate < .01:
                    print_(
                        '\tAcceptance rate was',
                        acc_rate,
                        'shrinking covariance')
        self.accepted = 0.
        self.rejected = 0.

        if self.verbose > 1:
            print_("\tUpdating covariance ...\n", self.C)
            print_("\tUpdating mean ... ", self.chain_mean)

        # Update state
        adjustmentwarning = '\n' +\
            'Covariance was not positive definite and proposal_sd cannot be computed by \n' + \
            'Cholesky decomposition. The next jumps will be based on the last \n' + \
            'valid covariance matrix. This situation may have arisen because no \n' + \
            'jumps were accepted during the last `interval`. One solution is to \n' + \
            'increase the interval, or specify an initial covariance matrix with \n' + \
            'a smaller variance. For this simulation, each time a similar error \n' + \
            'occurs, proposal_sd will be reduced by a factor .9 to reduce the \n' + \
            'jumps and increase the likelihood of accepted jumps.'

        try:
            self.updateproposal_sd()
        except np.linalg.LinAlgError:
            warnings.warn(adjustmentwarning)
            self.covariance_adjustment(.9)

        self._trace_count += len(self._trace)
        self._trace = []