org.apache.commons.math3.linear

## Class HessenbergTransformer

- java.lang.Object
- - org.apache.commons.math3.linear.HessenbergTransformer

     class HessenbergTransformer
    extends java.lang.Object

Class transforming a general real matrix to Hessenberg form.

A m × m matrix A can be written as the product of three matrices: A = P × H × PT with P an orthogonal matrix and H a Hessenberg matrix. Both P and H are m × m matrices.

Transformation to Hessenberg 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 orthes in class EigenvalueDecomposition from the JAMA library.

Since:
  3.1
Version:
  $Id: HessenbergTransformer.java 1334644 2012-05-06 14:33:32Z tn $
See Also:
  MathWorld, Householder Transformations

### Field Summary

Fields
`private RealMatrix` `cachedH` Cached value of H.
`private RealMatrix` `cachedP` Cached value of P.
`private RealMatrix` `cachedPt` Cached value of Pt.
`private double[][]` `householderVectors` Householder vectors.
`private double[]` `ort` Temporary storage vector.

### Constructor Summary

Constructors
Constructor and Description
`HessenbergTransformer(RealMatrix matrix)` Build the transformation to Hessenberg form of a general matrix.

### Method Summary

Methods
`RealMatrix` `getH()` Returns the Hessenberg matrix H of the transform.
`(package private) double[][]` `getHouseholderVectorsRef()` Get the Householder vectors of the transform.
`RealMatrix` `getP()` Returns the matrix P of the transform.
`RealMatrix` `getPT()` Returns the transpose of the matrix P of the transform.
`private void` `transform()` Transform original matrix to Hessenberg form.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### householderVectors

    private final double[][] householderVectors

Householder vectors.

#### ort

    private final double[] ort

Temporary storage vector.

#### cachedP

    private RealMatrix cachedP

Cached value of P.

#### cachedPt

    private RealMatrix cachedPt

Cached value of Pt.

#### cachedH

    private RealMatrix cachedH

Cached value of H.

### Constructor Detail

#### HessenbergTransformer

    public HessenbergTransformer(RealMatrix matrix)

Build the transformation to Hessenberg form of a general matrix.

Parameters:
  `matrix` - matrix to transform
Throws:
  `NonSquareMatrixException` - if the matrix is not square

### Method Detail

#### getP

    public RealMatrix getP()

Returns the matrix P of the transform.

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

Returns:
  the P matrix

#### getPT

    public RealMatrix getPT()

Returns the transpose of the matrix P of the transform.

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

Returns:
  the transpose of the P matrix

#### getH

    public RealMatrix getH()

Returns the Hessenberg matrix H of the transform.

Returns:
  the H 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

#### transform

    private void transform()

Transform original matrix to Hessenberg form.

Transformation is done using Householder transforms.