def block_sum(i, bins, C, n_tau):
    """
    Computes the sum of a block for greedy binning
    
    Args:
        i (int): bin index
        bins (np.array): bin boundary vector
        C (np.array): covariance matrix
        n_tau (np.array): vector of the number of unique elements
    
    Returns:
        float: the contribution of bin i
    """
    s= 0.0
    for j in range(bins[i], bins[i+1]):
        for k in range(bins[i], bins[i+1]):
            s+= C[j][k]*n_tau[j]*n_tau[k]
    return s