class SchurTransformer
extends java.lang.Object
A m × m matrix A can be written as the product of three matrices: A = P × T × PT with P an orthogonal matrix and T an quasi-triangular matrix. Both P and T are m × m matrices.
Transformation to Schur form is often not a goal by itself, but it is an
intermediate step in more general decomposition algorithms like
eigen decomposition
. This class is therefore
intended for internal use by the library and is not public. As a consequence
of this explicitly limited scope, many methods directly returns references to
internal arrays, not copies.
This class is based on the method hqr2 in class EigenvalueDecomposition from the JAMA library.
Modifier and Type | Class and Description |
---|---|
private static class |
SchurTransformer.ShiftInfo
Internal data structure holding the current shift information.
|
Modifier and Type | Field and Description |
---|---|
private RealMatrix |
cachedP
Cached value of P.
|
private RealMatrix |
cachedPt
Cached value of PT.
|
private RealMatrix |
cachedT
Cached value of T.
|
private double |
epsilon
Epsilon criteria taken from JAMA code (originally was 2^-52).
|
private double[][] |
matrixP
P matrix.
|
private double[][] |
matrixT
T matrix.
|
private static int |
MAX_ITERATIONS
Maximum allowed iterations for convergence of the transformation.
|
Constructor and Description |
---|
SchurTransformer(RealMatrix matrix)
Build the transformation to Schur form of a general real matrix.
|
Modifier and Type | Method and Description |
---|---|
private void |
computeShift(int l,
int idx,
int iteration,
SchurTransformer.ShiftInfo shift)
Compute the shift for the current iteration.
|
private int |
findSmallSubDiagonalElement(int startIdx,
double norm)
Find the first small sub-diagonal element and returns its index.
|
private double |
getNorm()
Computes the L1 norm of the (quasi-)triangular matrix T.
|
RealMatrix |
getP()
Returns the matrix P of the transform.
|
RealMatrix |
getPT()
Returns the transpose of the matrix P of the transform.
|
RealMatrix |
getT()
Returns the quasi-triangular Schur matrix T of the transform.
|
private int |
initQRStep(int il,
int iu,
SchurTransformer.ShiftInfo shift,
double[] hVec)
Initialize the householder vectors for the QR step.
|
private void |
performDoubleQRStep(int il,
int im,
int iu,
SchurTransformer.ShiftInfo shift,
double[] hVec)
Perform a double QR step involving rows l:idx and columns m:n
|
private void |
transform()
Transform original matrix to Schur form.
|
private static final int MAX_ITERATIONS
private final double[][] matrixP
private final double[][] matrixT
private RealMatrix cachedP
private RealMatrix cachedT
private RealMatrix cachedPt
private final double epsilon
public SchurTransformer(RealMatrix matrix)
matrix
- matrix to transformNonSquareMatrixException
- if the matrix is not squarepublic RealMatrix getP()
P is an orthogonal matrix, i.e. its inverse is also its transpose.
public RealMatrix getPT()
P is an orthogonal matrix, i.e. its inverse is also its transpose.
public RealMatrix getT()
private void transform()
MaxCountExceededException
- if the transformation does not convergeprivate double getNorm()
private int findSmallSubDiagonalElement(int startIdx, double norm)
startIdx
- the starting index for the searchnorm
- the L1 norm of the matrixprivate void computeShift(int l, int idx, int iteration, SchurTransformer.ShiftInfo shift)
l
- the index of the small sub-diagonal elementidx
- the current eigenvalue indexiteration
- the current iterationshift
- holder for shift informationprivate int initQRStep(int il, int iu, SchurTransformer.ShiftInfo shift, double[] hVec)
il
- the index of the small sub-diagonal elementiu
- the current eigenvalue indexshift
- shift information holderhVec
- the initial houseHolder vectorprivate void performDoubleQRStep(int il, int im, int iu, SchurTransformer.ShiftInfo shift, double[] hVec)
il
- the index of the small sub-diagonal elementim
- the start index for the QR stepiu
- the current eigenvalue indexshift
- shift information holderhVec
- the initial houseHolder vectorCopyright (c) 2003-2016 Apache Software Foundation