Top Description Fields Constructors Methods
org.apache.commons.math3.linear

pack-priv Class TriDiagonalTransformer

extends Object
Class Inheritance
Imports
java.util.Arrays, org.apache.commons.math3.util.FastMath

Class transforming a symmetrical matrix to tridiagonal shape.

A symmetrical m × m matrix A can be written as the product of three matrices: A = Q × T × QT with Q an orthogonal matrix and T a symmetrical tridiagonal matrix. Both Q and T are m × m matrices.

This implementation only uses the upper part of the matrix, the part below the diagonal is not accessed at all.

Transformation to tridiagonal shape 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.

Since
2.0

Field Summary

Modifier and TypeField and Description
private RealMatrix
cachedQ

Cached value of Q.

private RealMatrix
cachedQt

Cached value of Qt.

private RealMatrix
cachedT

Cached value of T.

private final double[][]
householderVectors

Householder vectors.

private final double[]
main

Main diagonal.

private final double[]
secondary

Secondary diagonal.

Constructor Summary

AccessConstructor and Description
pack-priv
TriDiagonalTransformer(RealMatrix
Symmetrical matrix to transform.
matrix
)

Build the transformation to tridiagonal shape of a symmetrical matrix.

Method Summary

Modifier and TypeMethod and Description
pack-priv double[][]

Returns:

the main diagonal elements of the B matrix
getHouseholderVectorsRef
()

Get the Householder vectors of the transform.

pack-priv double[]

Returns:

the main diagonal elements of the T matrix
getMainDiagonalRef
()

Get the main diagonal elements of the matrix T of the transform.

public RealMatrix

Returns:

the Q matrix
getQ
()

Returns the matrix Q of the transform.

public RealMatrix

Returns:

the Q matrix
getQT
()

Returns the transpose of the matrix Q of the transform.

pack-priv double[]

Returns:

the secondary diagonal elements of the T matrix
getSecondaryDiagonalRef
()

Get the secondary diagonal elements of the matrix T of the transform.

public RealMatrix

Returns:

the T matrix
getT
()

Returns the tridiagonal matrix T of the transform.

private void
transform()

Transform original matrix to tridiagonal form.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedQback to summary
private RealMatrix cachedQ

Cached value of Q.

cachedQtback to summary
private RealMatrix cachedQt

Cached value of Qt.

cachedTback to summary
private RealMatrix cachedT

Cached value of T.

householderVectorsback to summary
private final double[][] householderVectors

Householder vectors.

mainback to summary
private final double[] main

Main diagonal.

secondaryback to summary
private final double[] secondary

Secondary diagonal.

Constructor Detail

TriDiagonalTransformerback to summary
pack-priv TriDiagonalTransformer(RealMatrix matrix)

Build the transformation to tridiagonal shape of a symmetrical matrix.

The specified matrix is assumed to be symmetrical without any check. Only the upper triangular part of the matrix is used.

Parameters
matrix:RealMatrix

Symmetrical matrix to transform.

Exceptions
NonSquareMatrixException:
if the matrix is not square.

Method Detail

getHouseholderVectorsRefback to summary
pack-priv 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:double[][]

the main diagonal elements of the B matrix

getMainDiagonalRefback to summary
pack-priv double[] getMainDiagonalRef()

Get the main diagonal elements of the matrix T 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:double[]

the main diagonal elements of the T matrix

getQback to summary
public RealMatrix getQ()

Returns the matrix Q of the transform.

Q is an orthogonal matrix, i.e. its transpose is also its inverse.

Returns:RealMatrix

the Q matrix

getQTback to summary
public RealMatrix getQT()

Returns the transpose of the matrix Q of the transform.

Q is an orthogonal matrix, i.e. its transpose is also its inverse.

Returns:RealMatrix

the Q matrix

getSecondaryDiagonalRefback to summary
pack-priv double[] getSecondaryDiagonalRef()

Get the secondary diagonal elements of the matrix T 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:double[]

the secondary diagonal elements of the T matrix

getTback to summary
public RealMatrix getT()

Returns the tridiagonal matrix T of the transform.

Returns:RealMatrix

the T matrix

transformback to summary
private void transform()

Transform original matrix to tridiagonal form.

Transformation is done using Householder transforms.