identify all 6 ellipsoid parametes (center, radii)

def _fit_ellipsoid_full(locations):
    """identify all 6 ellipsoid parametes (center, radii)"""
    a = np.hstack([locations*2, locations**2])
    lsq = sp.linalg.lstsq(a, np.ones(locations.shape[0]))
    x = lsq[0]
    c = -x[:3] / x[3:]
    gam = 1 + np.sum(x[:3]**2 / x[3:])
    r = np.sqrt(gam / x[3:])
    return c, r