Problems with using Eigs for a function

4 次查看(过去 30 天)
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by