<?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 solving system of linear algebraic equations, dgesv in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/solving-system-of-linear-algebraic-equations-dgesv/m-p/875723#M8902</link>
    <description>&lt;P&gt;I want to solve system of linear algebraic equations with function dgesv. I want to understand how to use MKL functions from C++, but all examples are written forFortran.&lt;BR /&gt;&lt;BR /&gt;double a1[16]={1.80, 2.88, 2.05, -0.89,&lt;BR /&gt; 5.25, -2.95, -0.95, -3.80,&lt;BR /&gt; 1.58, -2.69, -2.90, -1.04,&lt;BR /&gt; -1.11, -0.66, -0.59, 0.80};&lt;BR /&gt; double b1[4]={9.52, 24.35, 0.77, -6.22};&lt;/P&gt;
&lt;P&gt;int N1=1,info,Size=4;&lt;BR /&gt;int *ipiv = new int[Size];&lt;BR /&gt;dgesv(&amp;amp;Size,&amp;amp;N1,a1,&amp;amp;Size,ipiv,b1,&amp;amp;Size,&amp;amp;info);&lt;BR /&gt;&lt;BR /&gt;Arrayb1 must contain solution of system (1,-1,3,-5), but it contains other values(-1.37, -9.78, 10.53, -42.06). &lt;BR /&gt;What's my mistake? May be, because ofindexing? (in C++ from 0, in Fortran from 1) &lt;BR /&gt;And I shoulddefine arrays a1 and b1as&lt;BR /&gt;double a1[16]={ 0, 0, 0, 0, 0,&lt;BR /&gt; 0, 1.80, 2.88, 2.05, -0.89,&lt;BR /&gt;0, 5.25, -2.95, -0.95, -3.80,&lt;BR /&gt;0, 1.58, -2.69, -2.90, -1.04,&lt;BR /&gt; 0, -1.11, -0.66, -0.59, 0.80};&lt;BR /&gt;double b1[4]={0, 9.52, 24.35, 0.77, -6.22}; &lt;BR /&gt;&lt;BR /&gt;Or not?&lt;/P&gt;</description>
    <pubDate>Sat, 21 Mar 2009 15:58:34 GMT</pubDate>
    <dc:creator>shapovalov</dc:creator>
    <dc:date>2009-03-21T15:58:34Z</dc:date>
    <item>
      <title>solving system of linear algebraic equations, dgesv</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/solving-system-of-linear-algebraic-equations-dgesv/m-p/875723#M8902</link>
      <description>&lt;P&gt;I want to solve system of linear algebraic equations with function dgesv. I want to understand how to use MKL functions from C++, but all examples are written forFortran.&lt;BR /&gt;&lt;BR /&gt;double a1[16]={1.80, 2.88, 2.05, -0.89,&lt;BR /&gt; 5.25, -2.95, -0.95, -3.80,&lt;BR /&gt; 1.58, -2.69, -2.90, -1.04,&lt;BR /&gt; -1.11, -0.66, -0.59, 0.80};&lt;BR /&gt; double b1[4]={9.52, 24.35, 0.77, -6.22};&lt;/P&gt;
