hess
Hessenberg form of a square matrix.
Category: Mathematics > Linear Algebra
Syntax
H = hess(A)
Returns the upper Hessenberg matrix similar to A.
[P, H] = hess(A)
Also returns the unitary matrix P with A = P*H*P'.
Description
An upper Hessenberg matrix is nearly triangular: all entries below the first subdiagonal are zero. Any square matrix can be reduced to this form by a sequence of orthogonal reflections, so H has the same eigenvalues as A.
The reduction is the first step of the QR algorithm for eigenvalues: working with H makes each iteration much cheaper. For a symmetric A the result H is tridiagonal up to rounding.
Input arguments
A- Square matrix.
Output arguments
H- Matrix with zeros below the first subdiagonal.
P- Orthogonal (unitary) transformation matrix.
Example
Reducing a 3-by-3 matrix
A = [1 2 3; 4 5 6; 7 8 10];
[P, H] = hess(A);
H
disp(norm(P*H*P' - A) < 1e-10)
Output
H = 3×3
1.0000 -3.5970 -0.2481
-8.0623 14.8000 2.4000
0 0.4000 0.2000
1