eigenValuesReturn eigenvalues and eigenvectors for a real, nonsymmetric matrix in a Real representation |
|
This information is part of the Modelica Standard Library maintained by the Modelica Association.
eigenvalues = Matrices.eigenValues(A);
(eigenvalues, eigenvectors) = Matrices.eigenValues(A);
This function call returns the eigenvalues and optionally the (right) eigenvectors of a square matrix A. The first column of "eigenvalues" contains the real and the second column contains the imaginary part of the eigenvalues. If the i-th eigenvalue has no imaginary part, then eigenvectors[:,i] is the corresponding real eigenvector. If the i-th eigenvalue has an imaginary part, then eigenvalues[i+1,:] is the conjugate complex eigenvalue and eigenvectors[:,i] is the real and eigenvectors[:,i+1] is the imaginary part of the eigenvector of the i-th eigenvalue. With function Matrices.eigenValueMatrix, a real block diagonal matrix is constructed from the eigenvalues such that
A = eigenvectors * eigenValueMatrix(eigenvalues) * inv(eigenvectors)
provided the eigenvector matrix "eigenvectors" can be inverted (an inversion is possible, if all eigenvalues are different; in some cases, an inversion is also possible if some eigenvalues are the same).
Real A[3,3] = [1,2,3;
3,4,5;
2,1,4];
Real eval[3,2];
algorithm
eval := Matrices.eigenValues(A); // eval = [-0.618, 0;
// 8.0 , 0;
// 1.618, 0];
i.e., matrix A has the 3 real eigenvalues -0.618, 8, 1.618.
| A |
Type: Real[:,size(A, 1)] Description: Matrix |
|---|
| eigenvalues |
Type: Real[size(A, 1),2] Description: Eigenvalues of matrix A (Re: first column, Im: second column) |
|---|---|
| eigenvectors |
Type: Real[size(A, 1),size(A, 2)] Description: Real-valued eigenvector matrix |