scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
solve_banded(l_and_u, ab, b, overwrite_ab=False, overwrite_b=False, debug=None, check_finite=True)

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

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

Example of :None:None:`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 :None:None:`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.

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

Examples

[5 2 -1 0 0] [0] [1 4 2 -1 0] [1]

a = [0 1 3 2 -1] b = [2]

[0 0 1 2 2] [2] [0 0 0 1 1] [3]

[* * -1 -1 -1]

ab = [* 2 2 2 2]

[5 4 3 2 1] [1 1 1 1 *]

>>> from scipy.linalg import solve_banded
... ab = np.array([[0, 0, -1, -1, -1],
...  [0, 2, 2, 2, 2],
...  [5, 4, 3, 2, 1],
...  [1, 1, 1, 1, 0]])
... b = np.array([0, 1, 2, 2, 3])
... x = solve_banded((1, 2), ab, b)
... x array([-2.37288136, 3.93220339, -4. , 4.3559322 , -1.3559322 ])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.spatial.transform._rotation_spline._create_block_3_diagonal_matrix scipy.linalg._basic.solve_banded scipy.integrate._ivp.lsoda.LSODA scipy.integrate._ivp.ivp.solve_ivp

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/linalg/_basic.py#367
type: <class 'function'>
Commit: