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

compute an inverse of mxn matrix

darkfate
Beginner
1,087 Views
Hello,
i dont know if im right here for this question.
I installed the Intel Fortran and C++ Compiler.

I have C code where Array N[][] is a mxn Matrix.

What do i need to change in the Code to get the thre (u,s,v) matrices from the SVD Algorithm?
What algorithm should i use on i7 920 for big ~50kx50k nonsparse matrices?

Thank you for the answers.
0 Kudos
3 Replies
Michael_C_Intel4
Employee
1,087 Views

Hi,

First,I would encourage you to initialize the matrix data in column-major order. If you initialize it in row-major order (as it's convinientin C), then you'll need to transpose your matrix before calling MKL. Also, you'll need to allocate space for all the ouput and working arrays.

Second, call dgesvd function (if your matrix is double precision). The best idea to get help on how to call it is to refer to the MKL LAPACK Examples web pages: http://software.intel.com/sites/products/documentation/hpc/mkl/lapack/mkl_lapack_examples/index.htm
You may also find detailed information on dgesvd in the MKL manual.

Then, you'll have all the singular values and vectors in corresponding arrays.


Michael.
0 Kudos
Gennady_F_Intel
Moderator
1,087 Views

Hi,

First,I would encourage you to initialize the matrix data in column-major order. If you initialize it in row-major order (as it's convinientin C), then you'll need to transpose your matrix before calling MKL. Also, you'll need to allocate space for all the ouput and working arrays.

Second, call dgesvd function (if your matrix is double precision). The best idea to get help on how to call it is to refer to the MKL LAPACK Examples web pages: http://software.intel.com/sites/products/documentation/hpc/mkl/lapack/mkl_lapack_examples/index.htm
You may also find detailed information on dgesvd in the MKL manual.

Then, you'll have all the singular values and vectors in corresponding arrays.


Michael.

darkfate,
if i am not mistaken, please pay attention, that for allocation all working arrays for 50k x 50k density matrices, you need at least 3 * 50*10^3* 50*10^3 * sizeof (double) ~ 60 Gb.Therefore your RAM size must be fit to this size.
--Gennady

0 Kudos
Hanyou_Chu
Beginner
1,087 Views

darkfate,
if i am not mistaken, please pay attention, that for allocation all working arrays for 50k x 50k density matrices, you need at least 3 * 50*10^3* 50*10^3 * sizeof (double) ~ 60 Gb.Therefore your RAM size must be fit to this size.
--Gennady

I thought with 'O' as one of the arguments, A is reused. At any rate this matrix is definitely too large. An iterative algorithm is probably called for. For large matrices, I would use DGESDD. He might want to try DGESVJ as well.
0 Kudos
Reply