Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Eigs with function handle

220 views
Skip to first unread message

Lorenzo

unread,
May 19, 2014, 6:02:08 PM5/19/14
to
Dear guys,

I'm having problems using eigs with function handle. Basically when I use the function handle I get completely wrong results. I am trying to find the eigenvector related to the smallest eigenvalue, in modulus, of a large matrix. I know that this smallest eigenvalue is actually zero.

I would like to use eigs with the function handle as I have a more efficient way of computing the matrix vector multiplication (and I don't need to store a huge matrix).

Any idea where the error can come from?

At some point I thought that part of the problem arises because the eigenvalue is ezactly zero and eigs performs a LU decomposition at the beginning.

Thank you,

Best regards

L

dpb

unread,
May 19, 2014, 9:52:32 PM5/19/14
to
On 5/19/2014 5:02 PM, Lorenzo wrote:
> Dear guys,
>
> I'm having problems using eigs with function handle. Basically when I
> use the function handle I get completely wrong results. I am trying to
> find the eigenvector related to the smallest eigenvalue, in modulus, of
> a large matrix. I know that this smallest eigenvalue is actually zero.
> I would like to use eigs with the function handle as I have a more
> efficient way of computing the matrix vector multiplication (and I don't
> need to store a huge matrix).
> Any idea where the error can come from?
...

Not w/o anything to look at, no...

--

Steven Lord

unread,
May 20, 2014, 11:49:20 AM5/20/14
to

"Lorenzo " <lcam...@usc.edu> wrote in message
news:lldv10$1oh$1...@newscl01ah.mathworks.com...
> Dear guys,
>
> I'm having problems using eigs with function handle. Basically when I use
> the function handle I get completely wrong results. I am trying to find
> the eigenvector related to the smallest eigenvalue, in modulus, of a large
> matrix. I know that this smallest eigenvalue is actually zero.
> I would like to use eigs with the function handle as I have a more
> efficient way of computing the matrix vector multiplication (and I don't
> need to store a huge matrix).
> Any idea where the error can come from?

Not without seeing some code, no.

My first suspicion is that your function doesn't return what it should. From
the documentation for EIGS:

http://www.mathworks.com/help/matlab/ref/eigs.html?searchHighlight=Afun

y = Afun(x) should return:

A*x, if sigma is not specified, or is a string other than 'sm'
A\x, if sigma is 0 or 'sm'
(A-sigma*I)\x, if sigma is a nonzero scalar (standard eigenvalue problem). I
is an identity matrix of the same size as A.
(A-sigma*B)\x, if sigma is a nonzero scalar (generalized eigenvalue problem)

If you're passing in 0 or 'sm' for sigma, your function should not return
A*x but the solution y to the system of equations A*y = x.

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Andrew Knyazev

unread,
May 15, 2015, 6:33:17 PM5/15/15
to
The function handle to the matrix itself is no good. You need a function handle either to the action of the matrix inverse (expensive) on a vector, or of the matrix square (slow convergence of eigs). There is no free lunch either way.

"Lorenzo" wrote in message <lldv10$1oh$1...@newscl01ah.mathworks.com>...
0 new messages