[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Minor problem with "test eigs.cc"
From: |
Ben Abbott |
Subject: |
Minor problem with "test eigs.cc" |
Date: |
Thu, 07 Jan 2010 23:00:56 -0500 |
Usually the tests for eigs.cc pass. However, occasionally a test fails ...
octave:23> for n=1:10
> test eigs.cc
> end
PASSES 149 out of 149 tests
PASSES 149 out of 149 tests
PASSES 149 out of 149 tests
PASSES 149 out of 149 tests
PASSES 149 out of 149 tests
PASSES 149 out of 149 tests
PASSES 149 out of 149 tests
PASSES 149 out of 149 tests
warning: eigs: Only 2 of the 4 requested eigenvalues converged
PASSES 149 out of 149 tests
***** testif HAVE_ARPACK
[v1,d1] = eigs(A, k, 'li');
d1 = diag(d1);
for i=1:k
assert(max(abs((A - d1(i)*eye(n))*v1(:,i))),0.,1e-11)
endfor
!!!!! test failed
assert (max (abs ((A - d1 (i) * eye (n)) * v1 (:, i))),0.,1e-11) expected
0
but got
5.4678e-10
maximum absolute error 5.46777e-10 exceeds tolerance 1e-11
The "si" case also fails occasionally.
I checked to see what v1 and d1 were equal to for the "si" case.
octave:28> test eigs.cc
v1 =
-1.2620e-15 4.3321e-01 1.3679e-15 -8.5117e-01
4.3321e-01 1.4068e-16 -8.5117e-01 -2.1346e-15
3.1932e-15 -8.2468e-01 -2.2144e-16 5.0501e-01
-8.2468e-01 -4.7564e-16 5.0501e-01 9.4326e-16
-2.0027e-15 3.5375e-01 8.5673e-17 -1.4078e-01
3.5375e-01 5.1071e-17 -1.4078e-01 -2.1120e-16
6.6293e-16 -8.3095e-02 -2.6173e-17 2.5413e-02
-8.3095e-02 5.6656e-18 2.5413e-02 3.0575e-17
-2.5145e-16 1.3363e-02 5.7272e-17 -3.3829e-03
1.3363e-02 -7.3601e-19 -3.3829e-03 2.5479e-17
9.8410e-17 -1.6307e-03 -6.5828e-17 3.5633e-04
-1.6307e-03 -7.4956e-19 3.5633e-04 2.8022e-17
5.1545e-17 1.6021e-04 -8.7960e-17 -3.1037e-05
1.6021e-04 2.9167e-17 -3.1037e-05 -8.0778e-17
-4.2127e-17 -1.3167e-05 -1.0555e-16 2.3039e-06
-1.3167e-05 -5.8575e-17 2.3039e-06 -8.9651e-17
-6.9868e-17 9.3001e-07 5.5030e-17 -1.4898e-07
9.3001e-07 -8.6356e-17 -1.4898e-07 6.8739e-17
1.1556e-16 -5.7778e-08 -1.7364e-17 8.5590e-09
-5.7778e-08 -2.1737e-16 8.5590e-09 1.7395e-16
d1 =
Diagonal Matrix
3.9036 0 0 0
0 2.9036 0 0
0 0 2.5933 0
0 0 0 1.5933
PASSES 149 out of 149 tests
Would it not be better to test a case where the imaginary part wasn't expected
to be zero?
For example,
%!testif HAVE_ARPACK
%! [v1,d1] = eigs(1i*A, k, 'li');
%! d1 = diag(d1);
%! for i=1:k
%! assert(max(abs((1i*A - d1(i)*speye(n))*v1(:,i))),0.,1e-11)
%! endfor
%!testif HAVE_ARPACK
%! [v1,d1] = eigs(1i*A, k, 'si');
%! d1 = diag(d1);
%! for i=1:k
%! assert(max(abs((1i*A - d1(i)*speye(n))*v1(:,i))),0.,1e-11)
%! endfor
This doesn't fail for me.
Ben
- Minor problem with "test eigs.cc",
Ben Abbott <=