<?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 Re: Why the function “LAPACKE_spbtrf” of Intel MKL library keeps returning 1? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212721#M30116</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Hi , Mecej, thanks! But I got the same problem with another matrix using the Netlib band matrix storage mode. Please help me with it. The link is :&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;A href="https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-quot-LAPACKE-spbtrf-quot-always-return-quot-6-quot/m-p/1212720#M30115" target="_blank"&gt;https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-quot-LAPACKE-spbtrf-quot-always-return-quot-6-quot/m-p/1212720#M30115&lt;/A&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 26 Sep 2020 13:45:25 GMT</pubDate>
    <dc:creator>charlesqhappy</dc:creator>
    <dc:date>2020-09-26T13:45:25Z</dc:date>
    <item>
      <title>Why the function “LAPACKE_spbtrf” of Intel MKL library keeps returning 1?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212636#M30110</link>
      <description>&lt;DIV class="s-prose js-post-body"&gt;
&lt;P&gt;guys, I'm using the function "LAPACKE_spbtrs" of MKL library to solve symmetric-positive-definite-band matrix equations. The 1st step is factorizing the matrix by "LAPACKE_spbtrf" according to the office website: &lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/mkl-developer-reference-c/top/lapack-routines/lapack-linear-equation-routines/lapack-linear-equation-computational-routines/solving-systems-of-linear-equations-lapack-computational-routines/pbtrs.html#pbtrs" rel="nofollow noreferrer" target="_blank"&gt;https://software.intel.com/content/www/us/en/develop/documentation/mkl-developer-reference-c/top/lapack-routines/lapack-linear-equation-routines/lapack-linear-equation-computational-routines/solving-systems-of-linear-equations-lapack-computational-routines/pbtrs.html#pbtrs&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;But when I run the "LAPACKE_spbtrf", it always return 1, which indicates that the input matrix is not positive-definite. But I'm pretty sure it is.&lt;/P&gt;
&lt;P&gt;Here is the full code:&lt;/P&gt;
&lt;PRE class="lang-cpp s-code-block hljs"&gt;&lt;CODE&gt;&lt;SPAN class="hljs-comment"&gt;/* Parameters */&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;#define N 5&lt;/P&gt;
&lt;P&gt;#define NRHS 1&lt;/P&gt;
&lt;P&gt;#define LDA N&lt;/P&gt;
&lt;P&gt;#define LDB NRHS&lt;/P&gt;
&lt;P&gt;/* Main program */ int main() {&lt;/P&gt;
&lt;PRE class="lang-cpp s-code-block hljs"&gt;&lt;CODE&gt;&lt;SPAN class="hljs-comment"&gt;//convert a symmetric band matrix A to lower band storage mode LA&lt;/SPAN&gt;
&lt;SPAN class="hljs-comment"&gt;/*A =  1 1
       1 3
*/&lt;/SPAN&gt;

&lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; ab[&lt;SPAN class="hljs-number"&gt;4&lt;/SPAN&gt;] = { &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;,&lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;,
                &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;,&lt;SPAN class="hljs-number"&gt;3&lt;/SPAN&gt; };
&lt;SPAN class="hljs-keyword"&gt;const&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; n = &lt;SPAN class="hljs-number"&gt;2&lt;/SPAN&gt;;
&lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; kd = &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;;
&lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; lda = kd + &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;;
&lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; info = LAPACKE_spbtrf(LAPACK_ROW_MAJOR, &lt;SPAN class="hljs-string"&gt;'L'&lt;/SPAN&gt;, n, kd, ab, lda);
&lt;SPAN class="hljs-built_in"&gt;std&lt;/SPAN&gt;::&lt;SPAN class="hljs-built_in"&gt;cout&lt;/SPAN&gt; &amp;lt;&amp;lt; &lt;SPAN class="hljs-string"&gt;"info:"&lt;/SPAN&gt; &amp;lt;&amp;lt; info &amp;lt;&amp;lt; &lt;SPAN class="hljs-built_in"&gt;std&lt;/SPAN&gt;::&lt;SPAN class="hljs-built_in"&gt;endl&lt;/SPAN&gt;;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;What am I missing?&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sat, 26 Sep 2020 02:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212636#M30110</guid>
      <dc:creator>charlesqhappy</dc:creator>
      <dc:date>2020-09-26T02:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why the function “LAPACKE_spbtrf” of Intel MKL library keeps returning 1?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212638#M30111</link>
      <description>&lt;P&gt;Intersting, when I set the lower mode&amp;nbsp; "L" to upper mode "U", the function will return 0, which indicate sucess. But I suppose I do store the lower part of the original matrix, right?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 02:57:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212638#M30111</guid>
      <dc:creator>charlesqhappy</dc:creator>
      <dc:date>2020-09-26T02:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why the function “LAPACKE_spbtrf” of Intel MKL library keeps returning 1?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212645#M30112</link>
      <description>&lt;P&gt;If you wanted to provide the lower triangle of the symmetric matrix, following the conventions at&amp;nbsp;&lt;A href="https://www.netlib.org/lapack/lug/node124.html" target="_self"&gt;Netlib&lt;/A&gt;&amp;nbsp;, you should set the values into the matrix using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;float ab[4] = { 1,3,
                1,0 };&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is, the main diagonal should be in the first row, followed by the sub-diagonal in the second row. The zero is just a placeholder, since the subdiagonal has only one element, and that zero corresponds to the '*' in the diagram at the link that I listed.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 04:59:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212645#M30112</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-09-26T04:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why the function “LAPACKE_spbtrf” of Intel MKL library keeps returning 1?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212648#M30113</link>
      <description>&lt;P&gt;Hey Mecej, thanks very very much, it works! This problem has annoyed me 3 days. But I still have a confusion. It is that &lt;STRONG&gt;why I should use the band storage mode of Netlib instead of the MKL's?&lt;/STRONG&gt;&amp;nbsp; After all, I'm calling the function of MKL. And the MKl website gives a different storage mode of the band matrix, of which the diagonal elements are in a column :(I use row major layout as you can see in my funcion "LAPACKE_spbtrf")&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="微信截图_20200926130741.png" style="width: 999px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/12884iCC23997752949E3F/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="微信截图_20200926130741.png" alt="微信截图_20200926130741.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But in Netlib, they are in a row:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="n.png" style="width: 782px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/12885i8683CE2B0EC1DBE6/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="n.png" alt="n.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 05:15:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212648#M30113</guid>
      <dc:creator>charlesqhappy</dc:creator>
      <dc:date>2020-09-26T05:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why the function “LAPACKE_spbtrf” of Intel MKL library keeps returning 1?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212693#M30114</link>
      <description>&lt;P&gt;Let me answer in a broad way since, if I try to analyze what went wrong with your original attempt, it is easy to get confused by C versus Fortran, row versus column versus band storage, and the version of MKL that you use versus the version of the MKL documentation that I refer to, etc.&lt;/P&gt;
&lt;P&gt;Lapack is open source, and is maintained and contributed to by a large number of people from around the world. That fact can tend to increase inconsistencies between the software and the documentation, but there is a counter-influence: people worldwide use Lapack, and discrepancies get reported and fixed quickly.&lt;/P&gt;
&lt;P&gt;MKL is different. It is closed source, and belongs to Intel. Lapack is a small subset of what MKL covers, and the MKL documentation has to cover much more than Lapack. Secondly, C users will probably use the LapackE interface to Lapack, and LapackE is somewhat of a step-child.&lt;/P&gt;
&lt;P&gt;In the specific case of SPBTRF, the&amp;nbsp;&lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/mkl-developer-reference-c/top/lapack-routines/lapack-linear-equation-routines/lapack-linear-equation-computational-routines/matrix-factorization-lapack-computational-routines/pbtrf.html" target="_self"&gt;MKL&lt;/A&gt;&amp;nbsp; documentation and the&amp;nbsp;&lt;A href="http://www.netlib.org/lapack/explore-html/d1/df5/group__real_o_t_h_e_rcomputational_gaf94527c1f64a52c41d124fd3dc9284e5.html#gaf94527c1f64a52c41d124fd3dc9284e5" target="_self"&gt;Netlib&lt;/A&gt;&amp;nbsp;documentation differ regarding the argument AB. In such cases, my inclination is to follow the Netlib documentation and see if that works. You also made LDAB = KD+1, which makes the 1-D array that you passed for AB completely equivalent to the packed 2-D array that should have been used.&lt;/P&gt;
&lt;P&gt;During the last few years, it did not help that at times the MKL documentation for C and Fortran usage was merged into a single document. The result was, at least for the BLAS and Lapack parts, that usually half the monolingual (i.e., C/Fortran) readers were left confused. This problem persists in some places in the current MKL documentation, even though the C and Fortran versions have been "separated". One could say, "they have taken the C out of the Fortran, but they failed to take the Fortran out of the C". There are parts of MKL where the opposite is true.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 10:29:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212693#M30114</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-09-26T10:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why the function “LAPACKE_spbtrf” of Intel MKL library keeps returning 1?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212721#M30116</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Hi , Mecej, thanks! But I got the same problem with another matrix using the Netlib band matrix storage mode. Please help me with it. The link is :&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;A href="https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-quot-LAPACKE-spbtrf-quot-always-return-quot-6-quot/m-p/1212720#M30115" target="_blank"&gt;https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-quot-LAPACKE-spbtrf-quot-always-return-quot-6-quot/m-p/1212720#M30115&lt;/A&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2020 13:45:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Why-the-function-LAPACKE-spbtrf-of-Intel-MKL-library-keeps/m-p/1212721#M30116</guid>
      <dc:creator>charlesqhappy</dc:creator>
      <dc:date>2020-09-26T13:45:25Z</dc:date>
    </item>
  </channel>
</rss>

