Problems with using Eigs for a function

3 ビュー (過去 30 日間)
Emil Ringh
Emil Ringh 2015 年 11 月 16 日
コメント済み: Emil Ringh 2015 年 11 月 17 日
Hi,
I have problems with the interface of eigs(). I have a matrix T
T= [A B
C D]
where matrix vector multiplication can be implemented with FFT for the block D, and the rest are sparse. Hence I have created a function for T rather than a matrix. I want to compute some of the eigenvalues of T, but have problems with the interface of eigs(). I have tried different ways of calling eigs but it always gives me errors.
Note: I did read the manual and when implementing T as an ordinary matrix it works fine... I'm also aware of that the function sent to eigs should implement "T\b" but now I'm just trying to figure out the interface.
When T is implemented as a sparse matrix, the following call works fine
[v_initial, eigenvalue] = eigs(T_old, 1, 'sm');
But when I use T as a function I get the following error:
Error using eigs/checkInputs (line 496)
Generalized matrix B must be the same size as A.
Error in eigs (line 93)
[A,Amatrix,isrealprob,issymA,n,B,classAB,k,eigs_sigma,whch, ...
In the debugger I can see that the matrix B now has gotten the value 'sm'. Just because I shifted from explicit matrix to function, the interface changed...
Question: How is the interface when you use a function instead of an explicit matrix?

採用された回答

Steven Lord
Steven Lord 2015 年 11 月 16 日
Replace the A matrix input with the two inputs AFUN and N. You need to tell MATLAB not only the function it should use to compute but also how large a vector X it should pass into that function as demonstrated by the use of the extra "n" input in the second example in the EIGS documentation as compared with the first example.
  1 件のコメント
Emil Ringh
Emil Ringh 2015 年 11 月 17 日
Silly me... Thanks a lot! :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by