<?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 Invert Matrix from C in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Invert-Matrix-from-C/m-p/871425#M8536</link>
    <description>&lt;P&gt;I know this is trivial but i cant find the answer anywhere else:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;have in C, matrix A[16][16] [A is not symmetric.] that i want to invert. I have this code which is giving incorrect answer:&lt;/P&gt;
&lt;P&gt;void inverseRD ( float* I, float* A, int N)&lt;BR /&gt;&lt;BR /&gt;float work [WTDIM][WTDIM]; &lt;BR /&gt; float *p; &lt;BR /&gt; p = &amp;amp;work[0][0];&lt;BR /&gt; int ipivot [256];&lt;BR /&gt; int lwork = 256;&lt;/P&gt;
&lt;P&gt;sgetrf ( &amp;amp;N, &amp;amp;N, A, &amp;amp;N, &amp;amp;ipivot[0], &amp;amp;info);&lt;BR /&gt; sgetri ( &amp;amp;N, I, &amp;amp;N, &amp;amp;ipivot[0], p, &amp;amp;lwork, &amp;amp;info);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I assume i have made an error in passing parameters but I cant see it.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Mar 2010 20:32:04 GMT</pubDate>
    <dc:creator>jmorgie</dc:creator>
    <dc:date>2010-03-11T20:32:04Z</dc:date>
    <item>
      <title>Invert Matrix from C</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Invert-Matrix-from-C/m-p/871425#M8536</link>
      <description>&lt;P&gt;I know this is trivial but i cant find the answer anywhere else:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;have in C, matrix A[16][16] [A is not symmetric.] that i want to invert. I have this code which is giving incorrect answer:&lt;/P&gt;
&lt;P&gt;void inverseRD ( float* I, float* A, int N)&lt;BR /&gt;&lt;BR /&gt;float work [WTDIM][WTDIM]; &lt;BR /&gt; float *p; &lt;BR /&gt; p = &amp;amp;work[0][0];&lt;BR /&gt; int ipivot [256];&lt;BR /&gt; int lwork = 256;&lt;/P&gt;
&lt;P&gt;sgetrf ( &amp;amp;N, &amp;amp;N, A, &amp;amp;N, &amp;amp;ipivot[0], &amp;amp;info);&lt;BR /&gt; sgetri ( &amp;amp;N, I, &amp;amp;N, &amp;amp;ipivot[0], p, &amp;amp;lwork, &amp;amp;info);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I assume i have made an error in passing parameters but I cant see it.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2010 20:32:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Invert-Matrix-from-C/m-p/871425#M8536</guid>
      <dc:creator>jmorgie</dc:creator>
      <dc:date>2010-03-11T20:32:04Z</dc:date>
    </item>
    <item>
      <title>Invert Matrix from C</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Invert-Matrix-from-C/m-p/871426#M8537</link>
      <description>&lt;P&gt;I rewrote your code correcting some small errors, and making it a little smaller so that you can test. You might need to remove the underscores because I did not do this with MKL, but just LAPACK. My version destroys the original matrix as the sgetrf and sgetri will anyway, so you should make a copy of the original matrix to work with the routines.&lt;/P&gt;
&lt;P&gt;1. info has not been declared as an integer.&lt;/P&gt;
&lt;P&gt;2. ipivot can be passed as shown below, though your method is probably OK.&lt;/P&gt;
&lt;P&gt;#include &lt;BR /&gt;&lt;BR /&gt;void inverseRD (float *A, int N)&lt;BR /&gt;{&lt;BR /&gt;float work [2][2];&lt;BR /&gt;int ipivot [4];&lt;BR /&gt;int lwork = 4;&lt;BR /&gt;int info;&lt;BR /&gt;&lt;BR /&gt;sgetrf_( &amp;amp;N, &amp;amp;N, A, &amp;amp;N, ipivot, &amp;amp;info);&lt;BR /&gt;sgetri_( &amp;amp;N, A, &amp;amp;N, ipivot, work, &amp;amp;lwork, &amp;amp;info);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; float A[4]={2,1,1,2}, B[4];&lt;BR /&gt; inverseRD(A,2);&lt;BR /&gt; printf("%f %f %f %f\n",A[0],A[1],A[2],A[3]);&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2010 01:15:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Invert-Matrix-from-C/m-p/871426#M8537</guid>
      <dc:creator>Melvin_Robinson</dc:creator>
      <dc:date>2010-03-12T01:15:45Z</dc:date>
    </item>
  </channel>
</rss>

