Re: help about ARPACK solver



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.

.



Relevant Pages

  • Re: help about ARPACK solver
    ... I compare the eigenvectors from my fortran program and Matlab given by ... You've generated a random matrix in Matlab. ...
    (sci.math.num-analysis)
  • Re: help about ARPACK solver
    ... I compare the eigenvectors from my fortran program and Matlab given by ... You've generated a random matrix in Matlab. ...
    (sci.math.num-analysis)
  • Re: normalised mode shapes
    ... I don't know about the syntax in Matlab, but you won't get the eigenvalues by dividing K by M, this operation is only defined for scalars.... ... The eigenvectors you can,,normalize" to some quantity, these eigenvectors represent our mode shapes. ...
    (sci.engr.analysis)
  • Re: Round-off error?
    ... Thank you Roger for your reply. ... I'm trying to use Matlab to solve ... for the eigenvectors corresponding to the 0 eigenvalue of a matrix. ... nature as to tolerate a certain amount of roundoff error. ...
    (comp.soft-sys.matlab)
  • Re: Round-off error?
    ... for the eigenvectors corresponding to the 0 eigenvalue of a matrix. ... The matrix entries are computed by hand and they are exact. ... In Matlab, one function that may be of help is 'eps'. ... nature as to tolerate a certain amount of roundoff error. ...
    (comp.soft-sys.matlab)

Loading