SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWSchurDecomp< TypeT > Class Template Reference

Encapsulates a Schur decomposition as well as an optional balance transformation. More...

#include <rw/lapack/schur.h>

Public Member Functions

 RWSchurDecomp ()
 
 RWSchurDecomp (const RWGenMat< TypeT > &A, bool permute=true, bool scale=true)
 
 RWSchurDecomp (const RWBalanceDecomp< TypeT > &)
 
 RWSchurDecomp (const RWHessenbergDecomp< TypeT > &)
 
RWGenMat< TypeT > B () const
 
RWMathVec< TypeT > BInvTx (const RWMathVec< TypeT > &x) const
 
RWGenMat< TypeT > BInvTX (const RWGenMat< TypeT > &X) const
 
RWMathVec< TypeT > Bx (const RWMathVec< TypeT > &x) const
 
RWGenMat< TypeT > BX (const RWGenMat< TypeT > &X) const
 
unsigned cols () const
 
DComplex eigenvalue (int) const
 
RWMathVec< DComplexeigenvalues () const
 
void factor (const RWGenMat< TypeT > &A, bool permute=true, bool scale=true)
 
void factor (const RWBalanceDecomp< TypeT > &)
 
void factor (const RWHessenbergDecomp< TypeT > &)
 
bool good () const
 
int move (int i, int j)
 
bool moveToFront (const RWMathVec< int > &)
 
unsigned rows () const
 
RWGenMat< TypeT > T () const
 
RWGenMat< TypeT > Z () const
 
RWMathVec< TypeT > ZTx (const RWMathVec< TypeT > &x) const
 
RWGenMat< TypeT > ZTX (const RWGenMat< TypeT > &X) const
 
RWMathVec< TypeT > Zx (const RWMathVec< TypeT > &x) const
 
RWGenMat< TypeT > ZX (const RWGenMat< TypeT > &X) const
 

Detailed Description

template<class TypeT>
class RWSchurDecomp< TypeT >

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 encapsulates a Schur decomposition as well as an optional balance transformation. The decomposition of a matrix A is:

\[ A = BZTZ'B^{-1} \]

where Z is orthogonal, T is quasi-upper triangular, and B is a balance transformation (see RWBalanceTransform ). 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.

Synopsis
#include <rw/lapack/schur.h>
RWSchurDecomp<double> schur(A); // A is an
// RWGenMat<double>
Example
#include <iostream>
#include <rw/lapack/hess.h>
int main()
{
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;
}

Constructor & Destructor Documentation

template<class TypeT>
RWSchurDecomp< TypeT >::RWSchurDecomp ( )

Default constructor. Builds a decomposition of size 0 x 0.

template<class TypeT>
RWSchurDecomp< TypeT >::RWSchurDecomp ( const RWGenMat< TypeT > &  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.

template<class TypeT>
RWSchurDecomp< TypeT >::RWSchurDecomp ( const RWBalanceDecomp< TypeT > &  )

Builds a Schur decomposition of the matrix represented by the balance decomposition.

template<class TypeT>
RWSchurDecomp< TypeT >::RWSchurDecomp ( const RWHessenbergDecomp< TypeT > &  )

Builds a Schur decomposition of the matrix represented by the Hessenberg decomposition.

Member Function Documentation

template<class TypeT>
RWGenMat<TypeT> RWSchurDecomp< TypeT >::B ( ) const

Computes an explicit representation of the balance transformation.

template<class TypeT>
RWMathVec<TypeT> RWSchurDecomp< TypeT >::BInvTx ( const RWMathVec< TypeT > &  x) const

Computes the inner product of the balance transformation B, or its (conjugate) transpose inverse, and the vector x.

template<class TypeT>
RWGenMat<TypeT> RWSchurDecomp< TypeT >::BInvTX ( const RWGenMat< TypeT > &  X) const

Computes the inner product of the balance transformation B, or its (conjugate) transpose inverse, and the matrix X.

template<class TypeT>
RWMathVec<TypeT> RWSchurDecomp< TypeT >::Bx ( const RWMathVec< TypeT > &  x) const

Computes the inner product of the balance transformation B, or its (conjugate) transpose inverse, and the vector x.

template<class TypeT>
RWGenMat<TypeT> RWSchurDecomp< TypeT >::BX ( const RWGenMat< TypeT > &  X) const

Computes the inner product of the balance transformation B, or its (conjugate) transpose inverse, and the matrix X.

template<class TypeT>
unsigned RWSchurDecomp< TypeT >::cols ( ) const
inline

Returns the number of columns in the matrix that the decomposition represents.

template<class TypeT>
DComplex RWSchurDecomp< TypeT >::eigenvalue ( int  ) const

Returns the i th eigenvalue.

template<class TypeT>
RWMathVec<DComplex> RWSchurDecomp< TypeT >::eigenvalues ( ) const
inline

Returns a vector of all computed eigenvalues.

template<class TypeT>
void RWSchurDecomp< TypeT >::factor ( const RWGenMat< TypeT > &  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.

template<class TypeT>
void RWSchurDecomp< TypeT >::factor ( const RWBalanceDecomp< TypeT > &  )

Replaces the current decomposition with the Schur decomposition of the matrix represented by the balance decomposition.

template<class TypeT>
void RWSchurDecomp< TypeT >::factor ( const RWHessenbergDecomp< TypeT > &  )

Replaces the current decomposition with the Schur decomposition of the matrix represented by the Hessenberg decomposition.

template<class TypeT>
bool RWSchurDecomp< TypeT >::good ( ) const

Returns true if the decomposition was successfully computed, false if not.

template<class TypeT>
int RWSchurDecomp< TypeT >::move ( int  i,
int  j 
)

Reorders the decomposition so that the i theigenvalue is moved to the j th 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.

template<class TypeT>
bool RWSchurDecomp< TypeT >::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.

template<class TypeT>
unsigned RWSchurDecomp< TypeT >::rows ( ) const
inline

Returns the number of rows in the matrix that the decomposition represents.

template<class TypeT>
RWGenMat<TypeT> RWSchurDecomp< TypeT >::T ( ) const

Computes an explicit representation of the quasi-upper triangular matrix T.

template<class TypeT>
RWGenMat<TypeT> RWSchurDecomp< TypeT >::Z ( ) const

Computes an explicit representation of the orthogonal matrix Z.

template<class TypeT>
RWMathVec<TypeT> RWSchurDecomp< TypeT >::ZTx ( const RWMathVec< TypeT > &  x) const

Computes the inner product of the orthogonal matrix Z, or its (conjugate) transpose, and the vector x.

template<class TypeT>
RWGenMat<TypeT> RWSchurDecomp< TypeT >::ZTX ( const RWGenMat< TypeT > &  X) const

Computes the inner product of the orthogonal matrix Z, or its (conjugate) transpose, and the matrix X.

template<class TypeT>
RWMathVec<TypeT> RWSchurDecomp< TypeT >::Zx ( const RWMathVec< TypeT > &  x) const

Computes the inner product of the orthogonal matrix Z, or its (conjugate) transpose, and the vector x.

template<class TypeT>
RWGenMat<TypeT> RWSchurDecomp< TypeT >::ZX ( const RWGenMat< TypeT > &  X) const

Computes the inner product of the orthogonal matrix Z, or its (conjugate) transpose, and the matrix X.

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.