<?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 issue with LAPACKE_dormqr in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781717#M1507</link>
    <description>&lt;I&gt;&amp;gt; But AFAIK Q'*C should give the same result specially like as you say matlab &amp;gt; is just invoking MKL under the hood.&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;Two points: &lt;BR /&gt;&lt;BR /&gt;1) The version of MKL used by Matlab need not be the same as the one used by your Fortran/C compiler.&lt;BR /&gt;&lt;BR /&gt;2) If Matlab gives you Q&lt;SUB&gt;1&lt;/SUB&gt; and Fortran/C gives you Q&lt;SUB&gt;2&lt;/SUB&gt; = -Q&lt;SUB&gt;1&lt;/SUB&gt;, Q&lt;SUB&gt;1&lt;/SUB&gt;'C will be equal to -Q&lt;SUB&gt;2&lt;/SUB&gt;'C, since you are supplying the C after the decomposition was performed.&lt;BR /&gt;</description>
    <pubDate>Thu, 29 Mar 2012 15:58:00 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2012-03-29T15:58:00Z</dc:date>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781714#M1504</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have a matrix A=QR and the QR decomposition is computed using LAPACKE_dgeqrf. To be more concrete A and the output QR are included below. At this point I append a new column to A and it becomes A1, A1 is included below as well. At this point, I try to apply an update which requires computing first Q'*A1 and therefore I use the function LAPACKE_dormqr. This below is the documentation and the way I am invoking it for my given matrices:&lt;BR /&gt;&lt;BR /&gt;matrix A of dimensions 4 x 2:&lt;BR /&gt;=================== &lt;BR /&gt;7.500000e+01 4.000000e+00 &lt;BR /&gt;4.000000e+01 2.800000e+01 &lt;BR /&gt;6.600000e+01 5.000000e+00 &lt;BR /&gt;1.800000e+01 1.000000e+01&lt;BR /&gt;&lt;BR /&gt;matrix QR of dimensions 4 x 2:&lt;BR /&gt;=================== &lt;BR /&gt;-1.091100e+02 -1.768857e+01 &lt;BR /&gt;2.172614e-01 -2.474095e+01 &lt;BR /&gt;3.584813e-01 -5.777660e-02 &lt;BR /&gt;9.776762e-02 1.640589e-01&lt;BR /&gt;&lt;BR /&gt;matrix A1 of dimensions 4 x 3:&lt;BR /&gt;===================&lt;BR /&gt;7.500000e+01 4.000000e+00 3.900000e+01 &lt;BR /&gt;4.000000e+01 2.800000e+01 7.700000e+01 &lt;BR /&gt;6.600000e+01 5.000000e+00 8.000000e+01 &lt;BR /&gt;1.800000e+01 1.000000e+01 1.900000e+01&lt;BR /&gt;&lt;BR /&gt;mklman.pdf MKL 10.3 Update 9:&lt;BR /&gt;=================== &lt;BR /&gt;C:&lt;BR /&gt;lapack_int LAPACKE_ormqr( int matrix_order, char side, char trans, lapack_int m,&lt;BR /&gt;lapack_int n, lapack_int k, const &lt;DATATYPE&gt;* a, lapack_int lda, const &lt;DATATYPE&gt;*&lt;BR /&gt;tau, &lt;DATATYPE&gt;* c, lapack_int ldc );&lt;BR /&gt;&lt;BR /&gt;int l_order = LAPACK_COL_MAJOR;&lt;BR /&gt;lapack_int m = 4; // C-&amp;gt;rows;&lt;BR /&gt;lapack_int n = 3; // C-&amp;gt;cols;&lt;BR /&gt;lapack_int k = 3; // B-&amp;gt;QR-&amp;gt;rows;&lt;BR /&gt;lapack_int lda = m;&lt;BR /&gt;lapack_int ldc = m;&lt;BR /&gt;lapack_int info = 0;&lt;BR /&gt;lapack_int info = LAPACKE_dormqr(l_order, 'L', 'T', m, n, k, B-&amp;gt;QR-&amp;gt;data, lda, B-&amp;gt;tau-&amp;gt;data, C-&amp;gt;data, ldc);&lt;BR /&gt;&lt;BR /&gt;So far so good, but now the matrix coming out Q'*A1 is:&lt;BR /&gt;&lt;BR /&gt;matrix Q'*A1 of dimensions 4 x 3 &lt;BR /&gt;=================== &lt;BR /&gt;-1.091100e+02 -1.768857e+01 -1.065621e+02 &lt;BR /&gt;0.000000e+00 -2.474095e+01 -4.110871e+01 &lt;BR /&gt;0.000000e+00 0.000000e+00 3.281543e+01 &lt;BR /&gt;0.000000e+00 8.881784e-16 -9.419678e+00&lt;BR /&gt;&lt;BR /&gt;Cross checking with matlab turns out that the elements in column Q'*A1(:,3) are incorrect ... what am I doing wrong here?&lt;BR /&gt;&lt;BR /&gt;This is the same but done using matlab:&lt;BR /&gt;&amp;gt;&amp;gt; A = [7.500000e+01 4.000000e+00;&lt;BR /&gt; 4.000000e+01 2.800000e+01;&lt;BR /&gt; 6.600000e+01 5.000000e+00;&lt;BR /&gt; 1.800000e+01 1.000000e+01]&lt;BR /&gt;&lt;BR /&gt;A =&lt;BR /&gt;&lt;BR /&gt; 75 4&lt;BR /&gt; 40 28&lt;BR /&gt; 66 5&lt;BR /&gt; 18 10&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; A1 = [A [39 77 80 19]']&lt;BR /&gt;&lt;BR /&gt;A1 =&lt;BR /&gt;&lt;BR /&gt; 75 4 39&lt;BR /&gt; 40 28 77&lt;BR /&gt; 66 5 80&lt;BR /&gt; 18 10 19&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; [Q R] = qr(A)&lt;BR /&gt;&lt;BR /&gt;Q =&lt;BR /&gt;&lt;BR /&gt; 0.6874 -0.3298 -0.5647 0.3161&lt;BR /&gt; 0.3666 0.8696 -0.2063 -0.2585&lt;BR /&gt; 0.6049 -0.2304 0.6340 -0.4232&lt;BR /&gt; 0.1650 0.2862 0.4865 0.8088&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;R =&lt;BR /&gt;&lt;BR /&gt; 109.1100 17.6886&lt;BR /&gt; 0 24.7410&lt;BR /&gt; 0 0&lt;BR /&gt; 0 0&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; Q'*A1&lt;BR /&gt;&lt;BR /&gt;ans =&lt;BR /&gt;&lt;BR /&gt; 109.1100 17.6886 106.5621&lt;BR /&gt; 0.0000 24.7410 41.1087&lt;BR /&gt; 0.0000 0.0000 22.0579&lt;BR /&gt; -0.0000 -0.0000 -26.0582&lt;BR /&gt;&lt;BR /&gt;The final matlab answer and the final MKL LAPACK answer are different in the last column:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; Matlab=Q'*A1&lt;BR /&gt;&lt;BR /&gt;Matlab =&lt;BR /&gt;&lt;BR /&gt; 109.1100 17.6886 106.5621&lt;BR /&gt; 0.0000 24.7410 41.1087&lt;BR /&gt; 0.0000 0.0000 22.0579&lt;BR /&gt; -0.0000 -0.0000 -26.0582&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; MKL=[&lt;BR /&gt;-1.091100e+02 -1.768857e+01 -1.065621e+02;&lt;BR /&gt;0.000000e+00 -2.474095e+01 -4.110871e+01;&lt;BR /&gt;0.000000e+00 0.000000e+00 3.281543e+01;&lt;BR /&gt;0.000000e+00 8.881784e-16 -9.419678e+00]&lt;BR /&gt;&lt;BR /&gt;MKL =&lt;BR /&gt;&lt;BR /&gt;-109.1100 -17.6886 -106.5621&lt;BR /&gt; 0 -24.7410 -41.1087&lt;BR /&gt; 0 0 32.8154&lt;BR /&gt; 0 0.0000 -9.4197&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; abs(Matlab) - abs(MKL)&lt;BR /&gt;&lt;BR /&gt;ans =&lt;BR /&gt;&lt;BR /&gt; 0.0000 -0.0000 0.0000&lt;BR /&gt; 0.0000 0.0000 -0.0000&lt;BR /&gt; 0.0000 0.0000 -10.7575&lt;BR /&gt; 0.0000 0.0000 16.6385&lt;BR /&gt;&lt;BR /&gt;Why is it so different, what am I doing wrong when calling LAPACKE_dormqr?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;Best regards,&lt;BR /&gt;Giovanni&lt;BR /&gt;&lt;/DATATYPE&gt;&lt;/DATATYPE&gt;&lt;/DATATYPE&gt;</description>
      <pubDate>Thu, 29 Mar 2012 12:25:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781714#M1504</guid>
      <dc:creator>Azua_Garcia__Giovann</dc:creator>
      <dc:date>2012-03-29T12:25:39Z</dc:date>
    </item>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781715#M1505</link>
      <description>A quick scan of your post showed me that you may be overlooking the fact that if A = Q R is the Q-R factorization, so also is (-Q) (-R), unless some additional restrictions are placed on R. Therefore, you should not compare only the Q-s or only the R-s given by Matlab and MKL. You should look at both.&lt;BR /&gt;&lt;BR /&gt;Since Matlab itself uses MKL for internal operations, I would not expect to see any significant discrepancies.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Mar 2012 13:23:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781715#M1505</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-03-29T13:23:25Z</dc:date>
    </item>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781716#M1506</link>
      <description>Hello Mecej4,&lt;BR /&gt;&lt;BR /&gt;I know what you mean but that's why I compare taking abs (see the end of my OP). It is also possible that the Q come different by permuting or changing signs for some row elements for a given column. But AFAIK Q'*C should give the same result specially like as you say matlab is just invoking MKL under the hood.&lt;BR /&gt;&lt;BR /&gt;I guess this might have something to do with the way LAPACKE_dormqr works? Note that I am always using the compact QR representation upper trapezoidal R with lower min(M,N) householder reflectors and tau coeffients vector.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Giovanni&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Mar 2012 14:53:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781716#M1506</guid>
      <dc:creator>Azua_Garcia__Giovann</dc:creator>
      <dc:date>2012-03-29T14:53:35Z</dc:date>
    </item>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781717#M1507</link>
      <description>&lt;I&gt;&amp;gt; But AFAIK Q'*C should give the same result specially like as you say matlab &amp;gt; is just invoking MKL under the hood.&lt;BR /&gt;&lt;BR /&gt;&lt;/I&gt;Two points: &lt;BR /&gt;&lt;BR /&gt;1) The version of MKL used by Matlab need not be the same as the one used by your Fortran/C compiler.&lt;BR /&gt;&lt;BR /&gt;2) If Matlab gives you Q&lt;SUB&gt;1&lt;/SUB&gt; and Fortran/C gives you Q&lt;SUB&gt;2&lt;/SUB&gt; = -Q&lt;SUB&gt;1&lt;/SUB&gt;, Q&lt;SUB&gt;1&lt;/SUB&gt;'C will be equal to -Q&lt;SUB&gt;2&lt;/SUB&gt;'C, since you are supplying the C after the decomposition was performed.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Mar 2012 15:58:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781717#M1507</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-03-29T15:58:00Z</dc:date>
    </item>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781718#M1508</link>
      <description>Hi Mecej4,&lt;BR /&gt;&lt;BR /&gt;Ok point taken :)&lt;BR /&gt;&lt;BR /&gt;Could you confirm this is the right way to call the function? &lt;BR /&gt;&lt;BR /&gt;QR is computed using DGEQRF over matrix B (m x (n - 1)).&lt;BR /&gt;C is a copy of matrix B with one extra column C (m x n).&lt;BR /&gt;&lt;BR /&gt;C (m x n) &lt;BR /&gt;B-&amp;gt;QR (m x (n - 1)) as returned by DGEQRF having MIN(m, n - 1) reflectors in the lower triangular. &lt;BR /&gt;&lt;BR /&gt;int l_order = LAPACK_COL_MAJOR;&lt;BR /&gt;lapack_int m = C-&amp;gt;rows;&lt;BR /&gt;lapack_int n = C-&amp;gt;cols;&lt;BR /&gt;lapack_int k = MIN(B-&amp;gt;QR-&amp;gt;rows, B-&amp;gt;QR-&amp;gt;cols);&lt;BR /&gt;lapack_int lda = m;&lt;BR /&gt;lapack_int ldc = m;&lt;BR /&gt;lapack_int info = 0;&lt;BR /&gt;lapack_int info = LAPACKE_dormqr(l_order, 'L', 'T', m, n, k, B-&amp;gt;QR-&amp;gt;data, lda, B-&amp;gt;tau-&amp;gt;data, C-&amp;gt;data, ldc);&lt;BR /&gt;&lt;BR /&gt;Many thanks in advance,&lt;BR /&gt;Best regards,&lt;BR /&gt;Giovanni</description>
      <pubDate>Thu, 29 Mar 2012 16:07:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781718#M1508</guid>
      <dc:creator>Azua_Garcia__Giovann</dc:creator>
      <dc:date>2012-03-29T16:07:28Z</dc:date>
    </item>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781719#M1509</link>
      <description>Rather than my attempting to play "compiler", it will be more effective if you post your code. Assuming that it is not more than a couple of 100 lines, I'll be happy to take a look at it.</description>
      <pubDate>Thu, 29 Mar 2012 16:15:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781719#M1509</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-03-29T16:15:29Z</dc:date>
    </item>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781720#M1510</link>
      <description>Hi Giovanni,&lt;BR /&gt;&lt;BR /&gt;Your parameter setting should be correct. But the different result between MKL and Matlab should be the QR implementation itself.&lt;BR /&gt;&lt;BR /&gt;for example, the below showA=QR. Theelements in Greenaresignificant. But&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-US" style="color: #1f497d; font-size: 11pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;Red values could take &lt;SPAN style="background: yellow; mso-highlight: yellow;"&gt;any&lt;/SPAN&gt; value with only &lt;SPAN style="background: yellow; mso-highlight: yellow;"&gt;one&lt;/SPAN&gt; condition Q*Q^T=E.&lt;BR /&gt;&lt;BR /&gt;As a result, MKL and Matlab have different last twocolumns, then different Q^T *A1 in last two row. &lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.intel.com/skins/images/7B13F55A7CE623EF42E69096FA81A3A1/2021_redesign/images/image_not_found.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Ying &lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jun 2012 08:07:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781720#M1510</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2012-06-07T08:07:35Z</dc:date>
    </item>
    <item>
      <title>issue with LAPACKE_dormqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781721#M1511</link>
      <description>Hi Ying,&lt;BR /&gt;&lt;BR /&gt;Thank you for following up on this :) I kinda of forgot this Thread already :) but is good to know. I got this bit working long ago.&lt;BR /&gt;&lt;BR /&gt;Best!&lt;BR /&gt;Giovanni</description>
      <pubDate>Fri, 08 Jun 2012 18:12:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/issue-with-LAPACKE-dormqr/m-p/781721#M1511</guid>
      <dc:creator>Azua_Garcia__Giovann</dc:creator>
      <dc:date>2012-06-08T18:12:00Z</dc:date>
    </item>
  </channel>
</rss>

