<?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: SVD Wrong answer. in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SVD-Wrong-answer/m-p/966667#M16261</link>
    <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;The function dgebrd reduces a general matrix to bidiagonal form. The function bdsqr computes the singular value decomposition of a general matrix that has been reduced to bidiagonal form. So you are not getting what you expect because you are only doing half the problem. You've reduced the general matrix to bidiagonal form, but not yet called bdsqr to compute the SVD.&lt;/P&gt;
&lt;P&gt;I believe that dgesvd function will do all this workfor you in one function call.&lt;/P&gt;
&lt;P&gt;-Todd&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 19 Mar 2004 01:17:36 GMT</pubDate>
    <dc:creator>Todd_R_Intel</dc:creator>
    <dc:date>2004-03-19T01:17:36Z</dc:date>
    <item>
      <title>SVD Wrong answer.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SVD-Wrong-answer/m-p/966666#M16260</link>
      <description>&lt;DIV&gt;Hi.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;I'm using MKL 6.1 on VC++.&lt;/DIV&gt;
&lt;DIV&gt;When I use SVD(singular value decomposion) in MKL with function "dgebrd",&lt;/DIV&gt;
&lt;DIV&gt;I get the wrong answer.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Source code is like this.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;#include &lt;STDIO.H&gt;&lt;/STDIO.H&gt;&lt;/DIV&gt;
&lt;DIV&gt;#include "include/mkl_lapack.h"&lt;BR /&gt;#include "include/mkl_example.h"&lt;/DIV&gt;
&lt;DIV&gt;#define M 4&lt;BR /&gt;#define N 3&lt;BR /&gt;int main() {&lt;BR /&gt;CBLAS_ORDER order = CblasColMajor;&lt;/DIV&gt;
&lt;DIV&gt;int m = M;&lt;BR /&gt;int n = N;&lt;/DIV&gt;
&lt;DIV&gt;double aTrans[M*N] = { 1, 2, 3, 4, &lt;BR /&gt; 5, 6, 7, 8,&lt;BR /&gt; 9, 10, 11, 12 };&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;int lda = m;&lt;BR /&gt;double work[64*(M+N)];&lt;BR /&gt;int lwork = 64*(M+N);&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;double q&lt;N&gt;;&lt;BR /&gt;double p&lt;N&gt;;&lt;BR /&gt; double d&lt;N&gt;;&lt;BR /&gt;double e[N-1];&lt;BR /&gt;int info;&lt;/N&gt;&lt;/N&gt;&lt;/N&gt;&lt;/DIV&gt;
&lt;DIV&gt;PrintArrayD(&amp;amp;order, 0, 0, &amp;amp;m, &amp;amp;n, aTrans, &amp;amp;m, "a");&lt;/DIV&gt;
&lt;DIV&gt;//SVD &lt;BR /&gt;dgebrd ( &amp;amp;m, &amp;amp;n, aTrans, &amp;amp;lda, &lt;BR /&gt; d, e, q, p, work, &amp;amp;lwork, &amp;amp;info );&lt;/DIV&gt;
&lt;DIV&gt;if (info !=0) {&lt;BR /&gt;printf("Error : %d", info);&lt;BR /&gt;return(info);&lt;BR /&gt;}&lt;/DIV&gt;
&lt;DIV&gt;int one=1;&lt;BR /&gt;int nminusone=n-1;&lt;BR /&gt;PrintArrayD(&amp;amp;order, 1, 0, &amp;amp;m, &amp;amp;n, aTrans, &amp;amp;lda, "a");&lt;BR /&gt;PrintArrayD(&amp;amp;order, 1, 0, &amp;amp;one, &amp;amp;n, d, &amp;amp;n, "d");&lt;BR /&gt;PrintArrayD(&amp;amp;order, 1, 0, &amp;amp;one, &amp;amp;nminusone, e, &amp;amp;nminusone, "e");&lt;BR /&gt;PrintArrayD(&amp;amp;order, 1, 0, &amp;amp;one, &amp;amp;one, work, &amp;amp;one, "work");&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Sigular value calculate by MATLAB is &lt;/DIV&gt;
&lt;DIV&gt; 25.4368  1.7226  0.0000&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;But,the solution of MKL is &lt;/DIV&gt;
&lt;DIV&gt; -5.477 1.537 1.183&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Why do I get the wrong answer?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Mar 2004 16:37:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SVD-Wrong-answer/m-p/966666#M16260</guid>
      <dc:creator>ysyoo</dc:creator>
      <dc:date>2004-03-18T16:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: SVD Wrong answer.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SVD-Wrong-answer/m-p/966667#M16261</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;The function dgebrd reduces a general matrix to bidiagonal form. The function bdsqr computes the singular value decomposition of a general matrix that has been reduced to bidiagonal form. So you are not getting what you expect because you are only doing half the problem. You've reduced the general matrix to bidiagonal form, but not yet called bdsqr to compute the SVD.&lt;/P&gt;
&lt;P&gt;I believe that dgesvd function will do all this workfor you in one function call.&lt;/P&gt;
&lt;P&gt;-Todd&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 19 Mar 2004 01:17:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SVD-Wrong-answer/m-p/966667#M16261</guid>
      <dc:creator>Todd_R_Intel</dc:creator>
      <dc:date>2004-03-19T01:17:36Z</dc:date>
    </item>
  </channel>
</rss>

