A full-rank linear function (lmder test #1)

def _lmder1_linear_full_rank(n, m, factor, target_fnorm1, target_fnorm2):
    """A full-rank linear function (lmder test #1)"""

    def func(params, vec):
        s = params.sum()
        temp = 2. * s / m + 1
        vec[:] = -temp
        vec[:params.size] += params

    def jac(params, jac):
        # jac.shape = (n, m) by LMDER standards
        jac.fill(-2. / m)
        for i in range(n):
            jac[i,i] += 1

    guess = np.ones(n) * factor

    #_lmder1_test(m, func, jac, guess)
    _lmder1_driver(m, func, jac, guess,
                   target_fnorm1, target_fnorm2,
                   [-1] * n)