<?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 problems with zhpevd from C++ in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/problems-with-zhpevd-from-C/m-p/864470#M7756</link>
    <description>Hello,&lt;BR /&gt;I am trying to diagonalize a hermitian matrix H, such that H = conjtrans(U).W.U from C++.&lt;BR /&gt;&lt;BR /&gt;I am not sure as of how to store my matrix data (column or row major), etc.&lt;BR /&gt;&lt;BR /&gt;Does anyone have a simple example ? Let say I have H =&lt;BR /&gt;( 1, 2+3i)&lt;BR /&gt;(2-3i, 4)&lt;BR /&gt;&lt;BR /&gt;My intuition would be to store this matrix as&lt;BR /&gt;{1.0,0.0,2.0,3.0,4.0,0.0}&lt;BR /&gt;&lt;BR /&gt;When I call zhpevd, I get the correct eigenvalues, but I don't seem to get the correct eigenvectors. &lt;BR /&gt;&lt;BR /&gt;Also, I try to do a workspace query by setting liwork, lrwork and lwork to -1. I then declare the work, iwork and rwork arrays of size 1 (as only the first element is supposed to be updated, with the optimal workspace), but I get segmentation fault. An analysis with valgrind showed me that zhpevd tries to access elements outside of these arrays.&lt;BR /&gt;&lt;BR /&gt;If you have an example from C++, I would greatly appreciate.</description>
    <pubDate>Fri, 16 Jan 2009 21:13:53 GMT</pubDate>
    <dc:creator>mboisso</dc:creator>
    <dc:date>2009-01-16T21:13:53Z</dc:date>
    <item>
      <title>problems with zhpevd from C++</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/problems-with-zhpevd-from-C/m-p/864470#M7756</link>
      <description>Hello,&lt;BR /&gt;I am trying to diagonalize a hermitian matrix H, such that H = conjtrans(U).W.U from C++.&lt;BR /&gt;&lt;BR /&gt;I am not sure as of how to store my matrix data (column or row major), etc.&lt;BR /&gt;&lt;BR /&gt;Does anyone have a simple example ? Let say I have H =&lt;BR /&gt;( 1, 2+3i)&lt;BR /&gt;(2-3i, 4)&lt;BR /&gt;&lt;BR /&gt;My intuition would be to store this matrix as&lt;BR /&gt;{1.0,0.0,2.0,3.0,4.0,0.0}&lt;BR /&gt;&lt;BR /&gt;When I call zhpevd, I get the correct eigenvalues, but I don't seem to get the correct eigenvectors. &lt;BR /&gt;&lt;BR /&gt;Also, I try to do a workspace query by setting liwork, lrwork and lwork to -1. I then declare the work, iwork and rwork arrays of size 1 (as only the first element is supposed to be updated, with the optimal workspace), but I get segmentation fault. An analysis with valgrind showed me that zhpevd tries to access elements outside of these arrays.&lt;BR /&gt;&lt;BR /&gt;If you have an example from C++, I would greatly appreciate.</description>
      <pubDate>Fri, 16 Jan 2009 21:13:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/problems-with-zhpevd-from-C/m-p/864470#M7756</guid>
      <dc:creator>mboisso</dc:creator>
      <dc:date>2009-01-16T21:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: problems with zhpevd from C++</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/problems-with-zhpevd-from-C/m-p/864471#M7757</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Hello.&lt;BR /&gt;&lt;BR /&gt;For MKL LAPACK usage you should always store the matrix in column-major order. Actaully, you put down row-major order, that is, for your 2x2 testcase you should store matrix as:&lt;BR /&gt;&lt;BR /&gt;{1.0,0.0,2.0,&lt;STRONG&gt;-3.0&lt;/STRONG&gt;,4.0,0.0}&lt;BR /&gt;&lt;BR /&gt;lwork, lrwork, liwork should be no less than minimal required by this routines - this is described in the documentation - for instance, if jobz='V' (eigenvectors are needed), lwork &amp;gt;= 2*n, lrwork &amp;gt;= 2*n^2 + 5*n + 1, liwork &amp;gt;= 5*n + 3. Generally they may be set larger to get more performance.&lt;BR /&gt;Querying workspace is a good approach to getoptimal working array sizes if you're not sure. So query a workspace, then use the corresponding first elements of working arrays to set lwork, lrwork, liwork. This is an example:&lt;BR /&gt;&lt;BR /&gt;double complex zdum, *work;&lt;BR /&gt;double ddum, *rwork;&lt;BR /&gt;int idum, *iwork;&lt;BR /&gt;int lwork, lrwork, liwork;&lt;BR /&gt;...&lt;BR /&gt;// Workspace query, zdum used for work, ddum for rwork, idum for iwork&lt;BR /&gt;lwork = lrwork = liwork = -1;&lt;BR /&gt;zhpevd( ..., &amp;amp;zdum, &amp;amp;lwork, &amp;amp;ddum, &amp;amp;lrwork, &amp;amp;idum, &amp;amp;liwork, ... ); &lt;BR /&gt;lwork = (int) zdum;&lt;BR /&gt;lrwok = (int) ddum;&lt;BR /&gt;liwork = idum;&lt;BR /&gt;work = (double complex*) malloc( lwork*sizeof(double complex) );&lt;BR /&gt;rwork = (double*) malloc( lrwork*sizeof(double) );&lt;BR /&gt;iwork = (int*) malloc( liwork*sizeof(int) );&lt;BR /&gt;// Make a computation&lt;BR /&gt;zhpevd( ..., work, &amp;amp;lwork, rwork, &amp;amp;lrwork, iwork, &amp;amp;liwork, ... );&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Michael.</description>
      <pubDate>Mon, 19 Jan 2009 10:42:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/problems-with-zhpevd-from-C/m-p/864471#M7757</guid>
      <dc:creator>Michael_C_Intel4</dc:creator>
      <dc:date>2009-01-19T10:42:55Z</dc:date>
    </item>
  </channel>
</rss>

