Inconsistent answers from different computers using eig() function
조회 수: 9 (최근 30일)
이전 댓글 표시
I've been having issues lately with an inconsistency in answers from matlab across two different computers.
I have two sparse, double complex matrices (1800x1800 each) that are diagonally dominant. The command I'm running is
[vec,val]=eig(double(M1),double(-M2),'qz');
where M1 and M2 are the two matrices previously mentioned. A single computer gets the same answer every time, but the answers differ between computers.
I tried a simple test using the following code:
A=rand(5)+i*rand(5);
B=rand(5)+i*rand(5);
[vec,val]=eig(double(A),double(-B),'qz');
and both computers actually get the same answer. The obvious difference here is that A and B are all approximately the same order and are dense matrices as compared to M1 and M2.
I was wondering if there is anything specific I should be looking for in M1 and M2 to determine what is causing the different answers. Are there any ways I can make these answers match?
Further info:
- Both computers are running 64bit Linux Matlab 2012a (glnxa64) (7.14.0.739)
- Both computers are running Ubuntu 10.04
- Computer 1 is running: 2 Intel® Xeon® CPU X5482 @ 3.20GHz (8 cores total)
- Computer 2 is running: 2 Intel® Xeon® CPU X5670 @ 2.93GHz (12 cores total, 24 threads)
Here is a dropbox link to the M1 and M2 matrix in question https://www.dropbox.com/s/zwq6zwfkl3y3ha5/Matrices.mat
댓글 수: 2
Richard Brown
2013년 7월 31일
편집: Richard Brown
2013년 7월 31일
How different are the answers? Have you tried running single threaded?
Richard Brown
2013년 8월 1일
I just looked at your matrices. They're stored as dense matrices, and M2 is singular (which means that you have infinite eigenvalues). Also, you're not taking advantage of sparsity at all ... normally eigs is what you'd use.
Are you sure you're computing that which you intend to be computing?
채택된 답변
Nick
2013년 8월 1일
댓글 수: 4
Jan
2013년 8월 2일
Are you surprised, when the accuracy of the calculation of Eigen-vectors suffers from input matrices with an Inf condition?
You cannot "fix" a high condition number, like you cannot "fix" the problem, that a/b cannot reply a valid result when b is 0. A similar problem occurs for the difference quotient:
d = (f(x+h)-f(x)) / h
When h gets very small, the round-off errors in the calculation of f() are extremely amplified due to the division by a small number. Therefore it is impossible to obtain an "accurate" approximation of the derivative by this method. But you can usually find a magnitude of h such that half the number of digits are correct - in other word: When the calculations are performed in double precision, the result is correct in single precision.
Therefore I assume currently, that it is not a problem but an effect of the limited precision.
추가 답변 (1개)
Jan
2013년 8월 1일
When the two machine use a different number of threads, the results are expected to be affected by rounding effects (which I would not call rounding "errors" here). So please show us the magnitude of the differences.
If the (relative) differences are large, this could be caused by the condition of the eigen-value problem.
Notice than for eig(A, B) the inputs are not normalized, such that normalizing A and B externally might improve the stability, see doc eig.
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!