def _equality_constraints(vects):
    """Spherical equality constraint. Returns 0 if vects lies on the unit
    sphere. Note that a flattened array is returned because `scipy.optimize`
    expects a 1-D array.

    Parameters
    ----------
    vects : array-like shape (N * 3)
        Points on the sphere.
    Returns
    -------
    array-like (N,)
        Difference between squared vector norms and 1.

    """
    N = vects.shape[0] // 3
    vects = vects.reshape((N, 3))
    return (vects ** 2).sum(1) - 1.0
