<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to use MKL Routines for Matrix Inversion in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-use-MKL-Routines-for-Matrix-Inversion/m-p/1067498#M21995</link>
    <description>&lt;P&gt;Hi everyone!&lt;/P&gt;

&lt;P&gt;I never used libraries in my programs, usually I do all my routines on my own, but now I'm having efficiency problems and I decided to use libraries to improve the efficiency of my program.&lt;/P&gt;

&lt;P&gt;I need an efficient routine to invert a sparse matrix. I implemented the Gauss-Jordan elimination algorithm using the "do concurrent" statement to make it parallelizable.&lt;/P&gt;

&lt;P&gt;The problem I need to solve has a sparse rectangular matrix with m rows and n columns where n is a large number of columns. I use on each iteration of my program a sparse square matrix with dimension m x m formed by the inverse matrix of m columns of the sparse rectangular matrix mentioned above. In each iteration a new column of the rectangular matrix is selected to be part of the square matrix and my program does all the necessary calculations to enter this new column.&lt;/P&gt;

&lt;P&gt;The problem appears after several iterations where appears several numerical errors in the square matrix due to the iterative process. One way to clean these errors is to calculate the inverse matrix of all columns of the rectangular matrix that are being used in the square matrix.&lt;/P&gt;

&lt;P&gt;The university computer that I am using has installed Microsoft Visual Studio Professional 2013 Update 3, Intel Parallel Studio XE 2016 Update 2 Cluster Edition for Windows with Intel Math Kernel Library 11.3.&lt;/P&gt;

&lt;P&gt;I found the routine &lt;A href="https://software.intel.com/en-us/node/469906"&gt;P?GETRI from ScaLAPACK in the MKL documentation&lt;/A&gt;*&amp;nbsp;that can solve my problem, but I did not find examples of how to use this routine and I'm in trouble of how to use the routine and declare variables. I found only one example of routine &lt;A href="http://fortranwiki.org/fortran/show/Matrix+inversion"&gt;DGETRI&amp;nbsp;from LAPACK&lt;/A&gt;* that has helped me to understand some of how to use the routine P?GETRI.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Does anyone know another routine that solves my problem or give me an example of how to use the routine P?GETRI?&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;I activated the MKL library on project properties of my of project in Visual Studio following the steps of this video tutorial &lt;A href="https://www.youtube.com/watch?v=E1n8-azFvmg"&gt;https://www.youtube.com/watch?v=E1n8-azFvmg&lt;/A&gt;. Is the procedure on the video correct or do I need to perform other procedures to use the MKL library on Visual Studio?&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;*I add the links in the text&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2016 00:07:06 GMT</pubDate>
    <dc:creator>Jeferson_Vanderlinde</dc:creator>
    <dc:date>2016-07-21T00:07:06Z</dc:date>
    <item>
      <title>How to use MKL Routines for Matrix Inversion</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-use-MKL-Routines-for-Matrix-Inversion/m-p/1067498#M21995</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;

&lt;P&gt;I never used libraries in my programs, usually I do all my routines on my own, but now I'm having efficiency problems and I decided to use libraries to improve the efficiency of my program.&lt;/P&gt;

&lt;P&gt;I need an efficient routine to invert a sparse matrix. I implemented the Gauss-Jordan elimination algorithm using the "do concurrent" statement to make it parallelizable.&lt;/P&gt;

&lt;P&gt;The problem I need to solve has a sparse rectangular matrix with m rows and n columns where n is a large number of columns. I use on each iteration of my program a sparse square matrix with dimension m x m formed by the inverse matrix of m columns of the sparse rectangular matrix mentioned above. In each iteration a new column of the rectangular matrix is selected to be part of the square matrix and my program does all the necessary calculations to enter this new column.&lt;/P&gt;

&lt;P&gt;The problem appears after several iterations where appears several numerical errors in the square matrix due to the iterative process. One way to clean these errors is to calculate the inverse matrix of all columns of the rectangular matrix that are being used in the square matrix.&lt;/P&gt;

&lt;P&gt;The university computer that I am using has installed Microsoft Visual Studio Professional 2013 Update 3, Intel Parallel Studio XE 2016 Update 2 Cluster Edition for Windows with Intel Math Kernel Library 11.3.&lt;/P&gt;

