<?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 I see that in your C++ caller in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917498#M12724</link>
    <description>&lt;P&gt;I see that in your C++ caller you set lwork = -1. That is the convention for asking Lapack to tell you how much workspace is required. Such a call does not do anything else. You have to take the value returned in lwork, allocate that much real workspace, and call Lapack again (with lwork unchanged) to do the actual calculation of the pseudoinverse.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jan 2013 21:20:23 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2013-01-17T21:20:23Z</dc:date>
    <item>
      <title>dgelss does not work</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917495#M12721</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am working on function "dgelss" to simulate pinv in Matlab. After I called dgelss() in MKL (lapack), the output info will be 0 which means execution is successful. But the result matrix does not provide the correct value. Can someone help me figure out why?&lt;/P&gt;
&lt;P&gt;MKL version: 10.2.2.025&lt;/P&gt;
&lt;P&gt;int main(int argc, char *argv[])&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Init();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int step_extended, step_orig;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int unitMatrixSize = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;IppStatus status;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int m = 3, n = 3, nrhs = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;float *matrixA = (float *)malloc(sizeof(float)*m*n);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Data Matrix, size is 3x3&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[0] =&amp;nbsp;&amp;nbsp; &amp;nbsp;11.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[1] =&amp;nbsp;&amp;nbsp; &amp;nbsp;9.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[2] =&amp;nbsp;&amp;nbsp; &amp;nbsp;-6.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[3] =&amp;nbsp;&amp;nbsp; &amp;nbsp;3.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[4] =&amp;nbsp;&amp;nbsp; &amp;nbsp;-3.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[5] =&amp;nbsp;&amp;nbsp; &amp;nbsp;0.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[6] =&amp;nbsp;&amp;nbsp; &amp;nbsp;-3.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[7] =&amp;nbsp;&amp;nbsp; &amp;nbsp;0.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;matrixA[8] =&amp;nbsp;&amp;nbsp; &amp;nbsp;1.0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //identity matrix, size is 3x3&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;float * unitMatrix = (float *)malloc(sizeof(float) * 9);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for(int i = 0; i &amp;lt; 3; i++)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for(int j = 0; j &amp;lt; 3; j++)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;unitMatrix[j*m+i] = 0.0;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unitMatrix[0] = 1.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unitMatrix[4] = 1.0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unitMatrix[8] = 1.0;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int lda = m;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int ldb = m;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;double work;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int rank = -1, info, lwork=-1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;float rcond = .01;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int dim = min(m,n);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;float *S = (float *)malloc(sizeof(float) *dim);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;float *WORK = (float *)malloc(sizeof(float) *1);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;sgelss(&amp;amp;m, &amp;amp;n, &amp;amp;m, matrixA, &amp;amp;lda, unitMatrix,&amp;amp;ldb, S, &amp;amp;rcond, &amp;amp;rank, WORK, &amp;amp;lwork, &amp;amp;info);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;free(matrixA);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;free(unitMatrix);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;free(S);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;free(WORK);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return TRUE;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 16:48:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917495#M12721</guid>
      <dc:creator>Hai</dc:creator>
      <dc:date>2013-01-17T16:48:38Z</dc:date>
    </item>
    <item>
      <title>Quote:But the result matrix</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917496#M12722</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;But the result matrix does not provide the correct value.&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;On what basis do you rest this claim? The matrix you gave is of full rank. Therefore, the minimum norm solution is the same as the result of Gaussian elimination, and the minimum residuals are zero. Are you aware that you are calling the Fortran77 routine and, therefore, the input matrices are expected to be in column major order?&lt;/P&gt;
&lt;P&gt;The matrix, as entered in your program, is&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;11&amp;nbsp;&amp;nbsp; 3&amp;nbsp; -3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;9 -3&amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;-6&amp;nbsp; 0&amp;nbsp; 1&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is this the matrix you wanted, or its transpose?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 19:38:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917496#M12722</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2013-01-17T19:38:00Z</dc:date>
    </item>
    <item>
      <title>thanks for your reply first.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917497#M12723</link>
      <description>&lt;P&gt;thanks for your reply first.&lt;/P&gt;
&lt;P&gt;What I want to do is to find the psuedo inverse of a given matrix. The size of the matrix is arbitrary. In my code, I use 3x3 as an example. For the matrix B in ?gelss, I used a identity matrix. Then the result should be the psuedo inverse of input matrix A. I did not notice about the column major order issue. But right now, I just cannot get even a look-good result.&lt;/P&gt;
&lt;P&gt;For example, if I use Matlab to compute, if the input matrix A is:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;[11&amp;nbsp;&amp;nbsp; 3&amp;nbsp; -3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;9 -3&amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;-6&amp;nbsp; 0&amp;nbsp; 1]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then the result matrix B should be pinv(A)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0.5000&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.5000&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.5000&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.5000&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.1667&amp;nbsp;&amp;nbsp;&amp;nbsp; 4.5000&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.0000&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.0000&amp;nbsp;&amp;nbsp; 10.0000]&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mecej4 wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Quote:&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;But the result matrix does not provide the correct value.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;On what basis do you rest this claim? The matrix you gave is of full rank. Therefore, the minimum norm solution is the same as the result of Gaussian elimination, and the minimum residuals are zero. Are you aware that you are calling the Fortran77 routine and, therefore, the input matrices are expected to be in column major order?&lt;/P&gt;
&lt;P&gt;The matrix, as entered in your program, is&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;11&amp;nbsp;&amp;nbsp; 3&amp;nbsp; -3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;9 -3&amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;-6&amp;nbsp; 0&amp;nbsp; 1&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is this the matrix you wanted, or its transpose?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 20:39:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917497#M12723</guid>
      <dc:creator>Hai</dc:creator>
      <dc:date>2013-01-17T20:39:33Z</dc:date>
    </item>
    <item>
      <title>I see that in your C++ caller</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917498#M12724</link>
      <description>&lt;P&gt;I see that in your C++ caller you set lwork = -1. That is the convention for asking Lapack to tell you how much workspace is required. Such a call does not do anything else. You have to take the value returned in lwork, allocate that much real workspace, and call Lapack again (with lwork unchanged) to do the actual calculation of the pseudoinverse.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 21:20:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917498#M12724</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2013-01-17T21:20:23Z</dc:date>
    </item>
    <item>
      <title>I see that in your C++ caller</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917499#M12725</link>
      <description>&lt;P&gt;Duplicate Message: Please Delete!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 21:21:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917499#M12725</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2013-01-17T21:21:00Z</dc:date>
    </item>
    <item>
      <title>Yeah, it works. I know this</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917500#M12726</link>
      <description>&lt;P&gt;Yeah, it works. I know this trick now.&lt;BR /&gt;&lt;BR /&gt;thanks mecej4!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mecej4 wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I see that in your C++ caller you set lwork = -1. That is the convention for asking Lapack to tell you how much workspace is required. Such a call does not do anything else. You have to take the value returned in lwork, allocate that much real workspace, and call Lapack again (with lwork unchanged) to do the actual calculation of the pseudoinverse.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2013 22:30:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dgelss-does-not-work/m-p/917500#M12726</guid>
      <dc:creator>Hai</dc:creator>
      <dc:date>2013-01-17T22:30:00Z</dc:date>
    </item>
  </channel>
</rss>

