01 January 1970 5 3K Report

Dear amazing researchers,

I am working on a nonlinear FEM problem and using Python for coding.

To get the nodal values of the field variable, I have to solve a system of linear equation. In matrix notation, [A]{x}={b}, where [A] is a sparse-matrix (a lot of zeros away from main diagonal), {b} is the right hand side vector.

One trivial solution is {x}={b}/[A], but it is computationally heavy when needs to be done many times and [A] is large.

Lets take a simple example:

A = [[5, 2, -1, 0, 0],

[1, 4, 2, -1, 0],

[0, 1, 3, 2, -1],

[0, 0, 1, 2, 2],

[0, 0, 0, 1, 1]]

and b = [ [0],

[1],

[2],

[2],

[3]]

To store the complete sparse-matrix is waste of memory when a large number of element values are zero, so I wrote a code to store the matrix in a compact form, which stores the non-zero diagonals in every row.

[Ac]= [[ 0, 0, -1, -1, -1], [ 0, 2, 2, 2, 2], [ 5, 4, 3, 2, 1], [ 1, 1, 1, 1, 0]]

There is a function in "scipy" library. It is scipy.solve_banded(), which takes the "Ac", and "b" as arguments and return the solution {x}.

Could anyone help me to find out the algorithm behind scipy.solve_banded() function?

I will be very thankful for your help.

More Ravi Varma's questions See All
Similar questions and discussions