def __slice_acov__(cov, dep, given):
    """
    Slices a covariance matrix keeping only the row associated with the dependent variable
    minus its self-covariance.
    :param cov: Covariance matrix.
    :param dep: Index of dependent variable.
    :param given: Array of indices of independent variables.
    :return: A 1 x |given| vector of covariances.
    """
    row_selector = dep
    col_selector = [x for x in range(cov.shape[1]) if x in given]
    v = cov[row_selector, col_selector]
    return v