Class GeneralizedEigenvalueDecomposition
Determines the Generalized eigenvalues and eigenvectors of two real square matrices.
Inheritance
Namespace: ISynergy.Framework.Mathematics.Decompositions
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public sealed class GeneralizedEigenvalueDecomposition : ICloneable
Remarks
A generalized eigenvalue problem is the problem of finding a vector v
that
obeys A * v = λ * B * v
where A
and B
are matrices. If v
obeys this equation, with some λ
, then we call v
the generalized eigenvector
of A
and B
, and λ
is called the generalized eigenvalue of A
and B
which corresponds to the generalized eigenvector v
. The possible
values of λ
, must obey the identity det(A - λ*B) = 0
.
Part of this code has been adapted from the original EISPACK routines in Fortran.
References:
Examples
// Suppose we have the following // matrices A and B shown below: double[,] A = { { 1, 2, 3}, { 8, 1, 4}, { 3, 2, 3} }; double[,] B = { { 5, 1, 1}, { 1, 5, 1}, { 1, 1, 5} }; // Now, suppose we would like to find values for λ // that are solutions for the equation det(A - λB) = 0 // For this, we can use a Generalized Eigendecomposition var gevd = new GeneralizedEigenvalueDecomposition(A, B); // Now, if A and B are Hermitian and B is positive // -definite, then the eigenvalues λ will be real: double[] lambda = gevd.RealEigenvalues; // Lets check if they are indeed a solution: for (var i = 0; i < lambda.Length; i++) { // Compute the determinant equation show above double det = Matrix.Determinant(A.Subtract(lambda[i].Multiply(B))); // almost zero }
Constructors
View SourceGeneralizedEigenvalueDecomposition(Double[,], Double[,], Boolean)
Constructs a new generalized eigenvalue decomposition.
Declaration
public GeneralizedEigenvalueDecomposition(double[, ] a, double[, ] b, bool sort = false)
Parameters
Type | Name | Description |
---|---|---|
System.Double[,] | a | The first matrix of the (A,B) matrix pencil. |
System.Double[,] | b | The second matrix of the (A,B) matrix pencil. |
System.Boolean | sort | Pass true to sort the eigenvalues and eigenvectors at the end of the decomposition. |
Properties
View SourceBetas
Returns the beta values.
Declaration
public double[] Betas { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
DiagonalMatrix
Returns the block diagonal eigenvalue matrix.
Declaration
public double[, ] DiagonalMatrix { get; }
Property Value
Type | Description |
---|---|
System.Double[,] |
Eigenvectors
Returns the eigenvector matrix.
Declaration
public double[, ] Eigenvectors { get; }
Property Value
Type | Description |
---|---|
System.Double[,] |
ImaginaryAlphas
Returns the imaginary parts of the alpha values.
Declaration
public double[] ImaginaryAlphas { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
ImaginaryEigenvalues
Returns the imaginary parts of the eigenvalues.
Declaration
public double[] ImaginaryEigenvalues { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
Remarks
The eigenvalues are computed using the ratio alpha[i]/beta[i], which can lead to valid, but infinite eigenvalues.
IsDegenerate
Returns true if the eigenvalue problem is degenerate (ill-posed).
Declaration
public bool IsDegenerate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsSingular
Returns true if matrix B is singular.
Declaration
public bool IsSingular { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This method checks if any of the generated betas is zero. It does not says that the problem is singular, but only that one of the matrices of the pencil (A,B) is singular.
RealAlphas
Returns the real parts of the alpha values.
Declaration
public double[] RealAlphas { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
RealEigenvalues
Returns the real parts of the eigenvalues.
Declaration
public double[] RealEigenvalues { get; }
Property Value
Type | Description |
---|---|
System.Double[] |
Remarks
The eigenvalues are computed using the ratio alpha[i]/beta[i], which can lead to valid, but infinite eigenvalues.
Methods
View SourceClone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |