

def test_tridiag_real(self):
    ab = array([[0.0, 20, 6, 2], [1, 4, 20, 14], [(- 30), 1, 7, 0]])
    a = ((np.diag(ab[0, 1:], 1) + np.diag(ab[1, :], 0)) + np.diag(ab[2, :(- 1)], (- 1)))
    b4 = array([10.0, 0.0, 2.0, 14.0])
    b4by1 = b4.reshape((- 1), 1)
    b4by2 = array([[2, 1], [(- 30), 4], [2, 3], [1, 3]])
    b4by4 = array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 1, 0, 0], [0, 1, 0, 0]])
    for b in [b4, b4by1, b4by2, b4by4]:
        x = solve_banded((1, 1), ab, b)
        assert_array_almost_equal(dot(a, x), b)

dataset/ETHPy150Open scipy/scipy/scipy/linalg/tests/test_basic.py TestSolveBanded.test_tridiag_real/original