'Check that the given Jacobian approximation satisfies secant
conditions for last `npoints` points.'

def _check_secant(self, jac_cls, npoints=1, **kw):

    jac = jac_cls(**kw)
    jac.setup(self.xs[0], self.fs[0], None)
    for (j, (x, f)) in enumerate(zip(self.xs[1:], self.fs[1:])):
        jac.update(x, f)
        for k in xrange(min(npoints, (j + 1))):
            dx = (self.xs[((j - k) + 1)] - self.xs[(j - k)])
            df = (self.fs[((j - k) + 1)] - self.fs[(j - k)])
            assert_(np.allclose(dx, jac.solve(df)))
        if (j >= npoints):
            dx = (self.xs[((j - npoints) + 1)] - self.xs[(j - npoints)])
            df = (self.fs[((j - npoints) + 1)] - self.fs[(j - npoints)])
            assert_((not np.allclose(dx, jac.solve(df))))
