<?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 The MKL documentation for  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonsymmetric-eigenvalue-problem/m-p/1085908#M22981</link>
    <description>&lt;P&gt;The MKL documentation for ?HSEQR says:&amp;nbsp;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If info = 0 and job = 'E', the contents of h are unspecified on exit.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;The implication is that, before calling HSEQR, you should save the matrix H, and use the saved copy in the subsequent call to HSEIN.&lt;/P&gt;

&lt;P&gt;Another issue, a minor one, is that different eigenvector routines in Lapack may use different normalization for the eigenvectors, so you should always re-scale the vectors to some consistent convention of your choosing before you make comparisons.&lt;/P&gt;

&lt;P&gt;It took me a bit of effort to work this puzzle out, mainly because I had not used these Lapack routines before -- it is not often the case in real world problems that an upper Hessenberg matrix lands on your lap.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;For your convenience, here is (a Lapack-95 version of) the test program that I wrote to track the problem.&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program xhess
use lapack95
! read an upper Hessenberg matrix, use HSEQR and HSEIN to find eigenvalues and eigenvectors 
implicit none
integer i,j,n,m,mm,info
real(8), allocatable :: h(:,:),hsav(:,:),wr(:),wi(:),vr(:,:)
logical, allocatable :: select(:)
!
read(*,*)          ! title line
read(*,*) n
allocate (h(n,n),hsav(n,n),wr(n),wi(n),select(n),vr(n,2))
read(*,*)((h(i,j),j=1,n),i=1,n)
hsav=h                                  ! save for use with hsein
call hseqr(h,wr,wi,info=info)
write(*,*)'Info from hseqr = ',info
if(info /= 0)stop
write(*,10)(i,wr(i),wi(i),i=1,n)
10 format('Eigenvalues:',/,(I2,2ES17.9))

select([1,2,4]) = .false.
select(3) = .true.
call hsein(hsav,wr,wi,select,vr=vr,eigsrc='n',info=info)
write(*,*)'Info from hsein = ',info
if(info /= 0)stop
vr(:,1) = vr(:,1)/norm2(vr(:,1))
write(*,20)(i,vr(i,1),i=1,n)
20 format('Eigenvector 3',/,(i3,2x,ES17.9))
end program
&lt;/PRE&gt;

&lt;P&gt;What your code dhsein.f did, in effect, was to leave out line-13 and use h in place of hsav on line 22.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Jan 2016 15:03:00 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2016-01-16T15:03:00Z</dc:date>
    <item>
      <title>Nonsymmetric eigenvalue problem</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonsymmetric-eigenvalue-problem/m-p/1085907#M22980</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to compute the right eigenvectors of a Hessenberg matrix. It seems I get the correct results when using the driver routine ?geev, but I can't obtain the same results with the computational routines ?hseqr and ?hsein (which should in the end be faster because there is no need to reduce A into Hessenberg form). Do you see what is wrong in the file&amp;nbsp;dhsein.f ?&lt;/P&gt;

&lt;P&gt;$&amp;nbsp;ifort dgeev.f &amp;nbsp;-lmkl_core -lmkl_intel_thread -liomp5 -lmkl_intel_lp64 &amp;amp;&amp;amp; ./a.out &amp;lt; dhsein.d&lt;/P&gt;

&lt;P&gt;&amp;nbsp;Eigenvector( 3)&lt;BR /&gt;
	&amp;nbsp; 9.8107E-01&lt;BR /&gt;
	&amp;nbsp; 1.2917E-01&lt;BR /&gt;
	&amp;nbsp; 1.2998E-01&lt;BR /&gt;
	&amp;nbsp; 6.2617E-02&lt;/P&gt;

&lt;P&gt;$&amp;nbsp;ifort dhsein.f &amp;nbsp;-lmkl_core -lmkl_intel_thread -liomp5 -lmkl_intel_lp64 &amp;amp;&amp;amp; ./a.out &amp;lt; dhsein.d&lt;/P&gt;

&lt;P&gt;&amp;nbsp;Eigenvector( 3)&lt;BR /&gt;
	&amp;nbsp;-8.7754E-01&lt;BR /&gt;
	&amp;nbsp; 5.4626E-01&lt;BR /&gt;
	&amp;nbsp; 1.0000E+00&lt;BR /&gt;
	&amp;nbsp; 0.0000E+00&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 16:10:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonsymmetric-eigenvalue-problem/m-p/1085907#M22980</guid>
      <dc:creator>asd__asdqwe</dc:creator>
      <dc:date>2016-01-13T16:10:37Z</dc:date>
    </item>
    <item>
      <title>The MKL documentation for</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonsymmetric-eigenvalue-problem/m-p/1085908#M22981</link>
      <description>&lt;P&gt;The MKL documentation for ?HSEQR says:&amp;nbsp;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If info = 0 and job = 'E', the contents of h are unspecified on exit.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;The implication is that, before calling HSEQR, you should save the matrix H, and use the saved copy in the subsequent call to HSEIN.&lt;/P&gt;

&lt;P&gt;Another issue, a minor one, is that different eigenvector routines in Lapack may use different normalization for the eigenvectors, so you should always re-scale the vectors to some consistent convention of your choosing before you make comparisons.&lt;/P&gt;

&lt;P&gt;It took me a bit of effort to work this puzzle out, mainly because I had not used these Lapack routines before -- it is not often the case in real world problems that an upper Hessenberg matrix lands on your lap.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;For your convenience, here is (a Lapack-95 version of) the test program that I wrote to track the problem.&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program xhess
use lapack95
! read an upper Hessenberg matrix, use HSEQR and HSEIN to find eigenvalues and eigenvectors 
implicit none
integer i,j,n,m,mm,info
real(8), allocatable :: h(:,:),hsav(:,:),wr(:),wi(:),vr(:,:)
logical, allocatable :: select(:)
!
read(*,*)          ! title line
read(*,*) n
allocate (h(n,n),hsav(n,n),wr(n),wi(n),select(n),vr(n,2))
read(*,*)((h(i,j),j=1,n),i=1,n)
hsav=h                                  ! save for use with hsein
call hseqr(h,wr,wi,info=info)
write(*,*)'Info from hseqr = ',info
if(info /= 0)stop
write(*,10)(i,wr(i),wi(i),i=1,n)
10 format('Eigenvalues:',/,(I2,2ES17.9))

select([1,2,4]) = .false.
select(3) = .true.
call hsein(hsav,wr,wi,select,vr=vr,eigsrc='n',info=info)
write(*,*)'Info from hsein = ',info
if(info /= 0)stop
vr(:,1) = vr(:,1)/norm2(vr(:,1))
write(*,20)(i,vr(i,1),i=1,n)
20 format('Eigenvector 3',/,(i3,2x,ES17.9))
end program
&lt;/PRE&gt;

&lt;P&gt;What your code dhsein.f did, in effect, was to leave out line-13 and use h in place of hsav on line 22.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jan 2016 15:03:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Nonsymmetric-eigenvalue-problem/m-p/1085908#M22981</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2016-01-16T15:03:00Z</dc:date>
    </item>
  </channel>
</rss>

