<?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 In your C program you are in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045856#M20946</link>
    <description>&lt;P&gt;In your C program you are using the CLAPACK interface, which was designed for use in C programs to make calls to Fortran Lapack routines compiled with the Fortran77-C translator f2c. In this interface, multidimensional arrays have to follow the Fortran column-major convention.&lt;/P&gt;

&lt;P&gt;The results given by gesvd are correct and agree with those given by Matlab for the matrix&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; 8.79 &amp;nbsp; 6.11 &amp;nbsp;-9.15 &amp;nbsp; 9.57 &amp;nbsp;-3.49 &amp;nbsp; 9.84&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; 9.93 &amp;nbsp; 6.91 &amp;nbsp;-7.93 &amp;nbsp; 1.64 &amp;nbsp; 4.02 &amp;nbsp; 0.15&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; 9.83 &amp;nbsp; 5.04 &amp;nbsp; 4.86 &amp;nbsp; 8.83 &amp;nbsp; 9.80 &amp;nbsp;-8.99&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In the first part of your code, you have computed the SVD using a different set of routines, namely,&amp;nbsp;dgebrd_ and&amp;nbsp;dbdsqr_. These routines return P&lt;SUP&gt;T&lt;/SUP&gt;&lt;SPAN style="color: rgb(51, 51, 51); font-family: Verdana, Arial, sans-serif; font-size: 13.6000003814697px; line-height: 20.3999996185303px;"&gt;&amp;nbsp;* VT and U * Q rather than VT and U. It is not clear to me whether you cared about the singular vectors returned by gebrd/bdsqr, or whether you asked only about the singular vectors returned by gesvd.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jan 2015 14:28:32 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2015-01-09T14:28:32Z</dc:date>
    <item>
      <title>Help needed with bdsqr</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045855#M20945</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to compute a partial SVD of a rectangular matrix A. I tried to adapt an example of the MKL that uses&amp;nbsp;gesvd. While I get the same singular values, I'm not able to compute the correct left singular vectors. Any held would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 10:07:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045855#M20945</guid>
      <dc:creator>asd__asdqwe</dc:creator>
      <dc:date>2015-01-09T10:07:03Z</dc:date>
    </item>
    <item>
      <title>In your C program you are</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045856#M20946</link>
      <description>&lt;P&gt;In your C program you are using the CLAPACK interface, which was designed for use in C programs to make calls to Fortran Lapack routines compiled with the Fortran77-C translator f2c. In this interface, multidimensional arrays have to follow the Fortran column-major convention.&lt;/P&gt;

&lt;P&gt;The results given by gesvd are correct and agree with those given by Matlab for the matrix&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; 8.79 &amp;nbsp; 6.11 &amp;nbsp;-9.15 &amp;nbsp; 9.57 &amp;nbsp;-3.49 &amp;nbsp; 9.84&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; 9.93 &amp;nbsp; 6.91 &amp;nbsp;-7.93 &amp;nbsp; 1.64 &amp;nbsp; 4.02 &amp;nbsp; 0.15&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; 9.83 &amp;nbsp; 5.04 &amp;nbsp; 4.86 &amp;nbsp; 8.83 &amp;nbsp; 9.80 &amp;nbsp;-8.99&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In the first part of your code, you have computed the SVD using a different set of routines, namely,&amp;nbsp;dgebrd_ and&amp;nbsp;dbdsqr_. These routines return P&lt;SUP&gt;T&lt;/SUP&gt;&lt;SPAN style="color: rgb(51, 51, 51); font-family: Verdana, Arial, sans-serif; font-size: 13.6000003814697px; line-height: 20.3999996185303px;"&gt;&amp;nbsp;* VT and U * Q rather than VT and U. It is not clear to me whether you cared about the singular vectors returned by gebrd/bdsqr, or whether you asked only about the singular vectors returned by gesvd.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 14:28:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045856#M20946</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-09T14:28:32Z</dc:date>
    </item>
    <item>
      <title>Thanks for your answer.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045857#M20947</link>
      <description>&lt;P&gt;Thanks for your answer.&lt;/P&gt;

&lt;P&gt;I completely agree that the results with the second set of routines is right (gesvd), it is the MKL example. However, I would like to compute the singular vectors with bdsqr, and there, I can't make it work. Unfortunatly, there is no example with bdsqr inside the mkl/examples folder.&lt;/P&gt;

&lt;P&gt;So in short, how to fix the first part of the code to return the same two first singular vectors ?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 14:39:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045857#M20947</guid>
      <dc:creator>asd__asdqwe</dc:creator>
      <dc:date>2015-01-09T14:39:00Z</dc:date>
    </item>
    <item>
      <title>Please read the documentation</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045858#M20948</link>
      <description>&lt;P&gt;Please read the documentation for the routines that you wish to use. The array &lt;STRONG&gt;u&lt;/STRONG&gt; must be initialized to a unit matrix before calling the subroutine&amp;nbsp;&lt;STRONG&gt;bdsqr&lt;/STRONG&gt;, if &lt;STRONG&gt;nru &lt;/STRONG&gt;is not zero. In your code you set equal to zero the elements of array &lt;SPAN style="font-size: 12px; line-height: 12px;"&gt;What do you think?&lt;/SPAN&gt;, but failed to set the diagonal elements to 1. Similarly, the array &lt;STRONG&gt;vt&lt;/STRONG&gt; must be initialized to a unit matrix if &lt;STRONG&gt;ncvt &lt;/STRONG&gt;is not zero.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 16:01:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045858#M20948</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-09T16:01:00Z</dc:date>
    </item>
    <item>
      <title>Right, sorry about that. I</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045859#M20949</link>
      <description>&lt;P&gt;Right, sorry about that. I now compute the array&amp;nbsp;&lt;STRONG&gt;u&lt;/STRONG&gt;&amp;nbsp;using &lt;SPAN style="color: rgb(51, 51, 51); font-family: 'Courier New', Courier, monospace; font-size: 15px; line-height: 22px;"&gt;dorgbr &lt;/SPAN&gt;to get the singular vectors of the original system. I'm still not quite there, but at least it is not all zeros. If you have any clue on what I might be doing wrong, please let me know.&lt;/P&gt;

