def METHOD_NAME(d, vec):
    tmp = np.dot(np.transpose(d), vec)
    a = np.sqrt(np.sum(d**2, axis=0))
    b = np.sqrt(np.sum(vec**2))
    k = (a*b).reshape(-1) + (10**-9)
    # compute distance
    ret_val = 1.0 - tmp/k
    return ret_val.reshape((-1))