Which linear function of SciPy is used to solve a banded matrix equation?


The linear function named scipy.linalg.solve_banded is used to solve the banded matrix equation. The form of this function is as follows −

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

This linear function will solve the equation ax = b for x where a is a banded matrix.

The banded matrix a is stored in ab by using the matrix diagonal ordered form as follows −

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

The example of ab is given as follows −

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

Here the shape of a is (6, 6) and u =1, l = 2.

Parameters

Below are given the parameters of the function scipy.linalg.solve_banded() −

  • (l, u)− (integer, integer)

    These represent the number of non-zero lower and upper diagonals.

  • ab− b(l + u + 1, M) array_like

    As discussed, this parameter represents the banded matrix.

  • b− (M,) or (M, K)array_like

    This parameter represents the right-hand side.

  • Overwrite_ab− bool, optional

    This parameter is used to discard the data in banded matrix ab. It may enhance the performance of matrices.

  • Overwrite_b− bool, optional

    This parameter is used to discard the data in b. It may enhance the performance of matrices.

  • check_finite− bool, optional

    This parameter is used to check whether the input matrices contain only finite numbers or not. We may get some performance gain after disabling it. It may result in problems if the inputs do not contain infinites.

Returns

  • x− (M,) or (M, K) ndarray

    It returns the solution of the banded matrix equation ax = b. The shape of the output will depend on the shape of b.

Updated on: 25-Nov-2021

267 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements