Problems with using Eigs for a function

3 visualizaciones (últimos 30 días)
Emil Ringh
Emil Ringh el 16 de Nov. de 2015
Comentada: Emil Ringh el 17 de Nov. de 2015
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?

Respuesta aceptada

Steven Lord
Steven Lord el 16 de Nov. de 2015
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.

Más respuestas (0)

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by