MATLAB: How to find eigenvalue/vector pairs of a linear operator (without having ‘explicit’ matrix expression)? Like what in Python ‘matvec’ does

eigeneigenfunctionseigenvalueseigenvectorslinear operatorsMATLABmatrixmatrix manipulation

So I have a function, say 'T' in Matlab that takes input vector 'x' and spits out vector 'y' in a linear fashion. I'm interested to know the largest real part of its Eigen-values and the corresponding Eigen-vector.
—–
If I could construct 'T' efficiently of course I would just use 'eigs' command with some options; but there is a step in the construction of 'T' that involves inverting a really big matrix– it becomes quite expensive and quickly becomes preventative in both RAM and CPU usages.
—–
So I want its eigenvalue/vector pairs without calculating the operator out explicitly and I realized that Python has a built-in for that — 'matvec', that takes a function and finds its Eigen-pairs. So far in Matlab I have yet to find the counterpart for it. (As a Matlab fan I'm not ready to convert to Python yet so help me out here lol).
—–
Let me know, thanks!
—–
ps: 'T' 's structure is some thing like T = A * B \ C *D ; A, B, C, D are sparse, and really big. Before exploring its sparseness and circulant properties I like to try this first. Thanks.

Best Answer

"d = eigs(Afun,n,___) specifies a function handle Afun instead of a matrix. The second input n gives the size of matrix A used in Afun. You can optionally specify B, k, sigma, opts, or name-value pairs as additional input arguments."
The "Eigenvalues Using Function Handle" example on that page shows the general technique. While that example actually constructs and factors the A matrix, creating the matrix explicitly is not necessary. eigs doesn't care whether you do or even can explicitly create the matrix A inside your function so long as your Afun function computes some function of A and a vector x (usually either A*x or A\x depending on the value you specify for sigma.) See the documentation for the Afun input argument on that page for more information about how it interacts with sigma.
Related Question