def _d_ik(i, W, B):
    """ The data cluster matrix A is updated using formula 10 from Li (2005) which is the same as 
    formula 2.3 in Li & Zhu (2005). The formula uses the squared distance between ith point and 
    the kth cluster. The point is then assigned to the closest cluster. The squared distance
    between point i and data cluster k is computed by summing over the element-wise differences
    between the i-th row and k-th row of W and B, respectively: 
    
        d[i,k] = SUM_{j in features} (W[i,j] - B[k,j])^2j
    
    Parameters
    ----------
    i : int
        infdex of data point
    W : np.array
        binary data matrix
    B : np.array
        feature cluster assignment matrix
    
    Returns
    -------
    int
        index of assigned cluster
    """

    # Vectorized implementation to compute summations found in formula 10. 
    Di = W[i,:].reshape((W.shape[1],1)) - B           # broadcast i-th row of W across columns of B
    Di = Di*Di                                        
    Di = Di.sum(axis = 0)                             # sum over rows (features)
    assigned_cluster = Di.argmin()                    # take index of minimum quantity to be new cluster assignment
    
    return assigned_cluster