scipy.linalg.solve_banded

scipy.linalg.solve_banded(l_and_u, ab, b, overwrite_ab=False, overwrite_b=False, debug=False, check_finite=True)[source]

Solve the equation a x = b for x, assuming a is banded matrix.

The matrix a is stored in ab using the matrix diagonal ordered form:

ab[u + i - j, j] == a[i,j]

Example of ab (shape of a is (6,6), u =1, l =2):

*    a01  a12  a23  a34  a45
a00  a11  a22  a33  a44  a55
a10  a21  a32  a43  a54   *
a20  a31  a42  a53   *    *
Parameters:

(l, u) : (integer, integer)

Number of non-zero lower and upper diagonals

ab : (l + u + 1, M) array_like

Banded matrix

b : (M,) or (M, K) array_like

Right-hand side

overwrite_ab : bool, optional

Discard data in ab (may enhance performance)

overwrite_b : bool, optional

Discard data in b (may enhance performance)

check_finite : bool, optional

Whether to check that the input matrices contain only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.

Returns:

x : (M,) or (M, K) ndarray

The solution to the system a x = b. Returned shape depends on the shape of b.