Module: Linear Algebra Group: Nonsymmetric Eigenvalue Decomposition classes
Does not inherit
B() BInvTx() BInvTX() Bx() BX() |
cols() eigenValue() eigenValues() factor() good() |
move() moveToFront() rows() RWSchurDecomp() Z() |
ZTx() ZTX() Zx() ZX() |
#include <rw/lapack/schur.h> RWSchurDecomp<double> schur(A); // A is an
// RWGenMat<double>
A Schur decomposition uses orthogonal transformations to reduce a matrix A to a matrix T that is upper quasitriangular. For a complex matrix, T is actually triangular. For a real matrix, T is triangular, except the diagonal can contain 2 x 2 blocks, allowing nonzero entries on the subdiagonal. The columns of the orthogonal transformation matrix, Z, are called Schur vectors.
The class RWSchurDecomp<T> encapsulates a Schur decomposition as well as an optional balance transformation. The decomposition of a matrix A is:
where Z is orthogonal, T is quasi-upper triangular, and B is a balance transformation (see RWBalanceTransform<T>). The Schur decomposition yields eigenvalues immediately. Since the eigenvalues of A and T are the same, and since T is quasi-upper triangular, the eigenvalues are simply either the diagonal elements of T, or the complex conjugate pair corresponding to the eigenvalues of a 2 x 2 block on the diagonal. The invariant subspace corresponding to the first k eigenvalues of A is spanned by the first k Schur vectors; since the matrix of Schur vectors, Z, is orthogonal, this basis is orthonormal. Often, the Schur vectors are preferable to the eigenvectors themselves because of this orthogonality.
#include <iostream> #include <rw/lapack/hess.h> int main() { RWGenMat<double> A; std::cin >> A; RWSchurDecomp<double> schur(A,false,false); // false for // no balancing std::cout << "Input matrix: " << A << std::endl; std::cout << "eigenvalues: " << schur.eigenvalues() << std::endl; std::cout << "Schur vectors: " << schur.Z() << std::endl; return 0; }
RWSchurDecomp();
Default constructor. Builds a decomposition of size 0 x 0.
RWSchurDecomp(const RWGenMat<T>& A, bool permute=true, bool scale=true);
Constructs the Schur decomposition of the matrix A. The boolean parameters determine whether or not the permutation or scaling parts of the balance transformation are applied prior to forming the Schur decomposition.
RWSchurDecomp(const RWBalanceDecomp<T>& A);
Builds a Schur decomposition of the matrix represented by the balance decomposition.
RWSchurDecomp(const RWHessenbergDecomp<T>& A);
Builds a Schur decomposition of the matrix represented by the Hessenberg decomposition.
RWGenMat<T> B() const;
Computes an explicit representation of the balance transformation.
RWMathVec<T> Bx(const RWMathVec<T>& x); RWMathVec<T> BInvTx(const RWMathVec<T>& x); RWGenMat<T> BX(const RWGenMat<T>& X); RWGenMat<T> BInvTX(const RWGenMat<T>& X);
Computes the inner product of the balance transformation B, or its (conjugate) transpose inverse, and the vector x or the matrix X.
unsigned cols();
Returns the number of columns in the matrix that the decomposition represents.
DComplex eigenValue(int i) const;
Returns the ith eigenvalue.
RWMathVec<DComplex> eigenValues() const;
Returns a vector of all computed eigenvalues.
void factor(const RWGenMat<T>& A,
bool permute=true, bool scale=true);
Replaces the current decomposition with the Schur decomposition of the matrix A. The boolean parameters determine whether or not the permutation or scaling parts of the balance transformation are applied prior to forming the Schur decomposition.
void factor(const RWHessenbergDecomp<T>& A);
Replaces the current decomposition with the Schur decomposition of the matrix represented by the Hessenberg decomposition.
void factor(const RWBalanceDecomp<T>& A);
Replaces the current decomposition with the Schur decomposition of the matrix represented by the balance decomposition.
bool good();
Returns true if the decomposition was successfully computed, false if not.
int move(int i, int j);
Reorders the decomposition so that the ith eigenvalue is moved to the jth position. In the real case, if i corresponds to a 2 x 2 block (a complex eigenvalue), the entire block is moved. The function returns where the eigenvalue was actually moved to; this may differ from j for two reasons: it may have been impossible to move the eigenvalue to position j due to the presence of 2 x 2 blocks, or the matrix may be extremely ill-conditioned.
bool moveToFront(const RWMathVec<int>&);
Reorders the decomposition so that the eigenvalues whose indices are passed in the vector are moved to the front. In the real case, if an index corresponds to a 2 x 2 block (a complex eigenvalue), the entire block is moved. The function returns true if the reordering is successful.
unsigned rows();
Returns the number of rows in the matrix that the decomposition represents.
RWGenMat<T> Z() const;
Computes an explicit representation of the orthogonal matrix Z.
RWMathVec<T> Zx(const RWMathVec<T>& x); RWMathVec<T> ZTx(const RWMathVec<T>& x); RWGenMat<T> ZX(const RWGenMat<T>& X); RWGenMat<T> ZTX(const RWGenMat<T>& X);
Computes the inner product of the orthogonal matrix Z, or its (conjugate) transpose, and the vector x or the matrix X.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.