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

mkl_zcsrsm -> General matrix ?

karthiksrao
Beginner
395 Views

Hello,  It looks like to use mkl_zcsrsm, the sparse matrix A should be a sparse upper or lower triangular matrix with unit or non-unit main diagonal.

Since any general sparse matrix can be divided into Upper + Lower + Diagonal,  I'm surprised that the general sparse matrices are not supported for this routine.

Could you please advice what we should do when we have to deal with a general unsymmetric sparse matrix ? 

Thanks

0 Kudos
4 Replies
Ying_H_Intel
Employee
395 Views
Dear karthiksrao, It is a good question. Let me say more before answer it :). MKL provide BLAS and LAPACK., where BLAS for general vector and matrix operation and LAPACK is for solving systems of linear equations and performing a number of related computational tasks. The function mkl_zcsrsm is for solves a system of linear matrix equations for a sparse matrix in the CSR format, and it is corresponding function ?trsm, Solves a matrix equation (one matrix operand is triangular). Both are for solve a system of linear matrix, you may ask why they are not in LAPACK, but in BLAS domain and sparse BLAS Level 2 and Level 3 Routines (matrix-vector and matrix-matrix operations) You may figure out the answer yourself: only special linear system which have matrix like upper triangle or upper or lower triangular matrix, you can use simple operation like marix to vector or marix to matrix to solve it. Otherwise, you need to use the driver routine or computation routines like LU descompose etc to solve the linear system. So as you see, it is impossible to extend it directly. You may look for the domain like the sparse solver Routines or convert the Sparse matrix to General matrix, then use Lapack function to solve a linear equation with a general unsymmetric sparse matrix. You may reference some docs like Appendix A: Linear Solvers Basics in MKL reference manual and c/fortran code example in there or in MKL install directory. Best Regards, Ying
0 Kudos
Sergey_K_Intel1
Employee
395 Views
Dear Kathirksrao, Input matrix for mkl_zcsrsm can be general. The value of matdescra(1)-matdescra(3) indicates which triangle should be used and MKL Sparse BLAS triangular solvers automatically exctract the needed triangle.. Please look art the section "Interface consideration" in chapter "Sparse BLAS level 2 and level 3" in the MKL Reference Manual. The Table "Possible Combinations of Element Values of the Parameter matdescra" lists all possible combinations of element values for of matdescra both multiplication routines and triangular solvers. Sergey
0 Kudos
karthiksrao
Beginner
395 Views
Thank you for your replies. I actually had referred to those pages suggested to write the code. The problem I was having was : when I call the routine mkl_zcsrsm giving matdescra option as 'glnf' I used to get an error "Parameter 5 in ZCSRSM is wrong". I could not understand what was wrong until I referred to the main page for mkl_zcsrsm solver : http://software.intel.com/sites/products/documentation/hpc/mkl/mklman/GUID-4DF7C6FD-660F-4EF8-9CAA-BDB93D5100DC.htm where it says : A is a sparse upper or lower triangular matrix with unit or non-unit main diagonal, So I changed matdescra option to 'tlnf' and it works fine, without any error! So while doing it for a general matrix, should we run zcsrsm twice, once for lower triangular matrix and then upper triangular matrix and then add the two results ? What happens to the diagonal terms ? Wont' they get repeated twice ? Thanks
0 Kudos
karthiksrao
Beginner
395 Views
Actually,, Just realized the method I suggested above would not work.. I probably need to look into sparse solver routines Thanks
0 Kudos
Reply