ProductName  

Finds the complex Eigenvalues and Eigenvectors of the current matrix object.

Syntax

MatrixObject.EigenC Eigenvalues, Eigenvectors

Parameters

Eigenvalues
Optional. A CMatrix object variable that, upon exit, will contain the reference to a one-column complex matrix (vector) containing the Eigenvalues of current matrix.
Eigenvectors
Optional. A CMatrix object variable that, upon exit, will contain the reference to a complex matrix having the Eigenvectors of current matrix as columns.

Remarks

If Eigenvectors parameter is omitted or is not set, only Eigenvalues are calculated and EigenC method proceeds faster.

Eigenvectors are returned normalized.

The EigenC method is supported only in the Advanced and Advanced II editions of ShortName .

Error Codes

Error 1305 is returned if matrix is not square.

Error 1317 is returned if internal routines can not converge to a valid Eigenvalue.

Example

This example demonstrates the use of EigenC method. A complex matrix is created, then its Eigenvalues and Eigenvectors are calculated and verified using the relation A x X = λ x X .

Private Sub MatrixEigenC()

Dim A As CMatrix, X As CMatrix
Dim eVal As CMatrix, eVec As CMatrix
Dim VL As CMatrix, VR As CMatrix
Dim Lambda As Complex, c2 As Complex

Dim N As Long, i As Long

    N = 4
    Set A = New CMatrix
    A.Size N, N
    'fill matrix with random values
    A.FillRandom
    
    'print this matrix
    Debug.Print "Eigenvalues and Eigenvectors of the following matrix"
    Debug.Print "will be calculated and verified using the equation"
    Debug.Print "  A x X = Lambda x X  where:"
    Debug.Print "      A = original matrix"
    Debug.Print "  Lambda = one of the Eigenvalues"
    Debug.Print "      X = the eigenvector relative to Lambda"
    Debug.Print
    Debug.Print A.GetString
    
    'CMatrix eVal will hold Eigenvalues
    Set eVal = New CMatrix
    
    'CMatrix eVec will hold Eigenvectors
    Set eVec = New CMatrix

    'Execute EigenC method
    A.EigenC eVal, eVec

'Verify Eigenvalues and Eigenvectors
For i = 0 To N - 1

    'Get one Eigenvalue
    Lambda = eVal(i, 0)
    
    'Set X to its corresponding eigenvector
    Set X = eVec.ColVector(i)
    
    'Form the product VL = A x X  (left side of equation)
    Set VL = A.Times(X)
    
    'Multiply X by Lambda (right side of equation)
    Set VR = X.TimesScalar(Lambda)

    'Now print the results
    Debug.Print "Eigenvalue = ("; Lambda.Real; ","; Lambda.Imag; "i )"
    Debug.Print "======================================================"
    Debug.Print "Eigenvector ="
    Debug.Print X.GetString
    Debug.Print "A x X = "
    Debug.Print VL.GetString
    Debug.Print "Lambda x X ="
    Debug.Print VR.GetString

Next

End Sub

Output

Eigenvalues and Eigenvectors of the following matrix
will be calculated and verified using the equation
  A x X = Lambda x X  where:
      A = original matrix
  Lambda = one of the Eigenvalues
      X = the eigenvector relative to Lambda

| ( 6.000, 2.000i) ( 8.000, 6.000i) ( 5.000, 4.000i) ( 9.000, 8.000i) |
| ( 7.000, 2.000i) ( 9.000, 7.000i) ( 5.000, 3.000i) ( 0.000, 1.000i) |
| ( 4.000, 1.000i) ( 2.000,10.000i) ( 4.000, 1.000i) ( 0.000, 0.000i) |
| ( 4.000, 5.000i) ( 6.000, 6.000i) ( 6.000, 2.000i) ( 7.000, 5.000i) |

Eigenvalue = ( 20.910749103084 , 15.2264581695892 i )
======================================================
Eigenvector =
| ( 1.000, 0.000i) |
| ( 0.684,-0.087i) |
| ( 0.439, 0.084i) |
| ( 0.860, 0.085i) |

A x X = 
| (20.911,15.226i) |
| (15.622, 8.606i) |
| ( 7.906, 8.443i) |
| (16.685,14.857i) |

Lambda x X =
| (20.911,15.226i) |
| (15.622, 8.606i) |
| ( 7.906, 8.443i) |
| (16.685,14.857i) |

Eigenvalue = ( 3.01700723331469 , 6.45149893589417 i )
======================================================
Eigenvector =
| ( 1.000, 0.000i) |
| (-0.533, 0.113i) |
| (-0.786,-0.189i) |
| ( 0.916, 0.389i) |

A x X = 
| ( 3.017, 6.451i) |
| (-2.338,-3.094i) |
| (-1.153,-5.640i) |
| ( 0.254, 7.082i) |

Lambda x X =
| ( 3.017, 6.451i) |
| (-2.338,-3.094i) |
| (-1.153,-5.640i) |
| ( 0.254, 7.082i) |

Eigenvalue = ( 3.31248266730594 ,-3.10652162761071 i )
======================================================
Eigenvector =
| (-0.428, 0.800i) |
| (-0.626,-0.308i) |
| ( 1.000, 0.000i) |
| ( 0.335,-0.048i) |

A x X = 
| ( 1.068, 3.979i) |
| (-3.030, 0.927i) |
| ( 3.312,-3.107i) |
| ( 0.963,-1.200i) |

Lambda x X =
| ( 1.068, 3.979i) |
| (-3.030, 0.927i) |
| ( 3.312,-3.107i) |
| ( 0.963,-1.200i) |

Eigenvalue = (-1.24023900370467 ,-3.57143547787271 i )
======================================================
Eigenvector =
| ( 1.000, 0.000i) |
| (-0.551, 0.008i) |
| ( 0.119, 0.753i) |
| (-0.386,-0.388i) |

A x X = 
| (-1.240,-3.571i) |
| ( 0.713, 1.956i) |
| ( 2.540,-1.359i) |
| (-0.906, 1.859i) |

Lambda x X =
| (-1.240,-3.571i) |
| ( 0.713, 1.956i) |
| ( 2.540,-1.359i) |
| (-0.906, 1.859i) |

See Also

Eigen Method

Applies To: Matrix | CMatrix