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

inversion of sparse complex matrix

Vahid_Jalili
Beginner
1,302 Views
Is it possible to invert a sparse complex matrix with MKL using C?
I have foundcsytri( uplo, n, a, lda, ipiv, work, info ) in LAPACK, but I guess it is not supposed toworkwith sparse matrices and also in C.
Thanks for your help
0 Kudos
9 Replies
Alexander_K_Intel2
1,302 Views
Hi,
You can use PARDISO with n rhs, where n is size of matrix. If you set rhs in next way:
rhs_i=1;
rhs_i=0 i<>j;
then solution vector will store inverse matrix.
With best regards,
Alexander Kalinkin
0 Kudos
TimP
Honored Contributor III
1,302 Views
Needless to say, the inverse is no longer sparse, so inverting a sparse matrix is expensive in storage and time, and very inefficient if the aim is to solve a system of equations.
0 Kudos
Vahid_Jalili
Beginner
1,302 Views
I want to have the result of multiplication of 3 complex matrices as: Y1*inv(Y2)*Y3
So, I don't want to solve a system. Y1 (mxn), Y2 (nxn) and Y3 (nxm) are very large and heavily sparse. Do you have any suggestion for me how to make it with MKL routines?
0 Kudos
Vahid_Jalili
Beginner
1,302 Views
Alexander, thanks for your help.
Do you know if I can do this with DSS routines instead of PARDISO? Is it possible to define rhs as an I matrix in DSS routines?!
0 Kudos
Alexander_K_Intel2
1,302 Views

Hi,

You can define many rhs in the same way that I described upper and use dss function dss_solve_complex. By the way Y=Y1*inv(Y2)*Y3 seems like Schur complimented. Are you really need to have this matrix or you need to multiply it on some vector only? Ive asked it because inverse of sparse matrix is dense and will calculate really long time. But if you need to multiply matrix Y on some vector only you can do it in next way:

x=Yr=Y1*inv(Y2)*Y3*r;

x1=Y3*r; //calculated by mkl_ccsrgemv

x2= inv(Y2)*x1; //x2 is solution of system Y2*x2=x1, calculated by PARDISO/DSS

x = Y1*x3 // calculated by mkl_ccsrgemv

With best regards,

Alexander Kalinkin


0 Kudos
Dan4
Beginner
1,302 Views

Needless to say, the inverse is no longer sparse, so inverting a sparse matrix is expensive in storage and time, and very inefficient if the aim is to solve a system of equations.

Not necessarily! Of course solving an equation using inverting the coefficient matrix is not a good idea in general, no matter the matrix is sparse or dense or what format has been used, but inversion is really needed in for example electromagnetic analysis and/or graphical calculations. Besides, in many cases, the inversion of a non-singular sparse matrix will still be sparse. Using PARDISO seems to be the only reasonable way, but if the storage of your sparse matrix won't exceed the peak usage of the memory, so it may be better to simply store the data in dense format and invert it.

Good luck,

D.

0 Kudos
Alexander_K_Intel2
1,302 Views

HI,

I agree that inverse of sparse matrix could be sparse but PARDISO package doesnt take it into account. Briefly, PARDISO calculate each column of inverse matrix by setting rhs as correspondent column of unit matrix. So size of each column of inverse matrix is N and size of inverse matrix is NxN, where N is size of initial matrix. Hence the size of the matrix is equal to the size of a dense one even though the inverse matrix contains a lot of zeros.

With best regards,

Alexander Kalinkin

0 Kudos
Dan4
Beginner
1,302 Views

That's true! That's why the output matrix has always been assumed to be dense. However, there are algorithms tailored for inverting sparse matrices that I didn't find in MKL, like Fast Inverse using Nested Dissection (FIND).

Regards,

Dan

0 Kudos
Gennady_F_Intel
Moderator
1,302 Views
that's also true. -:). there is no similar functionality into the current version.
0 Kudos
Reply