Schur¶
-
template<Number T, DataLocation L, template<typename, typename> typename S>
internal::Schur<T, L> schur(const Matrix<T, L, S> &A)¶ Computes the Schur form of a square matrix
A
: \( \mathbf{A} = \mathbf{UZU}^*\), where \( \mathbf{U} \) is a unitary matrix and \( \mathbf{Z} \) is an upper triangular matrix. This routine can also calculate the eigenvalues ofA
.This operation can be done in-place, e.g.,
A = schur(A)
. In this case,A
will be replaced by the matrixZ
.Usage:
Matrix<double> A; Vector<std::complex<double>> eigenvalues; Matrix<double> U; Matrix<double> Z; Z = schur(A); // Calculates only the upper triangular matrix Z tie(Z, U) = schur(A); // Calculates Z and the unitary matrix U tie(Z, U, eigenvalues) = schur(A); // Calculates Z, U and the eigenvalues
- Parameters:
A – [in] input matrix
- Returns:
An object representing the factorization.
-
template<Number T, DataLocation L, template<typename, typename> typename S>
internal::HessenbergSchur<T, L> hessenberg_schur(const Matrix<T, L, S> &H)¶ Computes the Schur form of an upper Hessenberg matrix
H
: \( \mathbf{H} = \mathbf{UZU}^*\), where \( \mathbf{U} \) is a unitary matrix and \( \mathbf{Z} \) is an upper triangular matrix. This routine can also calculate the eigenvalues ofH
.This operation can be done in-place, e.g.,
H = schur(H)
. In this case,H
will be replaced by the matrixZ
.Usage:
Matrix<double> H; Vector<std::complex<double>> eigenvalues; Matrix<double> U; Matrix<double> Z; Z = hessenberg_schur(A); // Calculates only the upper triangular matrix Z tie(Z, U) = hessenberg_schur(A); // Calculates Z and the unitary matrix U tie(Z, U, eigenvalues) = hessenberg_schur(A); // Calculates Z, U and the eigenvalues
- Parameters:
H – [in] input matrix
- Returns:
An object representing the factorization.
-
template<Number EigenT, Number T, DataLocation L, template<typename, typename> typename S1, template<typename, typename> typename S2, template<typename, typename> typename S3>
void reorder_schur(Matrix<T, L, S1> &Z, Matrix<T, L, S2> &U, Vector<EigenT, L, S3> &eigenvalues, SortOrder order, index_t &ell)¶ Reorder the Schur form such that the
ell
smallest or largest eigenvalues are located at the begining ofZ
. The eigenvalues are also reorder.Warning
If the
ell
-th andell + 1
-th eigenvalues are complex conjugate from each other, than theell + 1
is also included in the reorder form andell
is increased by1
.- Parameters:
Z – [inout] quasi-upper triangular matrix from the Schur form
U – [inout] unitary matrix from the Schur form
eigenvalues – [inout] eigenvalues of
Z
order – [in] either
kAscending
orkDescending
ell – [inout] the number of eigenvalues selectecd