&lt;P&gt;int N1=1,info,Size=4;&lt;BR /&gt;int *ipiv = new int[Size];&lt;BR /&gt;dgesv(&amp;amp;Size,&amp;amp;N1,a1,&amp;amp;Size,ipiv,b1,&amp;amp;Size,&amp;amp;info);&lt;BR /&gt;&lt;BR /&gt;Arrayb1 must contain solution of system (1,-1,3,-5), but it contains other values(-1.37, -9.78, 10.53, -42.06). &lt;BR /&gt;What's my mistake? May be, because ofindexing? (in C++ from 0, in Fortran from 1) &lt;BR /&gt;And I shoulddefine arrays a1 and b1as&lt;BR /&gt;double a1[16]={ 0, 0, 0, 0, 0,&lt;BR /&gt; 0, 1.80, 2.88, 2.05, -0.89,&lt;BR /&gt;0, 5.25, -2.95, -0.95, -3.80,&lt;BR /&gt;0, 1.58, -2.69, -2.90, -1.04,&lt;BR /&gt; 0, -1.11, -0.66, -0.59, 0.80};&lt;BR /&gt;double b1[4]={0, 9.52, 24.35, 0.77, -6.22}; &lt;BR /&gt;&lt;BR /&gt;Or not?&lt;/P&gt;</description>
      <pubDate>Sat, 21 Mar 2009 15:58:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/solving-system-of-linear-algebraic-equations-dgesv/m-p/875723#M8902</guid>
      <dc:creator>shapovalov</dc:creator>
      <dc:date>2009-03-21T15:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: solving system of linear algebraic equations, dgesv</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/solving-system-of-linear-algebraic-equations-dgesv/m-p/875724#M8903</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/418036"&gt;shapovalov&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;P&gt;I want to solve system of linear algebraic equations with function dgesv. I want to understand how to use MKL functions from C++, but all examples are written forFortran.&lt;BR /&gt;&lt;BR /&gt; double a1[16]={1.80, 2.88, 2.05, -0.89,&lt;BR /&gt; 5.25, -2.95, -0.95, -3.80,&lt;BR /&gt; 1.58, -2.69, -2.90, -1.04,&lt;BR /&gt; -1.11, -0.66, -0.59, 0.80};&lt;BR /&gt; double b1[4]={9.52, 24.35, 0.77, -6.22};&lt;/P&gt;
&lt;P&gt;int N1=1,info,Size=4;&lt;BR /&gt;int *ipiv = new int[Size];&lt;BR /&gt;dgesv(&amp;amp;Size,&amp;amp;N1,a1,&amp;amp;Size,ipiv,b1,&amp;amp;Size,&amp;amp;info);&lt;BR /&gt;&lt;BR /&gt;Arrayb1 must contain solution of system (1,-1,3,-5), but it contains other values(-1.37, -9.78, 10.53, -42.06). &lt;BR /&gt;What's my mistake? May be, because ofindexing? (in C++ from 0, in Fortran from 1) &lt;BR /&gt;And I shoulddefine arrays a1 and b1as&lt;BR /&gt;double a1[16]={ 0, 0, 0, 0, 0,&lt;BR /&gt; 0, 1.80, 2.88, 2.05, -0.89,&lt;BR /&gt; 0, 5.25, -2.95, -0.95, -3.80,&lt;BR /&gt; 0, 1.58, -2.69, -2.90, -1.04,&lt;BR /&gt; 0, -1.11, -0.66, -0.59, 0.80};&lt;BR /&gt;double b1[4]={0, 9.52, 24.35, 0.77, -6.22}; &lt;BR /&gt;&lt;BR /&gt;Or not?&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I might be wrong but:&lt;BR /&gt;&lt;BR /&gt;(1) dgesv is LAPACK function&lt;BR /&gt;&lt;BR /&gt;(2) it takes a coefficient matrix, that is, A&lt;M&gt;&lt;M&gt;, and not A[m x m] (observe size/indexing issue)&lt;BR /&gt;&lt;BR /&gt;(3) for LAPACK call consider matrix reordering (to Fortran style column-wise), passing first argument may go (may not?) into play.&lt;BR /&gt;&lt;BR /&gt;(4) LAPACK also requires passing data by address and not value&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;All that is summarized, for example, &lt;A title="here" href="http://www.physics.utah.edu/~detar/phys6720/handouts/lapack.html"&gt;here&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A.&lt;BR /&gt;&lt;/M&gt;&lt;/M&gt;</description>
      <pubDate>Sun, 22 Mar 2009 08:51:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/solving-system-of-linear-algebraic-equations-dgesv/m-p/875724#M8903</guid>
      <dc:creator>ArturGuzik</dc:creator>
      <dc:date>2009-03-22T08:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: solving system of linear algebraic equations, dgesv</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/solving-system-of-linear-algebraic-equations-dgesv/m-p/875725#M8904</link>
      <description>&lt;DIV style="margin:0px;"&gt;Thank you very much. I realized what my mistake. The matrixashould be transposed.&lt;/DIV&gt;</description>
      <pubDate>Sun, 22 Mar 2009 13:30:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/solving-system-of-linear-algebraic-equations-dgesv/m-p/875725#M8904</guid>
      <dc:creator>shapovalov</dc:creator>
      <dc:date>2009-03-22T13:30:18Z</dc:date>
    </item>
  </channel>
</rss>

