MKL SGEEV的错误特征向量

发布于 2025-01-25 03:41:32 字数 1097 浏览 1 评论 0原文

我想计算矩阵的特征值和特征向量。我正在使用Mkl Lapack的SGEEV

我有一个非常简单的测试代码:

integer :: i,n, info
real, allocatable:: A(:,:), B(:,:), C(:,:)
real, allocatable:: wr(:), wi(:), vl(:, :), vr(:, :), work(:)
n=3
allocate(vr(n,n), vl(n,n), wr(n), wi(n), work(4*n))
allocate(A(n,n),B(n,n), C(n,n))
A(1,:)=(/-1.0,3.0,-1.0/)
A(2,:)=(/-3.0,5.0,-1.0/)
A(3,:)=(/-3.0,3.0,1.0/)
call sgeev('V','V',n,A,n,wr,wi,vl,n,vr,n,work,size(work,1),info)
print*,info
do i=1,n
  print*,i,wr(i),wi(i)
enddo
print*,'vr'
do i=1, n
  print*, vr(i,:)
enddo
print*,'vl'
do i=1, n
  print*, vl(i,:)
enddo

它给出了正确的特征值(2,2,1),但是错误的特征向量。

我有:

 vr
 -0.577350259      0.557844639     -0.539340019    
 -0.577350557      0.704232574     -0.273908198    
 -0.577349961      0.439164847      0.796295524    
 vl
 -0.688247085     -0.617912114     -0.815013587    
  0.688247383      0.771166325      0.364909053    
 -0.229415640     -0.153254643      0.450104564 

当VR应该是

-1   1   1
 0   1   1
 3   0   1

什么时候我做错了什么?

I want to compute the eigenvalues and eigenvectors of a matrix. I'm using sgeev of MKL lapack.

I have this very simple test code:

integer :: i,n, info
real, allocatable:: A(:,:), B(:,:), C(:,:)
real, allocatable:: wr(:), wi(:), vl(:, :), vr(:, :), work(:)
n=3
allocate(vr(n,n), vl(n,n), wr(n), wi(n), work(4*n))
allocate(A(n,n),B(n,n), C(n,n))
A(1,:)=(/-1.0,3.0,-1.0/)
A(2,:)=(/-3.0,5.0,-1.0/)
A(3,:)=(/-3.0,3.0,1.0/)
call sgeev('V','V',n,A,n,wr,wi,vl,n,vr,n,work,size(work,1),info)
print*,info
do i=1,n
  print*,i,wr(i),wi(i)
enddo
print*,'vr'
do i=1, n
  print*, vr(i,:)
enddo
print*,'vl'
do i=1, n
  print*, vl(i,:)
enddo

It gives the right eigenvalues (2, 2, 1) but the wrong eigenvectors.

I have:

 vr
 -0.577350259      0.557844639     -0.539340019    
 -0.577350557      0.704232574     -0.273908198    
 -0.577349961      0.439164847      0.796295524    
 vl
 -0.688247085     -0.617912114     -0.815013587    
  0.688247383      0.771166325      0.364909053    
 -0.229415640     -0.153254643      0.450104564 

when vr should be

-1   1   1
 0   1   1
 3   0   1

What am I doing the wrong way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情话墙 2025-02-01 03:41:32

您的矩阵为 demenerate (具有两个eigenvalues,彼此相同)特征向量可以是两个退化特征向量的任意线性组合。

另外,sgeev的输出ises特征向量,而您给出的特征向量尚未归一化。

给出的第一个特征值是1,相应的特征向量是vrl1 =( - 0.57 ...,-0.57 ...,-0.57 ...,,-0.57 ..., -0.57 ...)。这与您给出的第三个特征向量(1,1,1)成正比。

第二和第三特征值都是2。相应的特征向量是vrl2 =(0.55 ...,0.70 ...,0.70 ...,0.43 ...) and code> l3 = l3 = l3 =(0.55 ...,0.70 ...,0.70 ...,0.70 ...,0.70 ...,0.70 ...,0.70 ...,0.70 ... (-0.53 ...,-0.27 ...,0.79 ...)。服用0.27 ...*L2+0.70 ...*L3给出(-0.22 ...,0,0.66 ...),与(( -1,0,3),并服用0.79 ...*l2-0.43 ...*l3给出(0.66 ...,0.66 ...,0 ),与(1,1,0)成比例。

Your matrix is degenerate (has two eigenvalues which are the same as one another), so the corresponding eigenvectors can be an arbitrary linear combination of the two degenerate eigenvectors.

Also, the output of sgeev normalises the eigenvectors, whereas the eigenvectors you have given are not normalised.

The first eigenvalue given is 1, and the corresponding eigenvector is the first column of vr, l1=(-0.57..., -0.57..., -0.57...). This is proportional to the third eigenvector you have given, (1, 1, 1).

The second and third eigenvalues are both 2. The corresponding eigenvectors are the second and third columns of vr, l2=(0.55..., 0.70..., 0.43...) and l3=(-0.53..., -0.27..., 0.79...). Taking 0.27...*l2+0.70...*l3 gives (-0.22..., 0, 0.66...), proportional to (-1, 0, 3), and taking 0.79...*l2-0.43...*l3 gives (0.66..., 0.66..., 0), proportional to (1, 1, 0).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文