X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Jun 2018 09:43 AM by  David Starbuck
TRIQL and LA_TRIQL, order of results?
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Nikola Vitas



New Member


Posts:
New Member


--
04 Jun 2018 05:36 PM
    Apparently TRIQL and LA_TRIQL do different ordering of the resulting eigenvalues. Of course, this was hidden at the very bottom of my code causing a cascade of strange numbers and hours of debugging.

    If someone has insight into these routines, it would be important to know how each of them orders the results.

    First example (same order of eigenvalues (d4 elements) returned by both, just reversed - TRIQL in the decreasing order, LA_TRIQL increasing):

    d4 = [-0.013922532, -0.018753912, -0.026000982, -0.035663742, -0.047742192]
    ud4 = [0.0000000, 0.082583840, 0.081095721, 0.071235330, 0.053307640]
    z4 = IDENTITY(5, /double)
    TRIQL, d4, ud4, z4, /double
    IDL> PRINT, d4
    0.10779511 0.035195967 -0.033131376 -0.096778214 -0.15516485

    d4 = [-0.013922532, -0.018753912, -0.026000982, -0.035663742, -0.047742192]
    ud4 = [0.082583840, 0.081095721, 0.071235330, 0.053307640]
    LA_TRIQL, d4, ud4, z4, /double
    IDL> PRINT, d4
    -0.15516485 -0.096778214 -0.033131376 0.035195967 0.10779511

    Second example, slightly different values, LA_TRIQL same as before (strictly increasing), but TRIQL permutes the first two values (0.039765426 0.12169396)?!:

    d4 = [-0.018585979, -0.023417359, -0.030664429, -0.040327189, -0.052405639]
    ud4 = [ 0.0000000, 0.094381532, 0.092680824, 0.081411806, 0.060923017]
    z4 = IDENTITY(5, /double)
    TRIQL, d4, ud4, z4, /double
    IDL> PRINT, d4
    0.039765426 0.12169396 -0.037821751 -0.11069443 -0.17834380

    d4 = [-0.018585979, -0.023417359, -0.030664429, -0.040327189, -0.052405639]
    ud4 = [ 0.094381532, 0.092680824, 0.081411806, 0.060923017]
    z4 = IDENTITY(5, /double)
    LA_TRIQL, d4, ud4, z4, /double
    IDL> PRINT, d4
    -0.17834380 -0.11069443 -0.037821751 0.039765426 0.12169396



    David Starbuck



    Basic Member


    Posts:143
    Basic Member


    --
    11 Jun 2018 09:43 AM
    I am afraid I don't have very much insight into the order that is returned by LA_TRIQL versus TRIQL. I suspect that there is something deep within the algorithms used by these routines that causes them to return in slightly different order. However, at least in my tests, the order of the eigen values is consistent with the order of the eigen vectors. That is to say that the order of the eigen vectors were changed in the same way as the eigen values. For example:

    A = [[ 3.0, 1.0, -4.0], $
    [ 1.0, 3.0, -4.0], $
    [-4.0, -4.0, 8.0]]

    TRIRED, A, D, E

    TRIQL, D, E, A

    ; Print eigenvalues:
    PRINT, 'Eigenvalues:'
    PRINT, D
    ; Print eigenvectors:
    PRINT, 'Eigenvectors:'
    PRINT, A


    A = [[ 3.0, 1.0, -4.0], $
    [ 1.0, 3.0, -4.0], $
    [-4.0, -4.0, 8.0]]

    q = a

    LA_TRIRED, q, d, e

    eigenvalues = d
    eigenvectors = q
    LA_TRIQL, eigenvalues, e, eigenvectors

    PRINT, 'LA_TRIQL eigenvalues:'
    PRINT, eigenvalues

    PRINT, 'LA_TRIQL eigenvectors:'
    PRINT, eigenvectors
    end


    The results of this code are shown below:

    Eigenvalues:
    2.00000 2.38419e-007 12.0000
    Eigenvectors:
    0.707107 -0.707107 0.000000
    -0.577350 -0.577350 -0.577350
    -0.408248 -0.408248 0.816497
    LA_TRIQL eigenvalues:
    -4.63333e-007 2.00000 12.0000
    LA_TRIQL eigenvectors:
    -0.577350 -0.577350 -0.577350
    0.707107 -0.707107-1.92667e-008
    -0.408248 -0.408248 0.816497


    -David
    HGS
    You are not authorized to post a reply.