简体   繁体   English

MATLAB - 当B是单数时,Eigs(A,B)

[英]MATLAB - Eigs(A,B) when B is singular

I am trying to solve an eigenvalue problem of large matrices (8000×8000). 我试图解决大矩阵(8000×8000)的特征值问题。 Since A and B are sparse in my case, I thought that it is better to use eigs than eig . 由于AB是在我的情况很少,我认为这是更好地利用eigseig But the problem is that B is singular and MATLAB's eigs can not handle it. 但问题是B是单数的,MATLAB的eigs无法处理它。

Are there are any workarounds to solve this problem? 是否有任何解决方法可以解决此问题?

PS: Both A and B are complex and non-symmetric PS: AB都是复杂且非对称的

The underlying ARPACK routines leveraged by MATLAB allow solution of singular mass matrix problems ( B to MATLAB, M to ARPACK). MATLAB利用的基础ARPACK例程允许解决奇异质量矩阵问题( B到MATLAB, M到ARPACK)。 The APRACK documentation states: APRACK文档说明:

If M is singular or if one is interested in eigenvalues near a point σ then a user may choose to work with C = ( A - σ M ) -1 M 如果M是单数,或者如果一个爱好附近的点的特征值σ然后,用户可以选择与C =工作(A - σM)-1 中号

where C is the shifted operator. 其中C是移位运算符。 Therefore, by explicitly specifying a numerical value for the shift parameter sigma , eigs can attempt to converge to the nearest dominate eigenvalue as long as the shift doesn't make C singular. 因此,通过明确指定移位参数sigma的数值,只要移位不使C奇异, eigs就可以尝试收敛到最接近的支配特征值。

For example, 例如,

>> n = 1000;
>> A = sprandn(n,n,1/n) + speye(n,n); % ensure invertibility of A
>> B = sprandn(n,n,1/n); B(1:n-1,1:n-1) = B(1:n-1,1:n-1) + speye(n-1); % mildly pathological B
>> condest(B)
ans =
   Inf

A doesn't need to be invertible, but it will let us check our answer in a bit. A不需要是可逆的,但它会让我们稍微检查一下我们的答案。 Calling eigs without a specified shift throws an error: 在没有指定班次的情况下调用eigs会引发错误:

>> eigs(A,B,1)
Error using eigs/checkInputs/LUfactorB (line 954)
B is singular.
...

Specifying a shift remedies this 1 指定班次可以解决这个问题1

>> eigs(A,B,1,0)
ans =
    0.1277

But that's only the dominate eigenvalue found near 0 . 但这只是在0附近发现的主导特征值。 Let's check some other points 我们来看看其他一些观点

>> sort(arrayfun(@(sigma)eigs(A,B,1,sigma),linspace(-10,10,10).'),'descend')
ans =
   4.1307 + 0.2335i
   4.1307 + 0.2335i
   4.1307 + 0.2335i
   3.3349 + 0.0000i
   1.1267 + 0.0000i
   0.1277 + 0.0000i
   0.1277 + 0.0000i
   0.1277 + 0.0000i
   0.1277 + 0.0000i
   0.1277 + 0.0000i

If looks like 4.1307 + 0.2335i might be the dominate eigenvalue of the system. 如果看起来像4.1307 + 0.2335i可能是系统的主要特征值。 Let's look around that point for some more eigenvalues: 让我们围绕这一点来寻找更多的特征值:

>> eigs(A,B,5,4.13)
ans =
   4.1307 - 0.2335i
   4.1307 + 0.2335i
   3.3349 + 0.0000i
   2.8805 + 0.0000i
   2.6613 + 0.0000i

Looks good. 看起来不错。 But are there bigger finite eigenvalues? 但是有更大的有限特征值吗? Luckily, since A is invertible, we can check the eigenvalues directly by taking the reciprocals of eig(B/A) : 幸运的是,由于A是可逆的,我们可以通过取eig(B/A)的倒数eig(B/A)直接检查特征值:

>> lam = sort(1./eig(full(B/A)),'descend')
lam =
      Inf + 0.0000i
   4.1307 + 0.2335i
   4.1307 - 0.2335i
   3.4829 + 1.6481i
   3.4829 - 1.6481i
   3.3349 + 0.0000i
   2.4162 + 2.1442i
   2.4162 - 2.1442i
   2.8805 + 0.0000i
   2.2371 + 1.7137i
   2.2371 - 1.7137i
   ...

First, we see that annoying infinite eigenvalue giving all the problems. 首先,我们看到烦人的无限特征值给出了所有问题。 Second, we can see that eigs did find the largest finite eigenvalue but didn't find the slightly smaller magnitude eigenvalues in the complex plane because the purely real eigenvalues were closer to the shift point: 其次,我们可以看到eigs确实找到了最大的有限特征值,但没有在复平面中找到略小的幅度特征值,因为纯实数特征值更接近移位点:

>> [lam,abs(lam-4.13)]
ans =
      Inf + 0.0000i      Inf + 0.0000i
   4.1307 + 0.2335i   0.2335 + 0.0000i % found by eigs(A,B,5,4.13)
   4.1307 - 0.2335i   0.2335 + 0.0000i % found by eigs(A,B,5,4.13)
   3.4829 + 1.6481i   1.7705 + 0.0000i
   3.4829 - 1.6481i   1.7705 + 0.0000i
   3.3349 + 0.0000i   0.7951 + 0.0000i % found by eigs(A,B,5,4.13)
   2.4162 + 2.1442i   2.7450 + 0.0000i
   2.4162 - 2.1442i   2.7450 + 0.0000i
   2.8805 + 0.0000i   1.2495 + 0.0000i % found by eigs(A,B,5,4.13)
   (8 more complex eigenvalues)
   2.6613 + 0.0000i   1.4687 + 0.0000i % found by eigs(A,B,5,4.13)

So yes, there is a workaround. 是的,有一个解决方法。 But it requires more work to perform robustly and correctly, which is the norm for problems involving singular matrices. 但它需要更多的工作才能稳健而正确地执行,这是涉及奇异矩阵的问题的norm

The "best way", I would say, is that if the problem fits into memory and can be computed directly in a reasonable amount of time, do so. 我想说,“最好的方法”是,如果问题适合记忆并且可以在合理的时间内直接计算,那么就这样做。 Otherwise, the above shift method can supplement the work with effort. 否则,上述移位方法可以付出努力来补充工作。


1 I'll note that not all values of sigma will work. 1我会注意到并非所有sigma值都有效。 For the example presented above, 1 fails: 对于上面给出的示例, 1失败:

>> eigs(A,B,5,1)
Error using eigs/checkInputs/LUfactorAminusSigmaB (line 994)
The shifted operator is singular. The shift is an eigenvalue.
 Try to use some other shift please.

Do to the large number of 1 eigenvalues in the example system, the chosen shift creates a singular C matrix, which is not good. 对示例系统中的大量1特征值做,所选择的移位创建了一个奇异的C矩阵,这是不好的。 Slightly moving off of this point remedies the error. 稍微偏离这一点可以弥补错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM