Class BiDiagonalTransformer
Any m × n matrix A can be written as the product of three matrices: A = U × B × VT with U an m × m orthogonal matrix, B an m × n bi-diagonal matrix (lower diagonal if m < n, upper diagonal otherwise), and V an n × n orthogonal matrix.
Transformation to bi-diagonal shape is often not a goal by itself, but it is
an intermediate step in more general decomposition algorithms like Singular Value 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.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RealMatrixCached value of B.private RealMatrixCached value of U.private RealMatrixCached value of V.private final double[][]Householder vectors.private final double[]Main diagonal.private final double[]Secondary diagonal. -
Constructor Summary
ConstructorsConstructorDescriptionBiDiagonalTransformer(RealMatrix matrix) Build the transformation to bi-diagonal shape of a matrix. -
Method Summary
Modifier and TypeMethodDescriptiongetB()Returns the bi-diagonal matrix B of the transform.(package private) double[][]Get the Householder vectors of the transform.(package private) double[]Get the main diagonal elements of the matrix B of the transform.(package private) double[]Get the secondary diagonal elements of the matrix B of the transform.getU()Returns the matrix U of the transform.getV()Returns the matrix V of the transform.(package private) booleanCheck if the matrix is transformed to upper bi-diagonal.private voidTransform original matrix to lower bi-diagonal form.private voidTransform original matrix to upper bi-diagonal form.
-
Field Details
-
householderVectors
private final double[][] householderVectorsHouseholder vectors. -
main
private final double[] mainMain diagonal. -
secondary
private final double[] secondarySecondary diagonal. -
cachedU
Cached value of U. -
cachedB
Cached value of B. -
cachedV
Cached value of V.
-
-
Constructor Details
-
BiDiagonalTransformer
BiDiagonalTransformer(RealMatrix matrix) Build the transformation to bi-diagonal shape of a matrix.- Parameters:
matrix- the matrix to transform.
-
-
Method Details
-
getU
Returns the matrix U of the transform.U is an orthogonal matrix, i.e. its transpose is also its inverse.
- Returns:
- the U matrix
-
getB
Returns the bi-diagonal matrix B of the transform.- Returns:
- the B matrix
-
getV
Returns the matrix V of the transform.V is an orthogonal matrix, i.e. its transpose is also its inverse.
- Returns:
- the V matrix
-
getHouseholderVectorsRef
double[][] getHouseholderVectorsRef()Get the Householder vectors of the transform.Note that since this class is only intended for internal use, it returns directly a reference to its internal arrays, not a copy.
- Returns:
- the main diagonal elements of the B matrix
-
getMainDiagonalRef
double[] getMainDiagonalRef()Get the main diagonal elements of the matrix B of the transform.Note that since this class is only intended for internal use, it returns directly a reference to its internal arrays, not a copy.
- Returns:
- the main diagonal elements of the B matrix
-
getSecondaryDiagonalRef
double[] getSecondaryDiagonalRef()Get the secondary diagonal elements of the matrix B of the transform.Note that since this class is only intended for internal use, it returns directly a reference to its internal arrays, not a copy.
- Returns:
- the secondary diagonal elements of the B matrix
-
isUpperBiDiagonal
boolean isUpperBiDiagonal()Check if the matrix is transformed to upper bi-diagonal.- Returns:
- true if the matrix is transformed to upper bi-diagonal
-
transformToUpperBiDiagonal
private void transformToUpperBiDiagonal()Transform original matrix to upper bi-diagonal form.Transformation is done using alternate Householder transforms on columns and rows.
-
transformToLowerBiDiagonal
private void transformToLowerBiDiagonal()Transform original matrix to lower bi-diagonal form.Transformation is done using alternate Householder transforms on rows and columns.
-