&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2015 22:29:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045859#M20949</guid>
      <dc:creator>asd__asdqwe</dc:creator>
      <dc:date>2015-01-09T22:29:52Z</dc:date>
    </item>
    <item>
      <title>You can always set up the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045860#M20950</link>
      <description>&lt;P&gt;You can always set up the computation to obtain the min(m,n) left singular vectors and discard all but the first column of the resulting matrix U (whose columns are the left singular vectors), if you call the ?gesvd set of routines. I do not know offhand what to do when you want only one singular vector and you want to obtain it at minimum expense. I have some ideas, but they are untested.&lt;/P&gt;

&lt;P&gt;Situations where you do not want to discard results obtained with significant CPU time spent are probably going to involve large, perhaps sparse, matrices. For such matrices, you would probably not use the dense matrix routines of Lapack. At any rate, time spent searching the Web and libraries for materials on solving for individual eigenvectors and singular vectors would be a good investment.&lt;/P&gt;

&lt;P&gt;You might, on the other hand, have a need for finding singular vectors of a sequence of thousands or millions of small or medium dense matrices. The selection of routines for this purpose would probably be different.&lt;/P&gt;

&lt;P&gt;Is it out of question for you to compute min(m,n) left singular vectors, keep the first and discard the rest? Perhaps you could expand on how the singular vector calculation plays a role in the overall computation that you have in mind. You gave the impression that you wanted to use the computational routines ?gebrd, ?orgbr, ?bdsqr rather than the driver routine ?gesvd. If so, why?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jan 2015 20:01:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045860#M20950</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-10T20:01:09Z</dc:date>
    </item>
    <item>
      <title>Here is a corrected and</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045861#M20951</link>
      <description>&lt;P&gt;Here is a corrected and shortened version of your program. See also&amp;nbsp;http://www.nag.com/numeric/CL/nagdoc_cl24/examples/source/f08kfce.c and&amp;nbsp;http://www.nag.com/numeric/fl/nagdoc_fl23/xhtml/F08/f08mef.xml. The MKL version of the latter is provided as &amp;nbsp;.../MKL/examples/lapack/source/dorgbrx.f with an Intel compiler installation, after the examples zip file examples_core_f.zip&amp;nbsp;has been extracted. For some reason, no corresponding example is included in examples_core_c.zip.&lt;/P&gt;

&lt;P&gt;[Added on 1-11-2015] If you intend to call Lapack from C, you may find it advantageous to use the LAPACKE interface, which is a bit more C-like and relieves you from having to pass workspace arrays as arguments. The second attachment, dgebrdx.cpp, is the same program as the previous one, modified to use this interface.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jan 2015 23:11:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045861#M20951</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-11T23:11:00Z</dc:date>
    </item>
    <item>
      <title>It could be possible to keep</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045862#M20952</link>
      <description>&lt;P&gt;It could be possible to keep the first one(s), but the idea is to do SVD on 100.000x10.000 matrices, and only keep ~100 singular vectors, so I would like to be able to only keep compute 100 singular vectors right away. I thought it was possible with ?bdsqr.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2015 11:59:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045862#M20952</guid>
      <dc:creator>asd__asdqwe</dc:creator>
      <dc:date>2015-01-12T11:59:38Z</dc:date>
    </item>
    <item>
      <title>I do not think that with</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045863#M20953</link>
      <description>&lt;P&gt;I do not think that with direct methods you can compute selected singular values/vectors. In fact, the manual page for ?bdsqr says, "u(ldu,*) contains an nru by n unit matrix U.&amp;nbsp;The second dimension of u must be at least max(1, n)." Thus, the choice as far as singular vectors are concerned is "all or none".&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Is your 10000 X 10000 matrix sparse or dense?&lt;/P&gt;

&lt;P&gt;Please take a look at ARPACK and ARPACK-ng; the example driver program at&amp;nbsp;https://github.com/opencollab/arpack-ng/blob/master/EXAMPLES/SVD/dsvd.f appears to do exactly what you seek.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2015 14:32:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045863#M20953</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-12T14:32:03Z</dc:date>
    </item>
    <item>
      <title>My matrix is dense, so I</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045864#M20954</link>
      <description>&lt;P&gt;My matrix is dense, so I guess there is a better alternative than ARPACK. Anyway, thank you for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2015 15:43:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Help-needed-with-bdsqr/m-p/1045864#M20954</guid>
      <dc:creator>asd__asdqwe</dc:creator>
      <dc:date>2015-01-12T15:43:43Z</dc:date>
    </item>
  </channel>
</rss>

