core icon indicating copy to clipboard operation
core copied to clipboard

convergence failure in apf/eigen()

Open joshia5 opened this issue 4 years ago • 3 comments

For a 3x3 input matrix A = 22391.839134, -79303.375391, 44018.262128 , -79303.375391, 294606.941173, -172004.515247, 44018.262128, -172004.515247, 521170.455823

the eigen function https://github.com/SCOREC/core/blob/30a332d97469e9719313e312512b2d407e912f54/apf/apfMatrix.cc#L68

fails to converge at https://github.com/SCOREC/core/blob/30a332d97469e9719313e312512b2d407e912f54/apf/apfMatrix.cc#L76

However it was confirmed externally that performing eigen value decomposition for this input A is possible.

joshia5 avatar Mar 30 '21 21:03 joshia5

Yeah, the following octave code appears to have no problem with it:

(ins)>> A = [[22391.839134, -79303.375391, 44018.262128],
[-79303.375391, 294606.941173, -172004.515247],
[44018.262128, -172004.515247, 521170.455823]]
(ins)>> [v, lambda] = eig(A)
v =

   9.6457e-01  -2.3116e-01   1.2717e-01
   2.6377e-01   8.3470e-01  -4.8342e-01
   5.5972e-03   4.9983e-01   8.6610e-01

lambda =

Diagonal Matrix

   9.6070e+02            0            0
            0   2.1357e+05            0
            0            0   6.2364e+05

cwsmith avatar Mar 31 '21 12:03 cwsmith

@cwsmith and @joshia5 It seems that the way QR decomposition is implemented in PUMI has a difficulty when matrix entities are large numbers. Fixing that might take a while for me. I will let you know once that is done.

In the mean time, you can get around this error by doing the following (so @joshia5 can move forward with his pumi tests):

  1. Divide all the elements of M by a large factor (1000.0 for example).
  2. Then use the eigen decomposition
  3. Multiply the eigen values by the same factor (1000.0). Eigen vectors are the same for both the scaled down M and original M, so nothing needs to be done there.

mortezah avatar Mar 31 '21 21:03 mortezah

@mortezah ok, thanks

joshia5 avatar Apr 02 '21 01:04 joshia5