Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
17 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. 

 

0 Kudos
4 Replies
Highlighted
Black Belt
17 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?

0 Kudos
Highlighted
17 Views

Thank you

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

0 Kudos
Highlighted
Black Belt
17 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.

0 Kudos
Highlighted
17 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.

0 Kudos