def _chi2_ls(f):
    """Sum of the squares of the residuals.

    Assumes that f returns residuals.

    Minimizing this will maximize the likelihood for a
    data model with gaussian deviates.
    """
    return 0.5 * (f ** 2).sum(0)