&lt;P&gt;I found the routine &lt;A href="https://software.intel.com/en-us/node/469906"&gt;P?GETRI from ScaLAPACK in the MKL documentation&lt;/A&gt;*&amp;nbsp;that can solve my problem, but I did not find examples of how to use this routine and I'm in trouble of how to use the routine and declare variables. I found only one example of routine &lt;A href="http://fortranwiki.org/fortran/show/Matrix+inversion"&gt;DGETRI&amp;nbsp;from LAPACK&lt;/A&gt;* that has helped me to understand some of how to use the routine P?GETRI.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Does anyone know another routine that solves my problem or give me an example of how to use the routine P?GETRI?&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;I activated the MKL library on project properties of my of project in Visual Studio following the steps of this video tutorial &lt;A href="https://www.youtube.com/watch?v=E1n8-azFvmg"&gt;https://www.youtube.com/watch?v=E1n8-azFvmg&lt;/A&gt;. Is the procedure on the video correct or do I need to perform other procedures to use the MKL library on Visual Studio?&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;*I add the links in the text&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 00:07:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-use-MKL-Routines-for-Matrix-Inversion/m-p/1067498#M21995</guid>
      <dc:creator>Jeferson_Vanderlinde</dc:creator>
      <dc:date>2016-07-21T00:07:06Z</dc:date>
    </item>
    <item>
      <title>Hi Jeferson, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-use-MKL-Routines-for-Matrix-Inversion/m-p/1067499#M21996</link>
      <description>&lt;P&gt;Hi Jeferson,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Only the function&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;P?GETRI can't solve linear equation, you may consider several factors and try them out:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;1) Cluster vs. Single&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;MKL provide Cluster lapack and lapack API, for example, Pdgesv or dgesv. &amp;nbsp;The "P" is for cluster distributed version, which require MPI cluster. &amp;nbsp;In single machine, dgesv was used often. So if you really need the scalapack, you may need install MPI on your windows machines cluster.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;2) API choose for dense matrix&lt;/P&gt;

&lt;P&gt;&amp;nbsp;MKL provide several functions for solve linear equation. F&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;or dense matrix, like you mentioned P?GETRI , &amp;nbsp;but as documentation&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Routines for Matrix Inversion&lt;BR /&gt;
	This sections describes ScaLAPACK routines that compute the inverse of a matrix based on the previously&lt;BR /&gt;
	obtained factorization. Note that it is not recommended to solve a system of equations Ax = b by first&lt;BR /&gt;
	computing A-1 and then forming the matrix-vector product x = A-1b. Call a solver routine instead (see&lt;BR /&gt;
	Solving Systems of Linear Equations); this is more efficient and more accurate.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;Like pdgesv, &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;you may find some scalapack sample in MKL install directory for example, &lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.072\windows\mkl\examples&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;or &amp;nbsp;in the forum, for example: &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;like &lt;A href="https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/558359" target="_blank"&gt;https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/558359&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;3) for sparse matrix, &amp;nbsp;MKL have pardiso solver and cluster sparse solver&lt;BR /&gt;
	you can find the c or fortran sample under &amp;nbsp;MKL install folder/example &amp;nbsp;&lt;/P&gt;

&lt;P&gt;4) Regarding the using MKL in MSVS2013 IDE. &amp;nbsp;You may refer to the online article.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-with-microsoft-visual-cc/" target="_blank"&gt;https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-with-microsoft-visual-cc/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;or you can use the way of command line build as showed in cluster sample in &amp;nbsp;C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.xxx \windows\mkl\examples. &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;(if you build MPI code in &amp;nbsp;MSVC IDT, you may also refer to Intel MPI documentation)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/articles/intel-math-kernel-library-parallel-direct-sparse-solver-for-clusters" target="_blank"&gt;https://software.intel.com/en-us/articles/intel-math-kernel-library-parallel-direct-sparse-solver-for-clusters&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 04:17:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-to-use-MKL-Routines-for-Matrix-Inversion/m-p/1067499#M21996</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2016-07-25T04:17:45Z</dc:date>
    </item>
  </channel>
</rss>

