def fast_euclidean(feat, query, featl2norm):
    """ Euclidean distance.
    Args:
        feat:       N x D feature matrix
        query:      1 x D feature vector
        featl2norm: 1 x N vector

    Returns:
        dist:       1 x N vector
    """
    return ((query ** 2).sum() + featl2norm) - 2 * query.dot(feat.T)