def structure(self, n):
        A = np.zeros((n, n), dtype=int)
        A[0, 0] = 1
        A[0, 1] = 1
        for i in range(1, n - 1):
            A[i, i - 1: i + 2] = 1
        A[-1, -1] = 1
        A[-1, -2] = 1

        return A
dataset/ETHPy150Open scipy/scipy/scipy/optimize/tests/test__numdiff.py/TestApproxDerivativeSparse.structure/original