Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Storing Tri-diagonal matrix in coo or csr format.

elmeliegy__abdelrahm
572 Views

Hi,

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

 

0 Kudos
4 Replies
mecej4
Honored Contributor III
572 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
elmeliegy__abdelrahm
572 Views

Thank you

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

0 Kudos
mecej4
Honored Contributor III
572 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
elmeliegy__abdelrahm
572 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
Reply