<?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 Matrix inversion and MATMUL  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836054#M6053</link>
    <description>&lt;P&gt;The documentation states that the matrix a is overwritten by the n-by-n matrix inv(A), which I took to mean the whole matrix.&lt;BR /&gt;&lt;BR /&gt;I understood your comment to mean that potri returns the upper triangular matrix of the inverse matrix.&lt;BR /&gt;I therefore set the lower diagonal terms to zero and then calculated Utranspose*U (see commands below). However, this does not seem to give me the right inverse. When I multiply the original matrix, by this, I still don't get the identity matrix. In the code below T2 does not contain the identity matrix&lt;BR /&gt;&lt;BR /&gt;How does one get the inverse matrix from what is outputby POTRI?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;CALL potrf(TRUELAMBDA)&lt;/P&gt;&lt;P&gt;write(*,*) 'factored'&lt;/P&gt;&lt;P&gt;write(*,10) ((TRUELAMBDA(I,J),J=1,4),I=1,4)&lt;/P&gt;&lt;P&gt;CALL potri(TRUELAMBDA)&lt;/P&gt;&lt;P&gt;write(*,*) 'inverse'&lt;/P&gt;&lt;P&gt;write(*,10) ((TRUELAMBDA(I,J),J=1,4),I=1,4)&lt;/P&gt;&lt;P&gt;forall (j=1:4)&lt;/P&gt;&lt;P&gt;forall (i=4:j+1:-1)&lt;/P&gt;&lt;P&gt;TRUELAMBDA(i,j)=0.0d0&lt;/P&gt;&lt;P&gt;end forall&lt;/P&gt;&lt;P&gt;end forall&lt;/P&gt;&lt;P&gt;write(*,10)((TRUELAMBDA(I,J),J=1,4),I=1,4)&lt;/P&gt;&lt;P&gt;T1=MATMUL(TRANSPOSE(TRUELAMBDA),TRUELAMBDA)&lt;/P&gt;&lt;P&gt;t2=matmul(t,t1)&lt;/P&gt;</description>
    <pubDate>Mon, 23 Aug 2010 17:03:07 GMT</pubDate>
    <dc:creator>ssiddarth</dc:creator>
    <dc:date>2010-08-23T17:03:07Z</dc:date>
    <item>
      <title>Matrix inversion and MATMUL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836050#M6049</link>
      <description>In trying to debug a program and figure out what was happening I wrote a simple program that inverts a matrix and multiplies it by its inverse. The problem is that I don't get back the identity matrix. Thus in the program below T1 is not the identity matrix.&lt;BR /&gt;&lt;BR /&gt;Another issue I discovered is that I get a compilation error when I try to use the general matrix inversion routine "call getri( truelambda, ipiv )". The error is C:\\Allwork\\PROJECTS\\SML\\FORTRAN\\PROGRAMS\\Test3.f90(19): error #6285: There is no matching specific subroutine for this generic subroutine call. [GETRI]&lt;BR /&gt;&lt;BR /&gt;Any help would be appreciated.&lt;BR /&gt;&lt;BR /&gt;Siddarth&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;PROGRAM TRUE_PARAMS&lt;/P&gt;&lt;P&gt;USE MKL95_LAPACK&lt;/P&gt;&lt;P&gt;USE MKL95_PRECISION&lt;/P&gt;&lt;P&gt;IMPLICIT NONE&lt;/P&gt;&lt;P&gt;REAL*8 :: LBD12(4,4),T(4,4),TRUELAMBDA(4,4),T1(4,4),ipiv(1,4)&lt;/P&gt;&lt;P&gt;INTEGER :: I, J&lt;/P&gt;&lt;P&gt;DATA ((LBD12(I, J), J = 1,4), I = 1,4) / 5, 5, -1, 1, 0, 4, -2, 0, 0, 0, 3, 2, 0, 0,0, 1 / &lt;/P&gt;&lt;P&gt;LBD12=LBD12/2.0D0&lt;/P&gt;&lt;P&gt;TRUELAMBDA=MATMUL(TRANSPOSE(LBD12),LBD12)&lt;/P&gt;&lt;P&gt;T=TRUELAMBDA&lt;/P&gt;&lt;P&gt;CALL potrf(TRUELAMBDA)&lt;/P&gt;&lt;P&gt;CALL potri(TRUELAMBDA)&lt;/P&gt;&lt;P&gt;T1=MATMUL(T,TRUELAMBDA)&lt;/P&gt;&lt;P&gt;!CALL getrf(TRUELAMBDA)&lt;/P&gt;&lt;P&gt;!call getri( truelambda, ipiv )&lt;/P&gt;&lt;P&gt;!T1=MATMUL(T,TRUELAMBDA)&lt;/P&gt;&lt;P&gt;END PROGRAM TRUE_PARAMS&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2010 21:04:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836050#M6049</guid>
      <dc:creator>ssiddarth</dc:creator>
      <dc:date>2010-08-20T21:04:08Z</dc:date>
    </item>
    <item>
      <title>Matrix inversion and MATMUL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836051#M6050</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I will try to address the second problem you described (as it's easier to spot), namely, that there is no matching specific subroutine for generic GETRI. Well, your ipiv definition is incorrect. The routine expects array (vector) of length = max(1,n), so in your case you shoudl declare it as ipiv(4). As the expected number of dimensions is 1, and you gave 2, so.....&lt;BR /&gt;&lt;BR /&gt;A.</description>
      <pubDate>Sat, 21 Aug 2010 03:42:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836051#M6050</guid>
      <dc:creator>ArturGuzik</dc:creator>
      <dc:date>2010-08-21T03:42:29Z</dc:date>
    </item>
    <item>
      <title>Matrix inversion and MATMUL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836052#M6051</link>
      <description>Thanks for pointing that out. Now GETRI works fine.&lt;BR /&gt;&lt;BR /&gt;However, even when I use the getrf and getri sequence to invert the original matrix the product of the matrix and its inverse is not the identity matrix.&lt;BR /&gt;&lt;BR /&gt;S.</description>
      <pubDate>Sun, 22 Aug 2010 21:16:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836052#M6051</guid>
      <dc:creator>ssiddarth</dc:creator>
      <dc:date>2010-08-22T21:16:01Z</dc:date>
    </item>
    <item>
      <title>Matrix inversion and MATMUL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836053#M6052</link>
      <description>The call to ?POTRF computes the upper or lower triangular Cholesky factor of the input matrix. The subsequent call to ?POTRI returns only the corresponding triangular part of the inverse. &lt;BR /&gt;&lt;BR /&gt;The MKL documentation is not quite clear about this point. &lt;BR /&gt;&lt;BR /&gt;Furthermore, the documentation of the F95 interface POTRI should state that the argument A contains at subroutine entry the triangular factor resulting from a prior call to POTRF, rather than the original matrix A.&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Aug 2010 02:55:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836053#M6052</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2010-08-23T02:55:51Z</dc:date>
    </item>
    <item>
      <title>Matrix inversion and MATMUL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836054#M6053</link>
      <description>&lt;P&gt;The documentation states that the matrix a is overwritten by the n-by-n matrix inv(A), which I took to mean the whole matrix.&lt;BR /&gt;&lt;BR /&gt;I understood your comment to mean that potri returns the upper triangular matrix of the inverse matrix.&lt;BR /&gt;I therefore set the lower diagonal terms to zero and then calculated Utranspose*U (see commands below). However, this does not seem to give me the right inverse. When I multiply the original matrix, by this, I still don't get the identity matrix. In the code below T2 does not contain the identity matrix&lt;BR /&gt;&lt;BR /&gt;How does one get the inverse matrix from what is outputby POTRI?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;CALL potrf(TRUELAMBDA)&lt;/P&gt;&lt;P&gt;write(*,*) 'factored'&lt;/P&gt;&lt;P&gt;write(*,10) ((TRUELAMBDA(I,J),J=1,4),I=1,4)&lt;/P&gt;&lt;P&gt;CALL potri(TRUELAMBDA)&lt;/P&gt;&lt;P&gt;write(*,*) 'inverse'&lt;/P&gt;&lt;P&gt;write(*,10) ((TRUELAMBDA(I,J),J=1,4),I=1,4)&lt;/P&gt;&lt;P&gt;forall (j=1:4)&lt;/P&gt;&lt;P&gt;forall (i=4:j+1:-1)&lt;/P&gt;&lt;P&gt;TRUELAMBDA(i,j)=0.0d0&lt;/P&gt;&lt;P&gt;end forall&lt;/P&gt;&lt;P&gt;end forall&lt;/P&gt;&lt;P&gt;write(*,10)((TRUELAMBDA(I,J),J=1,4),I=1,4)&lt;/P&gt;&lt;P&gt;T1=MATMUL(TRANSPOSE(TRUELAMBDA),TRUELAMBDA)&lt;/P&gt;&lt;P&gt;t2=matmul(t,t1)&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2010 17:03:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836054#M6053</guid>
      <dc:creator>ssiddarth</dc:creator>
      <dc:date>2010-08-23T17:03:07Z</dc:date>
    </item>
    <item>
      <title>Matrix inversion and MATMUL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836055#M6054</link>
      <description>&lt;I&gt;I understood your comment to mean that potri returns the upper triangular matrix of the inverse matrix&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;It returns the upper triangular &lt;SPAN style="text-decoration: underline;"&gt;sub-&lt;/SPAN&gt;matrix.&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;How does one get the inverse matrix from what is outputby POTRI?&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;By symmetry; &lt;BR /&gt;&lt;BR /&gt;(i) if you called POTRI(A,UPLO) with UPLO='U' or with no UPLO argument, after return from POTRI set a(i,j) = a(j,i) for i &amp;gt; j; in other words, obtain the other triangle by reflection in the diagonal.&lt;BR /&gt;&lt;BR /&gt;(ii) if you used UPLO='L', after return from POTRI set a(i,j) = a(j,i) for i &amp;lt; j&lt;BR /&gt;&lt;BR /&gt;This should become obvious upon a little reflection (pun intended): Cholesky factorization is possible only for positive definite matrices. On the other hand a general matrix multiplication routine knows nothing about symmetric matrices, triangular storage, etc. What it expects are full matrices; therefore, you have to flesh out your symmetric matrices if they are presently in any other form than full-matrix form, before calling MATMULT. Alternatively, if you had a special matrix-multiply routine for symmetric matrices, you could have used that routine.&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Aug 2010 18:01:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836055#M6054</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2010-08-23T18:01:07Z</dc:date>
    </item>
    <item>
      <title>Matrix inversion and MATMUL</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836056#M6055</link>
      <description>Thanks! &lt;BR /&gt;&lt;BR /&gt;Sorry, you're right, it wasn't a great question.</description>
      <pubDate>Mon, 23 Aug 2010 18:14:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Matrix-inversion-and-MATMUL/m-p/836056#M6055</guid>
      <dc:creator>ssiddarth</dc:creator>
      <dc:date>2010-08-23T18:14:43Z</dc:date>
    </item>
  </channel>
</rss>

