Re: help about ARPACK solver
- From: lorin <wwang.sz@xxxxxxxxx>
- Date: 18 May 2007 00:05:52 -0700
On May 17, 3:44 am, andy2O <and...@xxxxxxxxxxx> wrote:
On 16 May, 10:54, lorin <wwang...@xxxxxxxxx> wrote:
Hi,
I am now involved in a computational electromagnetics project and have
to obtain a few eigenvalues and corresponding eigenvectors of a large
non-symmetric complex matrix (2K-by-2K).
I know ARPACK solver is a good choice, and it works now. However, when
I compare the eigenvectors from my fortran program and Matlab given by
EIGS, I found a big mismatch between them, (but the eigenvalues are
OK.) This problem really confused me a lot. Can anyone help me about
this?
Thanks!
lorin
PS: The test matrix I used here is generated as following:
n = 2000;
mat_r = randn(n, n);
mat_i = randn(n, n);
mat = mat_r + 1i*mat_i;
Well, three thoughts come to mind:
1) You've generated a random matrix in Matlab. How have you
transferred these random numbers to Fortran for the test? Have you
lost some precision in this process? If so the eigenvectors may change
a bit.
2) As stated in comp.lang.fortran, the eigenvalues can differ by a
complex valued factor. This *is* allowed because if v is a eigenvector
with eigenvalue lamba then by definition A*v=lambda*v. So now let z be
any non-zero complex number. Then:
A*(z*v) = z*A*v = z*(A*v) = z*(lambda*v) = lambda*(z*v).
So therefore (z*v) is *also* an eigenvector of A corresponding to
eigenvalue lambda. Note that v and (z*v) are 'parallel' for any non-
zero z when you are working in complex space - and that's how you
should think of this. Note that if you are comparing 10 different
eigenvectors from one matrix, then the values of z which relate the
Matlab and Fortran eigenvector results can take ten different values!
This should not worry you! You just need them to be 'parallel'. If
this is true then you are OK - if they are not parallel then perhaps
you have a bug.
3) Why do your first tests with large random matrices??!! Why not
generate a small (2*2, 3*3 and 4*4 size) matrix with fixed
coefficients and test that first! You could even choose real valued
numbers (just set the imaginary component to zero - don't change the
Fortran datatype) to keep things simple.... Start simple!!! Do you
2000*2000 random matrix tests later!
Best wishes,
andy- Hide quoted text -
- Show quoted text -
Thanks for your detailed answer, Andy, it's very helpful.
.
- References:
- help about ARPACK solver
- From: lorin
- Re: help about ARPACK solver
- From: andy2O
- help about ARPACK solver
- Prev by Date: Re: Curve fitting for spherical equation
- Next by Date: Re: how do I make this work in Excel with Runge Kutta?
- Previous by thread: Re: help about ARPACK solver
- Next by thread: Re: help about ARPACK solver
- Index(es):
Relevant Pages
|
Loading