Community
cancel
Showing results for
Did you mean:
Beginner
130 Views

## Storing Tri-diagonal matrix in coo or csr format.

Hi,

Is there any function/method to store the tridiagonal matrix in csr or coo format.

4 Replies
Black Belt
130 Views

This is so trivial that there is no need to write a routine to do it. For a matrix of size n, all you need to do is to set

IA = [1, 3, 6, 9, ..., 3n-3; 3n-1]

JA = [1,2,  3,4,5,  6,7,8,  ,...,3n-3, 3n-2]

and A to the 3n-2 values, arranged by rows.

Furthermore, why do you want to use the more general CSR representation for a tridiagonal matrix?

Beginner
130 Views

Thank you

I am going to assemble the tridiagonal matrix into csr/coo format and then use PARDISO linear solver routines.

Black Belt
130 Views

elmeliegy, abdelrahman wrote:

I am going to assemble the tridiagonal matrix into csr/coo format and then use PARDISO linear solver routines.

Why do that? That would be wasted effort, since the "Thomas Algorithm" for solving tridiagonal equations can be coded in 10 to 20 lines of code.

Beginner
130 Views

I am upgrading an old FE code and i am going to set the solver as PARDISO. So, i need to convert all assembly format to the csr format.